I’m using HA 0.115.6 and the iOS companion app on my phone as part of my presence solution. I want to know if I have to keep the app open for it to work or if it works anyway. I know it sounds obvious but clearly some apple things work in the back-background while they are not even “open” (e.g. iMessage). My suspicion is yes and iMessage works because it is actually a builtin app, but I have to ask.
The tests I have run are inconclusive.
Assuming the answer is yes, is there a way to minimize the battery draw? This is of paramount importance to me.
If you’re referring to force-quitting the application from the app switcher, you should be aware that the things there aren’t necessarily ‘running’ - iOS is fairly aggressive about suspending the background apps so they do not use power. More information.
If you force-quit the HA iOS app, you’ll be forcing any outstanding network requests to end and preventing any future app launches from push notifications or background fetch. The system strongly takes it as a signal to stop the app from doing things. However, location updates will still be triggered as long as the app’s location permission is set to ‘Always.’
You can look at battery usage in the system Settings app, but the app should use little to no battery – its location access is optimized for lowering battery as much as possible. On average, for users who have iOS’s analytics enabled, the app consumes around 0.2-0.3% of battery per day in the background. The foreground usage will depend largely on what you have in your frontend configuration and how much you use the app.
So if I understand correctly, if I force quit the app but I have location sevices set to “Always”, it will continue to work with HA presence? Does that include iBeacon?
If that is so, the only reason I can see for leaving it in the background is to get push notifications. Do I understand correctly?
The app does not remain running in the background if you do not force quit it. It will be suspended by the system until it is woken up for something. By force-quitting it, it’ll actually use more battery every time location services needs to wake it. You’ll want to experiment on whether all the things you want will work after force-quitting the app, I believe GPS-based location will wake the app but I do not know about iBeacon.
Regular push notifications will still work. I’m unsure if attachments will. You’ll lose: background refresh (which does sensor updates periodically throughout the day), you’ll kill off any pending network requests which haven’t completed, and you won’t be able to use push notifications to wake the app to trigger a location update.