Energy Management in Home Assistant

The built in integration updates once a minute or longer so it’s not real-time. The mqtt approach updates once per second.

This is a great feature, unfortunately, unless I am missing something it is useful only for those with Net Metering solar production. A few utility companies in the US (such as Austin Energy in my case) take the Value-of-Solar Tariffs approach. Basically, your solar system sells all the production back to the utility company and you continue to “consume” all your energy from the grid. I believe offering that option within the HA energy management implementation should be pretty simple.
Here is some VOS info: Value-of-Solar Tariffs | State, Local, and Tribal Governments | NREL

What sensor? If using HACS Empora VUE you need to reload the MASTER
If you want USD you change that in the general settings for HA

Never expected to like this feature like I do…
The data gives me great in sights about the energy consumption of the home.
If only it would be possible to import historical data from my energy supplier and my solar panel monitoring webpage…

But adding the state_class: total_increasing is not allowed :frowning:

For what it’s worth, when energy management first became available in the stable release, setting the state_class to total_increasing didn’t work for any sensor. This has now been fixed with some, but not all, of my sensors. I haven’t tracked down what the difference between them all is, but the hack that got me going in the first place was to add in my configuration.yaml:

      state_class: total_increasing

This sets the total_increasing class to all sensors that start with “currents”. Just change this to flag the sensors you need this attribute set. I’ve put the class statement in as a comment on the sensors that need it so later when this is resolved I can enable it and remove the global filter.


Ah yes, sorry. I found this: How to set up Slimmelezer with Home Assistant for dummies

If anyone has an Actron Que air conditioner - Mike (the awesome developer of the addon) added the entity for compressor power - and now I have it as an Individual Device on my dashboard!

How do you split what comes in to the battery and out? I have the same sensor. its charging or draining. the only way to know if its a negative number

Template sensors. Examples above.

Anyone managed to get Sonoff POW readings into energy tab? Trying to solve it since few days now and can’t get it working anyhow.

This is how sonoff data is registered in my HA.

- platform: template
      friendly_name: UPS
      unit_of_measurement: W
      device_class: power
      value_template: "{{ state_attr('switch.sonoff_1000bda5e7', 'power') }}"    
      friendly_name: UPS today
      unit_of_measurement: kWh
      device_class: power
      value_template: "{{ state_attr('switch.sonoff_1000bda5e7', 'consumption').0 }}"

For energy tab purposes I understand we need to use power input so we leave consumption as it is and take power into Integration - Riemann sum integral:

- platform: integration   
  name: energy_spent_ups
  source: sensor.power_ups
  unit_prefix: k
  round: 2

Last but not least I customize it with tags found within this topic:

  state_class: measurement
  last_reset: '1970-01-01T00:00:00.000000+00:00'

And this is my energy tab with setup like this:

Strangest thing is that when I go to developer tools I see that usage is being monitored:
and even cost is being calculated:

Why for the heavens my energy tab won’t show anything from this?

I have set up recorder with includes (I have tons of sensors for which I dont need history written in DB)

  commit_interval: 5
  purge_keep_days: 365
      - sensor.energy_spent_ups
      - switch.sonoff_1000bda5e7
      - sensor.power_ups
      - sensor.history1_ups

What am I missing?
This HA instance work nearly year now, I am updating it OTA constantly. Maybe Energy function needs to be enabled somehow in configuration or registered in recorder?

Why is my sensor cost resetting? As well the numbers do not match anymore?

The answer I think is How could HA know about your individual contract? From what I can tell CO2 signal is showing you what is generally happening on your grid. So for someone that is on a standard contract it should be accurate.
As an aside even with your green power contract you get the same power as your neighbour who may not have the same contract. I understand your electricity supplier just undertakes to buy the equivalent amount of green energy as you use - you may not actually get it though depending on when they are buying and when you are using. More info here


Finally an answer, I can learn from. Thank you very much :wink:

So it looks like, my contract, as I assumed already, is a nice story on paper, a make-believe…

Good to know. Nothing in my circle of influence. In NL, al the resellers are the same :smiley:

1 Like

Does anyone know whether it is possible to add historical energy consumption to the database? I have been running Emoncms for about 7 years now and exporting it is quite easy, but importing it into energy management in home assistant is the big question mark…


you have to play with sqlite database. Maybe you can backup your *.db and edit it with eg. “DB Browser for SQLite”

1 Like

For some reason some of my add-ons don’t work anymore, most important Node-Red won’t start it says the config file is missing. Any one else having these issues? If logs are required let me know.

…which brings me to another question:
After upgrading HA, I had to correct the sensor to state_class: total_increasing
Energy Management started collecting different sensor data (counter vs. difference).

In SQLite DB I found

Any ideas how to delete/correct these bars?
Thanks, Gerhard

1 Like

Device class should be energy not power for this one.

1 Like


the new plugin is what I’ve be searching for since I installed HA.

I use the pulse counter (1) together with the “wiffi” integration (2).

this combination successfully generates counter and current consumption for each channel (wich is an impulse counter).

unfortunately I do not see these values in the energy management :frowning:

Can anyone tell how to manage this, or does anyone know how to update the wiffi integration? I would help testing :slight_smile:

Thanks in advance,

  1. PULSECOUNTER-Controller | STALL
  2. Wiffi - Home Assistant

What sensors do you have as a result of the wiffi integration, and what attributes do those entites have?