[This thread is not about the the camera issue others have experienced]
TLDR: the Companion app for Android (at least the minimal version) has a design defect that keeps the device awake for at least 5 minutes, if not permanently, destroying battery and data. The more entities you have in your HA, or the more frequently they update, the more this affects you.
I recently went on a trip and found out first day during the trip that my roaming data was very low, and my battery was dropping like a rock. Since I VPN home using OpenVPN for Android, I could see that there was a constant stream of data, 3-5 kbit/s download. I force-closed the Companion app on my phone, and that immediately dropped to literal zero.
I checked my battery usage and, sure enough, Home Assistant Companion was causing an enormous radio battery usage. I decided to force close HA during the vacation and stopped using it altogether.
Coming back home I decided to reproduce the scenario (connect my phone to VPN and the data network) then tcpdump the data between my phone and HA. What I discovered is that when the app is backgrounded, there is a constant WebSocket stream of events from HA to the app, for every entity that gets updated in every single tile of every single tab of the home dashboard I left open when I backgrounded the app in my HA setup. This is literally hundreds of events a minute!
This stream stops when the app is force closed.
Since I use the minimal version of the app, and HA still has yet to implement NTFY support, I must keep the WebSocket connection open so my home can notify me about important events. But I can’t realistically keep the WebSocket connection open, if the app insists on keeping subscribed to a stream of events I’m not even viewing (because the app is clearly backgrounded, and most of these entities aren’t even visible at all on the main tab of the dashboard in question).
What is my path forward here?
EDIT: I created a totally empty dashboard, set that dashboard as the default dashboard, and then simply restarted + force-closed the app. I began tcpdumping, opened the app, and indeed I keep getting pretty much every entity event sent to my phone, even though there is nothing to display in the dashboard!
UPDATE: This appears to be a bug in the HA frontend. I have analyzed the issue further:
- The problem of the dashboard subscribing to all entities happens on mobile and desktop web views, not just the app.
- Switching from the web view (browser app) to another app on the phone does not stop the subscription, and therefore HA continues to stream data to the view.
- HACS frontend extensions are not involved (I literally deleted every extension I was using, and even disabled Browser Mod).
- Whichever dashboard is being displayed on HA frontend startup or being displayed at the time of switching apps does not influence which entities send updates to the frontend. All entity value changes send events to the frontend. Therefore there is no way to mitigate this by switching to another (blank) dashboard when switching away from the HA app to another app.