magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
454 stars 61 forks source link

1MIN data is about 1-2 min late #97

Open xmorand opened 2 years ago

xmorand commented 2 years ago

Data from ha-emporia-vue is about 1-2 mins late on actual data. I have calculations in HA that compare the data from ha-emporia-view with other energy monitors (like thermostats) and the difference in time causes a bad sync in the calculations.

In the image below, the green graph is the data from ha-emporia-vue, and the blue line is an export of the data from emporia app (with the accurate time). The delta in this example is 1min 40 sec.

image

I don't know if this has to do with the way the data is polled and if this can be fixed without significant re-factoring.

Thanks for the great work on this integration!

magico13 commented 2 years ago

This might be due to a change I made to try to ensure good data came back. I think I can probably cut a minute off that gap but the remaining 40 seconds might be due to when home assistant decides to poll for new data, the exact second within the minute is effectively random.

xmorand commented 2 years ago

Thanks, you know best on the reason why certain timers exist :) I guess this could be even closer to accuracy if ever emporia decides to enable per second metric on their API one day....

Thanks again!