Get iPhone battery state while locked


I’ve been getting into home automation for the last year or so, and just discovered the wonders of HA and Node Red!

I’m currently trying to make a flow where if the battery state of my phone changes to Charging and my wife’s phone’s battery state is also set to Charging (and vice versa), then all the lights in the house turn off/doors lock etc…

The flow works fine, but it only works if the phones are unlocked with the Home Assistant Companion app open…

Is there any way to make this work without having the app open/phone unlocked?

I’ve had a look online but can’t seem to find anyone having the same problem…

Any help would be greatly appreciated!


Are these android phones? If so, you need to allow the app to be run in the background. For iPhones I have no idea.

No they’re both iPhones, Background App Refresh didn’t change anything unfortunately…

The most direct way to guarantee these values are updated immediately is to create a Personal Automation in which runs when charging states changes the Home Assistant shortcut “Update Sensors.”


You sir, are a genius! Thank you so much :smiley: Worked flawlessly!

This is excellent! I use some personal automations for other things but didn’t realise what that “Update Sensor” action would do. I’ve been having the exact same issue as the OP.

In case anyone like me is an “Android person” living among a home of apple people, “Shortcuts” is an app you can find on the iPad, etc. After running it, the next steps are indicating the criteria and stating that you want to run it even if you don’t get prompted (that needs to be specifically selected).

1 Like