Android app eating battery

last week i changed from 2021.11 ha/docker to the current ha/hass.io and ever since the mobile app has been flattening my battery within a day.

just looking for clues as to what changed (i copied my whole config from the old install to the new, so the HA is the “same”) and what i probably need to disable to get the HA app back to being a good resident on my phone.

For me the biggest battery drain is the websocket connection that is used for local notifications. This is a new feature in the app that was added relatively rescently. You can find it in the app settings, the always on option flattens my battery so I stick to just having it enbaled when the screen is on.

3 Likes

cheers for the clue!

unfortunately it was already set to only be enabled when screen is on, and most of my sensors were already set as disabled. I could not turn off “run in background” at all.

removing the app from my phone solved all of the those issues! :rofl:

All you had to do was change that to Never and it wouldve solved your issue

thats called taking the app out of battery optimization.

a bit extreme :wink:

not as extreme as installing software and then disabling every single feature to get around it’s failings. everything that made the app “useful” was turned off or right down. if i’m not getting notifications putting a link to my HA website on the home screen is functionally the same, and gives me >2 days of battery life instead of <1.

whatever the the app was doing was functionally indistinguishable from a power virus: it provided no features other than making my phone go flat.

it was actually a bug that you had encountered however since you had visited the settings page without making a change the bug fix did not apply to you as we did not want to modify the database. Bugs do happen and if you decide to install the app later on you will not hit that bug. We also mentioned this in our blog post.

1 Like

Hi!

For me it was persistent connection. I set it to off and use Google notification service and my battery life has been good since then. HASS app used 16% and now it is at 4%. Happy :slight_smile:

Update:

now widgets won’t update automatically, so I set persistent connection to “while screen is on.” They update now and Home Assistant still use about 4% at end of day so I’m happy again :slight_smile:

(I only have WiFi connection sensor enabled)

I had also battery drain and for me disabling some iframes in lovelace which embedded external sites helped a lot. However, after I initially thought the problem was solved, I’m still wondering why an app which I don’t even use most of the day when not at home still is among the most battery intensive apps (no websockets, sensors disabled, etc.).

I have all sensors enabled, widgets and other features and the app only takes 1% at the end of the day. I don’t user any iframes or video feeds in the frontend.

When I enable websockets it says about 10% but at the end of the day my actual battery drain is never more than usual. I don’t believe androids battery reporting has been accurate ever since they removed the system usage from the app.

Are those 10% from an inactive device or a in daily use one?
Because yes, I could believe it get’s less with heavy use from other apps - but for me I observe the same extreme battery drain.

I have a pixel 7 with graphene OS and the home assistant app takes 45% of my battery just running in the background over a day with mild use of the phone itself!
It’s questionable why it does that as there’s really nothing happening. Not even notifications. I also never opened the app itself during the day so there also shouldn’t be anything computational.

  1. What are the steps necessary to troubleshoot this behavior?
  2. Are there any logging options?
  3. Are there guides for an energy efficient setup of the app vs. an inefficient so we can attempt to reproduce?

Thanks for this as I was having this issue except HA was taking 32% during the day.

I have gone through and made a couple of changes as suggested by the doc and can’t wait to see how it goes.

Is it better now? Mine suddenly start to drain my Pixel 7 battery without any changes.

For me it is, much better.

I have the same issue on a Pixel 7, the “updating sensors” pops up and won’t go away unless I force close the app. All the while it’s eating up huge amounts of battery, 13% in 52 minutes just now. If it triggers during the night my phone is in battery mode in the morning even if it was at full charge. Home Assistant displays 80%+ battery utilization as a background process in Android’s battery stats when this happens.

Always-on background is not turned on. Sensor update rate is set to normal. The only sensors enabled are “unique location”, “background location” and “location zone” (apologies if the names are not exact my app is not in english).

There’s clearly something broken going on, I’ve never seen an app absolutely murder my phone like this from executing in the background and the fact that the notification gets stuck until the phone dies doesn’t seem right either.

step 1 https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-app-battery-drain

step 2 if step 1 is not successful https://companion.home-assistant.io/docs/troubleshooting/faqs/#starting-fresh-with-the-android-app

I propose a partial solution here. Any help to a complete solution will be appreciated.