home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.8k stars 2.6k forks source link

Energy dashboard graph error #20712

Open john270 opened 2 months ago

john270 commented 2 months ago

Checklist

Describe the issue you are experiencing

For solar installation with battery, and charging from the grid, the 'energy usage' graph is displayed incorrectly. In particular, for the time of charging the battery from the grid the 'grid consumption' bar is incorrectly netted off against the 'battery charge'

Describe the behavior you expected

Night time charging battery from the grid should show two almost equal bars, one positive (for grid consumption) and one negative (for battery charging). Instead what is seen is a large negative (of the correct value), but a only very small positive bar for consumption. By downloading the energy dashboard data, and also separately the values for the related sensors, I can confirm that the 'grid consumption' value used in the graph is 'grid consumption minus battery charge'. This gives a distorted graph, and also I suspect impacts on the self-sufficiency (and possibly other charts), as in the morning (after battery charging from the grid) self sufficiency is typically around the minus 70%. 'Solar production', 'Sources' and 'TESLA image' all appear to be OK.

Steps to reproduce the issue

  1. Always occurs based on sensor values

  2. Example graph: image

  3. Expected graph: image

Sensor data and excel graphs attached history.xlsx

...

What version of Home Assistant Core has the issue?

2024.5.0

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chrome & Android app are consistent

Which operating system are you using to run this browser?

No response

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

ChristophCaina commented 1 month ago

Hm... I don't really agree to this expectation. the Graph should show that x.y kWh went into the charge of the battery. It does not indicate, from where the energy is comming from.

If you add the same amount of energy to the "taken from the grid" - it would double the total amount of energy used. MAYBE - another type of bar / color should be used for a battery charged from the grid?

Something like this? grafik

john270 commented 1 month ago

@ChristophCaina , to clarify, the issue is not the 'battery charge' bar, it is the 'from grid' bar. Currently the graph shows the battery charge as negative usage (which I agree with) but shows only very marginal grid usage, giving a net usage of very negative electricity - which is the issue, as actually it should be close to zero usage (slightly positive). Negative overall usage would be expected like that if the battery was charging from solar but it is not. Not sure extra bar colours are the answer - it would still show negative usage, and already grid and battery are different bars. I do agree though that adding an extra amount of source energy to the graph will (does - as I've tested it) corrupt the overall usage totals

ChristophCaina commented 1 month ago

I think, showing the Battery charge from the grid in another color is the only way - just like there's a difference in solar - when exported to the grid or charged into battery.

The main thing here is, that you consume energy from the grid to charge the battery. The same applies for chariging the battery from solar. It SHOULD show the amount to charge the battery as "positive" usage - in theory...

But this also applies for using energy from the battery. With the current logic, I only see the different color as a possible solution