Trying to understand device state polling (scan_interval)

I have a small handful of devices that I have the app installed on (Android); that I get information from (battery levels, Wifi Connection, location, etc) - but the polling does not seem to respect the scan_interval default (usually less than a few minutes for most) - I tend to get states that were last updated hours ago; this isn’t really acceptable to me for a state monitored home automation server; unless its a connectivity issue between the device and HASS.

If Home Assistant is supposed to poll every minute or so, why are some not being seen for hours at a time?

Is there such an automation template that I can run so that any device that has not had a state updated in say, 30 minutes - force one until it gets one; instead of wait on one to eventually come through?

I know that there is a service called:


But I am not sure how to run a ‘foreach loop’ using a template:

$entities.state.last_updated[ -gt 1800 ] | foreach { homeassistant.update_entity $_ }

“For all entities where last_updated > 1800 seconds (30 minutes), call the service against each iteration that we find during the loop”

Probably because the device being polled has shut down network activity to save battery. Happens all the time with cell phones.

I can understand that if it hasn’t been unlocked for awhile, phones go into standby / screensaver mode, but if I am actively using the device, then it should be allowing polled updates, since if it is in use, that would imply network (LTE / WiFi) is up and active, as well, waiting for activity (polling).

Am I still misunderstanding?

My bet is it’s not ha but something in your phone that is blocking the update. I assume you have enabled background reporting and you don’t have some other power saving or security feature enabled that would prevent the phone from responding.

One other thing I have noticed with my devices. If I leave a mobile_app running long enough at some point parts of the UI stop updating. After closing the app on that device and starting it again the UI elements will then update.