nordicopen / easee_hass

Custom component for Easee EV charger integration with Home Assistant
217 stars 37 forks source link

Energy dashboard 1 hour delayed using Easee Equalizer import energy entity #151

Closed gulli1986 closed 3 years ago

gulli1986 commented 3 years ago

Not sure if this is related to the energy dashboard or the Equalizer integration but give it a try here first. I found out that using the import energy entity from the Equalizer in the Energy dashboard reports hourly consumption that are exactly 1 hour delayed.

Look at the example below. The energy dashboard showed that I used 5.9 kWh during 9AM and 10AM this morning while in fact this was between 8AM and 9AM according to an hourly energy sensor that I made using the utility meter:

#Consumption every hour
utility_meter:
  energy:
    source: sensor.easee_equalizer_home_import_energy
    name: Hourly Energy Consumption
    cycle: hourly

Energy dashboard Untitled

Hourly sensor showing 5.9 kWh is the last period, energy dashboard should show 5.6 kWh for the time period 9AM to 10AM, not 5.9 kWh 2

Anyone experiencing the same issue?

gulli1986 commented 3 years ago

As an extra comment, I also checked on the norwegian el-hub platform and can confirm that the value given by the utility meter are correct with respect to the time. The energy dashboard is 1 hour delayed.

olalid commented 3 years ago

Well, I guess this is because the energy meters outputs this specific meter value only once every hour. So the increase for the previous hour arrives a few seconds after the clock passes the hour mark due to that the meter value needs to propagate from the meter, to the equalizer, to the cloud and back to the HA integration. I think all meters based on reading the HAN interface will have this issue, the data will arrive slightly after the hour mark since the meter will start sending it out "exactly" on the hour mark, and there will be some small delay before it reaches HA no matter what you do. I think this topic is not really an issue for this integration but needs to be discussed with the people that are working on the energy dashboard in HA because this is just how the meters work, and the dashboard should be able to interpret it accordingly if it knows this fact. At least I think there is no support for supplying this information to HA, unless you can set the timestamp earlier than it was actually received somehow. A topic for you perhaps @astrandb ?

gulli1986 commented 3 years ago

Thanks for your feedback.

What I find strange is that my utility meter (which is also based on the import energy entity from the Equalizer) is showing the correct value with no delay, while the energy dashboard which is using the same entity as input (import energy from the Equalizer) has a delay.

astrandb commented 3 years ago

@olalid @gulli1986 This is not a bug, it is a feature! 😃 Home Assistant updates the statistics for energy dashboard 12 minutes past the hour.

gulli1986 commented 3 years ago

@astrandb , I still don't understand why the 9 AM - 10 AM value shows 5.9 kWh on the dashboard while it shows 5.6 kWh using the utility meter.

I know that the energy dashboard updates at 10:12 AM, but it should still show the correct value for the past hour. It really look like the energy dashboard has 1 hour delay, i.e the 9 AM - 10 AM value in the energy dashboard is in fact the 08 AM - 09 AM in real life (and using the utility meter).

olalid commented 3 years ago

But does it matter when the update happens in HA? I guess the important thing is the timestamp of when the new meter value arrives in HA. Example, the time is 08:00:00 and the meter starts outputting the new meter value. A few seconds later it is registered in HA, and there will be in entry in the history log at 08:00:02. At 08:12:00 HA looks at the history and sees a new value has been recorded at 08:00:02 and interprets that as if there was a sudden surge of energy between 08:00:00 and 08:00:02. When it in fact should interpret it as it was all the energy used between 07:00:00 and 08:00:00...

gulli1986 commented 3 years ago

@olalid the reason why I am asking is because of the new rules coming out in Norway on the 1st of January next year (new "netteier" scheme).

I am trying to understand how to monitor my hourly energy usage to check against 5 kWh - 10 kWh limits etc and eventually create automations to reduce my energy usage before a limit is reach at the end of the hour.

For that I wanted to be sure I could rely on the import energy entity from the Easee Equalizer, hence my question regarding the delay. Have anyone though of a way to implement this using the Equalizer?

olalid commented 3 years ago

Well, I have thought about such things a bit, yes. There is something similar happening here in Sweden as well, but we do not have (to my knowledge) a specific date where it is supposed to be introduced though. Each grid owner is introducing this on their own schedule basically. So here it seems like it will work so that you pay a monthly fee based on the hour each month where you used the most energy, is that how it will work in Norway as well?

What I have done so far is to implement an algorithm that changes the Easee "dynamic circuit limit" so that it keeps the total power usage of the house below 10kW when the car is charging. Constant 10kW power during one hour of course means 10kWh energy consumed that hour. The energy meter is not really relevant for this algorithm, it is using the power meter (which also updates every 20 seconds instead of every hour so it is far more useful).

On my "roadmap" is also to try and control my heat pump such that it pauses when power exceeds 10kW. But that should of course only happen if the car charging power can not be reduced such that the power goes below 10kW. So there needs to be some kind of priority system.

gulli1986 commented 3 years ago

@olalid , yes same in Norway. The monthly fee will be based on the hour in the month with highest energy used. Thanks for your input, I agree that the power meter shall be used here as it will be "too late" to check the energy meter once the hour is past. You have some good ideas here, I will try and have a look at it! Closing the issue for now.

olalid commented 3 years ago

@astrandb , I still don't understand why the 9 AM - 10 AM value shows 5.9 kWh on the dashboard while it shows 5.6 kWh using the utility meter.

I know that the energy dashboard updates at 10:12 AM, but it should still show the correct value for the past hour. It really look like the energy dashboard has 1 hour delay, i.e the 9 AM - 10 AM value in the energy dashboard is in fact the 08 AM - 09 AM in real life (and using the utility meter).

Yes, I am not convinced that the algorithm that the energy dashboard uses provides the correct result, but without investigating it in detail I am not really sure. The utility meter may also work a bit strange on when set to hourly basis with an input that only updates once an hour. I have never tried that.