Inexplicable battery drain in the background

Hello all,

A few days ago I noticed that the battery on iPhone 13 Pro (running iOS 17.1.2) suddenly started draining uncharacteristically fast. I looked at the app usage in Settings and noticed that Home Assistant was at the top, accounting for ~80% of the overall usage – even though I barely open it once or twice a day.

In order to make sure it was the culprit, I uninstalled the app, charged my phone to 100%, waited a full day and indeed, the battery usage was back to normal.

Yesterday, after having fully charged my phone again, I installed Home Assistant and this time made sure not to enable Location access or any other background process. I have an automation, which turns on battery saver between 23:00 and 7:00. At 22:00 the batter was slightly above 50%, this morning it was down to 25%, which is not normal.

You can see on this screenshot that HA is the top-most app, accounting for 4 minutes of foreground usage and 2:45 hours of background use, whereas the second most used app is just 24 mins, or 14%

Here are the Home Assistant settings. The only thing enabled is Local network access and Mobile data (although, at the time in question, the phone was connected to WiFi all the time).

Has anyone experienced anything like that? Is this a bug in the app that will, hopefully, be removed soon?

2 Likes

I just checked the phones in the household here. Home assistant app is eating 25-35% battery on background tasks. Something is wrong for sure.

1 Like

Android user here. Same issue. It’s been eating through battery life for a few days now. App is biggest power user ATM.

I‘m facing the same issue for a long long time already. I was wondering why my battery life got so much worse - I need to charge the iPhone multiple times a day meanwhile. Same for other iPhones with HA Companion app.

Currently running latest 2024.1 iOS Companion app, but the issue is at least one to one and a half years old (when I started location tracking via GPS using the HA app).

Facts:

I have no freaking idea how the app can run in the back at all, because neither background sync nor location service are enabled.

Can it be

  • fitness data?
  • notifications - which are received, also during the last 24 hours (but I thought they are severed via Apple‘s Push Notification Service? How to check if local push is actually used?) - according to Local Push | Home Assistant Companion Docs

Although small, battery usage will be increased by a small amount when Local Push is enabled as it maintains an ongoing connection to your HA server. You can disable it in the connection settings for your server.

I put my bets on the notifications, as

  • this is the only interaction from the synthetic last 24 hours test
  • my Android Tablets loose a lot of battery life also since Local Push with constant connection is enabled (I don‘t like that but also don‘t care about those stationary Android devices with large battery’s or even connected to a wall panel charger)

I really need to sort this out for my iOS devices as it heavily affects my devices and daily life in a negative way - at home and while on the go (HA not publicly reachable).

I am having the same battery drain on my iPhone, but only since the latest release of the app, which includes the CarPlay support.

Oddly, the Apple Home Accessories was also using significant battery - but also only since the HA companion app was updated. I’ve removed the Apple Home app (after deleting all homes in the app) as I don’t use it. But still seeing the HA companion app as the main culprit in battery usage.

I’ve noticed in the last month or two that battery drain has gone back up for me again.

One of the ways I’ve worked around this, which I think yields some clues is I have a test instance of home assistant that is almost always quiet. When I’m not going to be doing much with Home Assistant (like overnight when sleeping) I use the multi-server feature to switch the companion app to the quiet installation. I still get notifications from my main Home Assistant install, but the battery drain is less.

I think I need to try to dig into things and understand what causes Home Assistant to send updates to the companion app and what things prevent updates from being sent. I haven’t done much tracing yet, even with the screen off/locked, I still see a lot of web socket updates from Home Assistant to my iPhone when capturing packets on the network. I can’t see what they are because I was just blindly firing up tcpdump.

A bit of a potential success story:

I

  • removed the external URL (which was the same as the internal as my HA instance is not exposed to the internet) a few days ago,
  • disabled “Local Push” a few days ago
  • and also force closed the HA Companion app after using it within the last days

Both changes (I think the first one can be ignored, just a cleanup) seem to have a (very) positive effect up to now: no more background usage at all according to iOS settings battery view (only for the valid time of actually using the app).

I need to rule out if it was the enabled local push or the app being active in the back at all within the next days.

Downside of course is much less frequent sensor updates for my iDevice (was set to “every 15 minutes”, but updates are pushed to HA anyway e. g. focus setting changes), which is totally OK so far.

Maybe just me, but it seems like battery drain went way down in the last few days with the latest iOS app update.

EDIT/UPDATE:. While things seemed like they got better for a short period, still seeing Home Assistant as my largest consumer of battery on my iOS devices.

There seem to be factors which make it get better and worse.

Appreciate any clues for,improving the situation.

Have you guys also noticed a steep fall in Battery Health? I have.

I started using HA in January. My iPhone 14 pro max was 12 months old and battery health was still 98%. I make a sport out of pampering my batteries.

Two months in using HA companion app and battery health dropped to 91%.

No I don’t. And even if I would, there‘s no basis for mapping any of those changes to a specific app (like HA Companion app).

I have the same situation, I have withdrawn all permissions from the app to be executed in the background. Nevertheless, I see about 20 minutes per hour of background activity. Regardless of the local push, all sensor data is additionally deactivated. Only the hard closing of the app prevents this behavior.

Works for me. Opened it only once for a minute this morning. Got suspended by iOS after another minute of inactivity. Last 24 hours:

very strange, after your post i tried again and now there is no more background activity. i can’t explain it.
Is it perhaps possible that deactivating the local push does not have an immediate effect?
But why did I had background activity after I disabled background activity in the iOS settings generally? I don’t know, but now it works now.

I have also seen the same behavior with the iOS native files app. The files app is now working properly again. Spooky

1 Like