magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
500 stars 67 forks source link

Spike in usage caused by issue resetting daily usage at midnight #315

Open alex-peck opened 1 month ago

alex-peck commented 1 month ago

I am seeing a large spike in usage in the HA energy dashboard around midnight Image

Investigating in the history, I see my Vue 2's primary energy usage tracker (which resets daily) seemed to have quickly reset to 0 at midnight only to spike back up and then finally reset around 12:20 Image

My timezones are all set correctly in HA and Emporia systems. Interestingly, looking at the entity directly I don't see the drop Image Not sure if this is just due to smoothing HA does but figured I would pass it along.

magico13 commented 1 month ago

The initial drop is artificially added by the integration, but the spike back up is from the API call returning the data from the day before. It drops back down generally 15 minutes later when the next API call is made and returns proper data.

Home Assistant should handle that correctly, jumping the usage up but seeing the dip and cancelling it out. I don't really understand why it sometimes handles it fine and for some people it doesn't. Longer term I want to ignore the spike when it gives old data but I haven't had a chance to add that code yet.

alex-peck commented 1 month ago

I should call out part of the reason HA probably doesn't like this is because I use a helper Utility Meter on top of the daily sensor from this integration. This let's me separate out different TOU rates but has the effect of recording any increases as usage for that hour even if it drops back to 0 later on.