The DataUpdateCoordinator model centralizes polling, for our application the preexisting ECHONETConnector class is ideal.
I have started a new branch and I have refactored all entities to use the new DataUpdateCoordinator design pattern.
The big benefit is that it reduces contention, a single Echonetlite Instance is polled at a predictable 30 second interval by the coordinator, which then automatically updates all the entities that rely on data. The same goes for push notifications - as soon as they arrive any sensors that ingest that data will be updated automatically.
I have also updated all entities to use @Property values for returning data; this means as soon as there is new data, whether by polling or by push notifications, Home Assistant should update them in real time. No more stale copies of data being stored here and there, the coordinators job is to look after all that data.
https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities
If you would like to help out with testing that would be much appreciated!
My goal is to merge and release within the next 2-3 weeks as a beta release.
The DataUpdateCoordinator model centralizes polling, for our application the preexisting ECHONETConnector class is ideal.
I have started a new branch and I have refactored all entities to use the new DataUpdateCoordinator design pattern.
The big benefit is that it reduces contention, a single Echonetlite Instance is polled at a predictable 30 second interval by the coordinator, which then automatically updates all the entities that rely on data. The same goes for push notifications - as soon as they arrive any sensors that ingest that data will be updated automatically.
I have also updated all entities to use @Property values for returning data; this means as soon as there is new data, whether by polling or by push notifications, Home Assistant should update them in real time. No more stale copies of data being stored here and there, the coordinators job is to look after all that data.
https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities
If you would like to help out with testing that would be much appreciated!
My goal is to merge and release within the next 2-3 weeks as a beta release.