Custom component scan_interval

I know this thread was from a while ago, but I was trying to figure out how to get the entities that my component created to be polled when the component was completely configured at the top level, rather than at platform level where a scan_interval could be specified. This thread is the most relevant top search result so I thought I’d document how I managed to get this to work here.

The solution appears to be to use homeassistant.helpers.event.track_time_interval to schedule your own timer for an entity (or set of entities) to any scan interval. You can see this helper function in action in the arlo component. You also probably need to overload should_poll to return false too and/or remove any SCAN_INTERVAL definition in the platform code, so that the platform doesn’t start another timer for it’s entities.

2 Likes