Hello,
When changing the persistent connection to ‘Always’, the HA app excessively drains the battery on my Android phone. I am connected through a Cloudflare tunnel. Am I better off transitioning to tailscale to reduce battery drain?
Hello,
When changing the persistent connection to ‘Always’, the HA app excessively drains the battery on my Android phone. I am connected through a Cloudflare tunnel. Am I better off transitioning to tailscale to reduce battery drain?
thats to be expected the app needs to maintain a constant connection to the server.
Thank you for the reply.
My experience with messaging apps that maintain persistent connections to their servers using websockets is very different. With these apps the battery drain is negligible.
are those servers that you yourself own or ones from teh service itself like Signal?
for the app we maintain a connection and ping the server every 30 seconds so we can do a fallback necessary and to ensure teh connection is valid.
Its my own computer running the home assistant server. As I understand, the issue is with the protocol used to maintain a persistent connection.
what protocol is that? we are using websockets to keep the connection alive.
I mean the way it is implemented. 30 sec pings are too frequent for good battery life. As I understand, some services use 28 mins.
I guess a higher value would make no sense in HA.
You need to have updates from sensors to HA and notifications and GUI updates the other way, so ping times higher than 30 secs would be of no importance, since the other stuff would keep the connection open anyway.
Then I am not understanding why the massive battery drain. I have a few switches in my home and that’s it.
How many sensors do you have activated in the companion app?
Location? WiFi name? Battery charge? Battery state? just to mention a few that gets updated often.
How many states and attributes are changing on those switches?
Any metering? Last_change? Last_reported_in?
Because it’s a battery intensive features
Yes, there was metering which i have now turned off in the dashboard.
This seems to be a major issue with the app. Why would there be so much data streaming to the app when it is running in the background.
In my opinion, the only data that should be sent is the ping and notification trigger. That would go a long way to improving battery life for persistent connections.
It is hard for the devs to make rules for what is important and what is not.
Remember that the devs have to make the rules before the user have decided what data should be used.
The devs can only make general decisions.
current known issue for some https://github.com/home-assistant/android/issues/979 its unrelated to persistent connection though
Yes, and I am very appreciative for this project and all the work the devs and team have gone into making this.
If it could be added as an option though, that would be great.
Maybe I should raise this issue to the developers on GitHub?
what issue? this feature is battery intensive the ping interval is there at 30 seconds to ensure that if the connection drops messages are picked up in 30 seconds as opposed to 28 min as you said other apps handle it.
you will 100% see drain with this feature thats to be expected.
if you refer to the issue above its already logged but unrelated to persistent connection.
I have turned off all sensors in the companion app. There should not be a battery drain issue as other apps using websockets do not experiece this. If ping frequency is the issue, their should be an option to decrease ping frequency.
as mentioned earlier the higher the ping frequency the more delayed notifications will be. If the app allows that value to be configurable then you may experience notifications delayed up to the time you set. 30 seconds ensures the app can get notifications quickly with minimal delay.