Minimal version persistent notification with 'Always' enabled, causes SEVERE battery drain
See original GitHub issueHome Assistant Android version: 2022.9.1-minimal (also happened on 2022.8.0-minimal)
Android version: 10
Phone model: Oneplus 6T
Home Assistant version: 2022.8.7
Last working Home Assistant release (if known):
Description of problem:
Whenever i set the persistent connection to Always
, after hours of leaving it that way, my battery would have drained significantly. If i set it back to Never
, all is back to normal again.
Ive been wanting to report this right from the beginning when this feature for notifications on the minimal app became available, however ive been trying to find the most optimal settings to be able to use this feature without it draining my battery but unfortunately its still draining.
I have other apps, such as Linphone or Syncthing, that also have a persistent notification and do the same thing to keep the connections alive and would run also for the same amount of hrs as this minimal version, but the right side (percentage) in the screenshots is what counts as draining battery, their percentage is close to 0% or up to 1% but Home-Assistant Companion would show 6% or 9% as you can see below(even though its not open or actively used), meaning something is wrong. Maybe it would help to look at the code for Linphone’s or Syncthing’s persistent notification? Would really appreciate a fix for this as i really want to use the notification’s feature for this minimal version without it affecting battery life.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem:
Additional information:
Please note, i have completely disabled updating sensors as part of my attempt to find the optimal settings for this. So updating sensors is not at fault. As i have had sensors update before enabling persistent notification and never had this battery drain from the minimal version before.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
I don’t have anything specific in mind, it was just a general remark as I can’t imagine the app being perfect.
There’s probably room for improvement with regards to battery usage, but unfortunately it isn’t as easy as “look at the code for [other app]”. They probably have very different architectures and complex backends that make it hard to compare. While they might show a persistent notification the behavior can be very different. If you can provide a more specific pointer that is always welcome ☺️
FYI while the app strongly recommends disabling battery optimizations when using the persistent connection it won’t actually block it from working, it will always try and only stops if it receives an exception while trying to open the connection as a foreground service. So if you’re getting the notification saying this, the app tried to (re)start the persistent connection in the background but was unable to do so because of an exception (limitation). More technical info here.