flixlix / energy-flow-card-plus

An upgraded Energy Distribution Card for Home Assistant, with added features like Individual Devices and refined UI enhancements, while maintaining the Energy Dashboard's original design.
152 stars 8 forks source link

[BUG] Home consumption incorrect calculation with battery exports #67

Open purcell-lab opened 1 year ago

purcell-lab commented 1 year ago

Describe the bug I have noticed there is an error in the calculations for Home consumption when battery exports > home consumption.

Take 1 July 2023 for example:

Home Consumption = Solar Total + Battery Total + Grid Total 13.2 kWh = 50.6 + 8.2 - 45.6

But the default energy dashboard shows Home as 43.1 kWh (which is also Battery Export Value, whenever battery export to grid > actual home consumption I get these errors).

The flixix energy-flow-card-plus shows 46 kWh, which is also incorrect but also different to values in the default energy card.

Screenshot 2023-08-08 17 32 24

To Reproduce

Locate a day with battery export to the grid > actual home consumption:

Display that day.

Expected behavior Expect that the Home consumption total is correctly displayed.

Screenshots I have noticed some days where the Home consumption is different between the default energy card:

image

image

The bulk of days the both cards calculate the same values:

image

image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context This issues with the default card Home Consumption calculations are being discussed here: https://github.com/home-assistant/frontend/issues/13701#issuecomment-1669041508

Please make sure all of this applies and check the checkboxes, by writing "X" inside of them.

Phoenix-DH commented 1 year ago

Hey,

I just started tonise the plugin, I habe exactly the same issue.

The value shown as home consumption is just wrong when I compare it to the integrated version or directly on my E3DC.

I am using Energy Period Selector Plus.

purcell-lab commented 10 months ago

Happy to assist by unpacking the calculations if I can be pointed into the relevant location in the code.

midadami commented 9 months ago

Happy to assist by unpacking the calculations if I can be pointed into the relevant location in the code.

You can find the relevant part if you look for the value totalHomeConsumption and check the calculations on the previous lines of code.

I have the same problem when battery imports from grid.

midadami commented 9 months ago

Love generating energy from thin air: image Correct values are: image

EiNSTeiN- commented 5 months ago

Same issue here, perhaps in a easier to understand scenario:

I have an off-grid setup with a generator and no solar. I charge my batteries once a week with the generator and run off them the rest of the time. The home calculation looks like this for today:

image

This is incorrect, the 3 kWh consumed by the batteries all came from the "grid" (actually the generator) and only 2 kWh produced by the battery went to the home.