What's the best way of periodically probing the iPhone battery level

Hey guys. Need your advice on which way I should go here. I have an iPhone at home used as SMS forwarder(and nothing else). Any incoming SMS will be forwarded to my other phone via iMessage. For safety reason I don’t want to keep the charger on all the time, but only charge when it’s necessary.

This part is done by adding automation in Shortcut part. When the battery is below the threshold, an event is fired via the companion app. And vice versa.

Taking this one step further, I want to have a way to monitor the battery level of the iPhone in as realtime as possible. My current solution is to add a bunch of automations of updating HA sensor, triggered by battery level change(the trigger can only have granularity of 5%, that is 20%, 25%, …, 80%, 85%).

Do you guys have any suggestion how I can get a finer grain sensoring? I was thinking of using Request Location Update notification, but it only works on the HA app is running. And AFAIK iOS is very likely to kill the app not being used.

I’m using the iCloud integration for iPhone battery monitoring (plus a couple of iPads and Apple Watch). I don’t know how often it updates though, but it meets my needs.

Hi @left4taco, did you ever come up with a solution for this? I also have an iOS device at home and I’m trying to figure out a way to get accurate frequent battery updates.

@ewelin34 Not really. I ended up using Shortcut to report the battery level. But on the other hand, I don’t really need a very precise battery level monitoring. For my use case, having two threshold battery level trigger is enough.

the mobile_app integration for the iOS app on the phone sensors for battery level…

It does. But the update is not realtime if Homeassistant App is not running in the foreground. I guess @ewelin34 wants a more realtime sensor

You can schedule updates using shortcuts.

Yes, I have two iPads that I want more realistic tracking. Having a siri shortcut at lower and upper levels works to force an update, but it’d be nice to have more than just every 5% battery loss/gain. I guess I’ll see if background updates start happening after leaving the iOS companion app running for a few days.

When the iOS app is running, the updates are great btw. It’s just highly likely someone will close it on the devices.

iOS app can be remotely woken by background notifications:

Could app implement it?

I think it’s already supported in the companion app. With that being said, the local push of the companion app works already very well for my use case. See how accurate the battery level is collected.

In my case idle iphone send nothing in past 20 hours:

Background updates are on, charger connected.

Check in the Companion app and make sure you are using Internal URL, Websocket is connected and Local Push is Available.

I need to do it with remote connection.