Energy Management in Home Assistant

The only option i have on the recorder in confi yaml is auto purge. Otherwise everything else is stored


purge_keep_days: 14`

Not sure what effect that minmal config will have. Mine is:

  purge_keep_days: 5
  db_url: mysql://secretlogin:[email protected]:3306/hadata?charset=utf8mb4
  commit_interval: 300
      - sensor
      - automation

I’ve tried using something more similar to yours, though storing alot more data.

it’s being pushed to a 108TB raid array so data isnt to much of a concern, especially while testing. Id rather grab more and not need it etc.

Still havnt seen a change though…

See image which i think is strange, cant really find much of a definition for it though. Its like its seeing that theres data there though, just cant do anything with it for some reason.


Hmm, does it stay at the value once the sun sets or actually become unavailable? Maybe you can use a template sensor to zero the reading when the sensor becomes unavailable.

I configured my Fronius inverter to stay on even when there’s no solar so that the metering keeps working.

Give it a couple of hours and see what happens

There is a bug with the default Riemann integration method (“trapezoidal”) that could be responsible for that kWh difference/error. Have a look here, and vote if it is your case:

Not a bug, a misconfiguration, as described in the thread you linked.

1 Like

How to track the consumption for exact from/to period? My electricity invoice has from to which is 15th of the month to next 15th of the month?

I think you need to use a utility meter with a 15 day offset Utility Meter - Home Assistant

1 Like

Really great to see you working on a Victron integration ! I’m putting my hand up to be a beta tester when you are ready :sunglasses:

Hi I have 2 sites, 2 electricity subscriptions. I run both my sites off one HA and its not clear how to configure the new energy management for this situation. I can add both consumption sensors easy enough but then I get one dashboard with both and I’d rather have 2 completely separate dashboards, one for each location.

Is it possible?



Hi, I didn’t see “energy” in the sidebar. What do I need to do to view it and add a device? It is not mentioned anywhere on the Internet.
I have core-2021.9.6 and 6.2.

Thank you

In configuration.yaml you need either




It’s mentioned multiple times in this thread, even multiple times by me alone…

I hace a problem configuring battery. The Energy coming ni/out of the battery doesn’t initialize everyday and ni the visualization, it shows the energy in/out of the day before.

The error is in the first pink bar and in the first light blue bar.
How can I solve it?

Have a look here where I posted one solution to this general problem Energy Management in Home Assistant - #891 by OzGav

Is it possible to use this somehow to see your current energy consumption and history but for regular devices like hue lights, TV devices etc…

Similar to how it works in homey.

1 Like

very nice feature, but on my hassio it seems to be a bit random. I’ve integrated a few of my Tuya SmartPlugs and my UPS (CP1500EPFCLCD by CPS), but the UPS graphs are showing funny data. I have a pretty much unchanged use of my computer (I know, I shoud get out more…), and the energy meters show some pretty random data. It should show about the same consumption for the last 3 months, but it doesn’t. Even the costs are calculated wrong, it shows a bigger sum on lower consumption, see pics.

in July it shows 50kWh/0€, August 108kWh/12€ and september 90kWh/21€


Would anyone know how I would write a gauge or data set to record my highest KW usage for my house between a certain time.

For example my utility provider changes me what they call a demand change, this change is a set fee .50c multiplied by my highest usage for the month for between the hours of 5pm and 8pm. I have the data just note sure how I could do it for example

Highest usage for July between those house was on 20th and it was 8kws.

Any help would be appreciated.