Energy Management in Home Assistant

Hi kars

It is solved. I have 2 devices in my growatt integration. The converter and the plant. I had the converter used at first but now use the plant and it works great.

Thanks

You also have to fix your statistics_short_terrm table, or you will get a spike and wrong sums again at the next hourly run.

Profit! Now I can finally visualize the energy consumption which I am not measuring (which is strange as I measure energy consumption throughout my house at 24 different points). Maybe I will have to have a look at calibrating all energy sensors again…

Capture

1 Like

Indeed, again thanks @Kars


UPDATE `statistics` SET sum = sum - 215 where metadata_id = 222 and sum > 215;
UPDATE `statistics` SET sum = sum - 302 where metadata_id = 223 and sum > 302;
UPDATE `statistics_short_term` SET sum = sum - 215 where metadata_id = 222 and sum > 215;
UPDATE `statistics_short_term` SET sum = sum - 302 where metadata_id = 223 and sum > 302;

Should have been like this first time :


UPDATE `statistics` SET sum = sum - 215 where metadata_id = 222 ;
UPDATE `statistics` SET sum = sum - 302 where metadata_id = 223 ;
UPDATE `statistics_short_term` SET sum = sum - 215 where metadata_id = 222 ;
UPDATE `statistics_short_term` SET sum = sum - 302 where metadata_id = 223 ;
1 Like

Hello Frank,
I’ve only been running my HA for about a month and I’m looking for exactly this value. Can you explain this to a newbie how to get it?
Best regards and thanks in advance

Decided to create a separate topic for that. Find my description: Measure unmeasured energy consumption

1 Like

Hi,

I use an ESPHome based ultrasonic distance sensor to measure the remaining amount of heating oil in my tank. It has been working flawlessly since march now and I’ve added it succesfully to the energy dashboard (why can’t we rename gas to “oil” or just “heating”??).
grafik
The esp reports the oillevel only once a day, at 2 o’clock in the night.
Now to my problem: there’s days when we do not use any oil (on warmer days, and when we instead use electric heating). If no usage was reported for a specific day, the cost for that day is 0 (which is off course correct) however the cost for the following day is always 0 as well, even if there is oilusage on that day.
This is clearly a bug in the energy dashboard. Is there anything I can do about it?

Costs of water are not being tracked.
Why is that?


Took some time, now it’s fixed.

Hi,
I have a Growatt inverter that I used to monitor with the build-in Growatt integration of HA (Growatt Inverter uses a Dongle, that sends info to the Growatt servers, then HA contacts those Growatt server). But since that sometimes doesn’t work correctly (Growatt blocking the calls from HA, due to checking if the request is actually coming from a phone running ShinePhone), I have built an ESP32+TTL-to-RS-485 converter to locally monitor it locally using ESPHome. That is working just great, and is recognized as an energy source, but now I want to change my Energy Dashboard to use the readings from ESPHome AND retain the historical data from the Growatt integrated data.
Is this possible ? So modify the Solar energy part of the dashboard to use the ESPHome Growatt data and still retain the old statistics ?

How do I configure Home Assistant to never delete the meter readings of my P1 integration (slimme meter). And is there an easy way to export meter readings to CSV?

Long term hourly statistics are kept indefinitely as far as I know.

If you are using the default SQLite database, you could install the SQLite Web add-on. It has the option to export to CSV.

Metadata about the entities that have statistics is in the statistics_meta table, the statistic_id column is the entity name, and the id column is used as a foreign key in the statistics table (column metadata_id). For energy entities the sum is the total sum since creation of the statistic. The actual readings are kept in the state column.

Hello there, I’m writing to you because last night my statistics got messed up… I’ve read several hints from this thread and I think I can pinpoint a moment in time that my database went wrong. But it doesn’t look like there’s one wrong value / row that I could delete to fix it, because the error is in the sum column… Could you please point me in the right direction to fix it?

This is my database content where you can see the sum went wrong even though the readout from entity was right…

In Developer Tools > Statistics you can see each entity, and then delete or correct rows for a specific time where the error occurred. You need to click on the icon showing an arrow pointing up a slope which should be visible for the entity you are having issues with.

Thanks for brilliant advice, didn’t know there’s a tool already to do that :slight_smile:

All’s fine now. Thanks again.

Hi all,

For starters, I’d like to say that having recently added by PV batteries to the Energy management, it all was working apparently well during the short time I was feeding the batteries directly from DC with the hybrid inverters.

However it all went “wrong” when the weather got worse this month, the energy sale value went up, and it became more interesting to charge the batteries at night during off-peak hours from the grid, use them to satisfy the loads at peak hours during the day, and keep all PV production with feed-in priority, i.e. sell it all.

Now, in this use case, although the intra-day solar production appears correctly, the graph on the right with the total values for the day appears to be wrong, as it does when we try to see any of week/month/year when the manager sums it all up:

It seems Energy management is assuming the battery was charged from solar as far as daily totals go, because I see no orange arc on the “Home” total, and there is a pink dot descending from “Solar” into “Battery” which was not supposed to be there, as the battery was fully charged from the grid.

If I go to the weekly agregation, all the self-consumption is missing from that day’s bar (Dec 5th):

Is there any configuration I might be missing?
Or is this a unforeseen use case that was not programmed in the first place?

Thanks in advance,
-jprates

1 Like

Just noticed the values for the 4th of December, that seem to corroborate my initial impression that the energy distribution card values are assuming the battery was charged from solar:

For this day alone (this month so far) there is a 2 kWh self-use showing up, and if we do the math, we see why for this day alone there is self-consumption:

Solar = 34,7
Exported (grid feed-in) = 13,4
Battery charge = 19,3
Self-Consumption = 34,7 - 13,4 - 19,3 = 2 (this is wrong)

In order for the card to show self-consumption we have to generate more solar energy than the sum of export and battery charge, even though the battery was charged at night at an hour there was no solar production at all, and that is easy to check on the solar production attribute.

The truth however is shown by the self-consumed solar energy below, which correctly states there was 61% solar self-consumed, i.e. 34,7 x 0,61 = 21 kWh:

As it stands both cards contradict each other. The Energy Distribution is being incorrectly calculated.

I have reported this issue in GitHub:

You will see from my examples that when battery exports exceed household consumption.

Please feel free to add your examples to the issue and hopefully we can get someone assigned to look at resolution.

This issue also appears to be relevant;

1 Like

Hi @markpurcell , thanks for the feedback.

I had already opened an issue given the lack of response here, so now have yet another one.

It’s obvious now that the battery part is not working properly, and wrong assumptions are being made in the aggregation calculation for week/month/year.

I’m sadden to see these issues go back to 2021 and still have no one working on them :worried:

I’ll try to assist getting someone to look at this by posting on those still opened.

1 Like

Hi, are you also able to check if you put energy to the grid or consume? so left to right and right to left?

Is it possible to have two different energy dashboard that monitor different meters and PV plants and keeping statistics separate? It is necessary to install another instance of HA, or is there another way?