gtdiehl / iotawatt_ha

IoTaWatt for Home Assistant
Apache License 2.0
16 stars 16 forks source link

Ensure a sensors is updated after each read. #17

Closed jyavenard closed 3 years ago

jyavenard commented 3 years ago

The energy sensors based on an output (ending with _wh) may not contain the correct result due to how the iotawatt is calculating them (such as a typical Import and Export energy rule). It may be required to use the integration integration to calculate the energy the power device used over a given amount of time. For the integration to rule, the sensor state must be updated frequently. The Home Assistant value is to only update the value of a sensor if a change occurred which isn't what we want.

So we configure the HA DataUpdateCoordinator for forced updates.

Fixes #15

OzGav commented 3 years ago

I assume you have made this change to your system. How is it working?

jyavenard commented 3 years ago

So far so good, now integration with the right method is correct.

Screen Shot 2021-08-25 at 11 08 12 pm

Previously, the right integration would be over-reading by over 20%

OzGav commented 3 years ago

Nice! Hopefully this gets accepted soon!