Going to individual polling to global polling

Hello
I developped a custom component https://github.com/Aohzan/ipx800, through I have more than 40 entities that being pulled everytime.
I want to use the global state pull to make just one api call from hass but I don’t know how from my code. Can someone give me a little help ?
Thank you

Typically this is done using the dispatcher helper. See dispatcher.py. You can find many examples of integrations that use this.

2 Likes

See https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities

3 Likes

I will try this, thanks

Yes I saw this, I think I have to change the way my component works to use it

The DataUpdateCoordinator class is very nice and it provides a lot of functionality if you are making an API call and then each entity retrieves it’s own information. If you need more control the dispatcher method is more flexible.

1 Like