A REST API for reporting the battery percentage of jailbroken iOS devices
- Jailbroken iOS device (only 32-bit devices are supported at the moment)
- Terminal/SSH access to your iOS device
- (Recommended) A tweak that keeps Wi-Fi on even when the device is locked (like
iNoSleep
) - Git CLI (
apt-get install git
) on your iOS device - Python 2.5.1 (
apt-get install python
) on your iOS device - Awk (
apt-get install gawk
) on your iOS device - Screen (
apt-get install screen
) on your iOS device
- Meet the requirements
- Follow the instructions here to generate an SSH key on your iOS device to be able to access GitHub
- Run
cat /path/to/<your key>.pub
and copy its contents to this GitHub page - Clone this repository to your iOS device (
git clone git@github.com:ShonP40/iOS-REST-Battery.git
) - Clone the
SimpleJSON
repository to your iOS device (git clone git@github.com:simplejson/simplejson.git
) - cd into the
simplejson
directory - Install the
simplejson
package usingpython setup.py install
- cd into the
iOS-REST-Battery
directory - Install
batterydata-arm32.deb
usingdpkg -i batterydata-arm32.deb
- Start the script by running
python script.py
to test it out - Press
Ctrl + C
to stop the script
- cd into the
iOS-REST-Battery
directory - Create a new screen session by running
screen -S battery
- Start the script by running
python script.py
- Detach from the screen session by pressing
Ctrl + A + D
- Reattach to the screen session by running
screen -r battery
- Press
Ctrl + C
to stop the script - Run
git pull
- Start the script again by running
python script.py
- Detach from the screen session by pressing
Ctrl + A + D
If you are using this sctipt to display the battery status of your iOS device on Home Assistant, you can use the following configuration as an example:
sensor:
- platform: rest
name: iPad battery status
unique_id: ipad_battery_status
resource: http://<iPad IP>:8000/status
method: GET
value_template: "{{ value_json.Battery }}"
unit_of_measurement: "%"
device_class: battery
json_attributes:
- Battery
- Battery status