home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.69k stars 28.84k forks source link

Energy lovelace - show incorrect data #118466

Open andrey170183 opened 1 month ago

andrey170183 commented 1 month ago

The problem

Hi! The energy page does not display the average value correctly. I have a "waterius" sensor that works correctly, you can see from the screenshot of the history that the indicator does not jump and goes evenly. I specially chose it in the history from May 29 to May 30. Except for the time on May 30 at 12:34 and 14:07. The screenshot of the energy tab from May 29 shows that 70 liters were used. And in the screenshot from May 30, 120,000 liters of water has already been used, an increase of 1700 times just in the period of May 30 at 12:34 and 14:07. On the energy screen from the 29th to the 30th, the data from the 29th is not even visible.

image

image

image

image

What version of Home Assistant Core has the issue?

2024.6.0b1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

ChristophCaina commented 1 month ago

as you are showing in your screenshot, you had an issue with the sensor values.

It seems, that the sensor returned a value of 0.0 two times here - and was then resetted with the previous value.

image

The energy Dashboard is doing a calculation over the changed values - which does mean, the statistics will add the reset to the usage like this:

11:00: Sensor = 40 11:15 Sensor = 41 Difference = +1

12:00: Sensor = 50 12:15: Sensor = 0 12:15: Sensor = 50 12:20: Sensor = 51

Difference: 51 instead of 1

You can fix the wrong statistics in the developer tools - but you should also check, why the sensor got a 0. Was the device not available at that time? Then, the integration should either return a "not available" rather than a 0.0

andrey170183 commented 4 weeks ago

Was the device not available at that time?

No, it was just at this time that he was connecting to MQTT and transmitting data.

ChristophCaina commented 3 weeks ago

but in your history, it is clearly visible, that the sensor has received some 0.0 values at least twice. And that is the reason for the dashboard to calculate wrong data...