Speed of detection of 'is_charging' change

I noticed the other day that the android companion app now also reports back info on whether the phone is charging or not like the IOS companion app does. This is great because for a long time I had to use Tasker+Autoremote for automation around this. Basically I had my phone send out a message when it was charging or not and if that event occurred when I was on the way to bed I would use it as a “I’m in bed” signal to turn everything off. And then the opposite effect when I unplugged in the morning

I’m trying to reduce my reliance on Tasker+Autoremote go betweens since I want to keep all my automation in one place (in HA). So now that the android app collects this information it seemed like the perfect opportunity.

However in testing it seems the Android app is very slow to pick up this change. In my testing it can take upwards of a few minutes even to pick up the change in charging state. That’s way too slow for me, it takes a second or two for response with my current system, I’m not going to be able to switch if I have to wait for minutes :(.

I took a look at the manifest for the app and it looks like none of the intents around battery state and level are declared that I see listed in the android docs for battery monitoring. So I guess the speed makes sense since it would take a bit for the app to pick up this change with its own logic.

Would love to see these intents added in the future to improve response time here. Or as a stopgap, perhaps when the HA app receives the io.homeassistant.companion.android.background.REQUEST_ACCURATE_UPDATE intent it also collects and reports info on battery state at that time. Then I could use Tasker to fire that intent on battery state change until HA starts listening for the native intents itself.

There’s a PR for this already. It will most likely be fixed in the next update.

Ah perfect! Thanks!

1 Like