I keep finding periods of faster than expected battery drain on both my iPhone and iPad. When I look at battery usage through the iOS settings app, it typically shows 14-18 minutes of background activity per hour for the Home Assistant iOS companion app.
This occurs even when I’m asleep and there is very little activity going on.
For the 24 hour view the iOS settings app says the companion app ran 5:33 in the background - so about 20-25% of the time, which fits with the 14-18 minutes I usually see looking at a specific hour.
When this happens it typically happens on both of my iOS devices.
There are however periods (days/weeks) that the background usage seems to much lower, or I don’t notice because I’m not checking to see where my battery went.
I haven’t figured out a pattern yet.
Force closing the companion app once doesn’t seem to do it. It seems like if I force close the app multiple times that might work. Also restarting Home Assistant especially if it has been running for a few weeks seems like it might help but I don’t have any real proof.
I don’t see much in the event log when this is occurring.
The one log file that shows regular activity is HomeAssistant-Extensions-PushProvider.txt
. There is a
init() > WebSocket: Ping
that happens somewhere around once a minute:
2022-03-31 05:00:35.977 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:01:45.937 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:02:42.152 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:03:38.442 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:04:43.218 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:05:39.663 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:06:36.276 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:07:33.439 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:08:50.193 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:09:47.382 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
2022-03-31 05:10:43.889 [Info] [main] [Environment.swift:71] init() > WebSocket: Ping
There is a init() > WebSocket: Sending: {"id":402,"type":"ping"}
that occurs roughly every 3 minutes:
2022-03-31 05:00:49.601 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":389,"type":"ping"}
2022-03-31 05:03:46.930 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":390,"type":"ping"}
2022-03-31 05:06:35.974 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":391,"type":"ping"}
2022-03-31 05:07:54.212 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":392,"type":"ping"}
2022-03-31 05:11:03.484 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":393,"type":"ping"}
2022-03-31 05:15:00.346 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":394,"type":"ping"}
2022-03-31 05:18:15.645 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":395,"type":"ping"}
2022-03-31 05:21:50.228 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":396,"type":"ping"}
2022-03-31 05:23:53.265 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":397,"type":"ping"}
2022-03-31 05:26:58.720 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":398,"type":"ping"}
2022-03-31 05:30:46.575 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Sending: {"id":399,"type":"ping"}
Is this normal activity, or something to be concerned about?
Both devices are on iOS 15.4, running the latest version of the iOS companion app. The app is connected to two servers running 2022.3.4. Both servers have been running for a few weeks since upgrading to 2022.3.4.
Note this is a pattern I’ve been observing for at least the last three months.
Any guidance on how to control this is appreciated.