Energy Management in Home Assistant

Vote here:

2 Likes

there is already a PR in the works to fix the Efergy Integration.

the related issue has a few options listed on how you could work around for now

1 Like

Hi,

after the update 2021.9.1, I have an error on the power supply part.

I have a spike as if the last reading did not take into account the old long term sensors.

see this pictures.

Is it possible to make a procedure to recalculate everything from the standard table or from the table of long term sensors?

[edit]
3 hours after update see this error on graf

and see this data store on my database:

this version is very big bug…
When put option for recalculate the values?

Did anyone else got wrong costs?

Energy site shows:

In the setup:
Screenshot 2021-09-03 100834

Iam not sure, what happend here :smiley:

I have a similar issue with my MQTT electricity consumption/return sensors since 2021.9.1.

Unexpected state class
The following entities do not have the expected state class ‘total_increasing’

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

When I retrieve the state in developer tools I get

state_class: measurement

How it got this state_class assigned I don’t know though, as this is not configured anywhere.

The cost also still shows this error in the logs, no idea why this should be wrong. My Hass is configured with EUR as well.

sensor.totaal_verbruik_net_hoog_tarief_cost has unknown unit EUR

Based on this thread 2021.9.0 causes generation of long term statistics to be suppressed I checked my DB. I saw that the state of the cost sensors is recorded in the states table, however there is no entry for them in the statistics_meta table.

How I made sensors that report in W (Watts) work in Energy Dashboard

Now I just need my Aeotec zigbee power monitoring smartplug (that come into HA via MQTT) to be listed as an individual device…

They show like this in Dev:

unit_of_measurement: W
friendly_name: Smart Plug - Back Lounge power
device_class: power

I might try making a template sensor and see if I can get that to work.

OK… I now have this in my configuration.yaml… let’s see if it works (I know a little but not enough so probably wrong somewhere). I can and have added them to individual devices…

UPDATE: Overly complicated. Integration Sensors can be added straight to the dashboard if setup correctly. Instructions updated.

sensor:
#Integration Sensors
  - platform: integration
    source: sensor.smart_plug_back_lounge_power
    name: Smart Plug Back Lounge Energy Spent
    unit_prefix: k
    round: 2
    method: left
  - platform: integration
    source: sensor.smart_plug_front_lounge_power
    name: Smart Plug Front Lounge Energy Spent
    unit_prefix: k
    round: 2
    method: left
  - platform: integration
    source: sensor.smart_plug_front_door_power
    name: Smart Plug Front Door Energy Spent
    unit_prefix: k
    round: 2
    method: left
  - platform: integration
    source: sensor.smart_plug_pool_filter_power
    name: Smart Plug Pool Filter Energy Spent
    unit_prefix: k
    round: 2
    method: left

then add this to customize.yaml :

sensor.smart_plug_back_lounge_energy_monitor:
  last_reset: '1970-01-01T00:00:00+00:00'
  state_class: 'total_increasing'
  device_class: energy
  unit_of_measurement: kWh

sensor.smart_plug_front_lounge_energy_monitor:
  last_reset: '1970-01-01T00:00:00+00:00'
  state_class: 'total_increasing'
  device_class: energy
  unit_of_measurement: kWh

sensor.smart_plug_front_door_energy_monitor:
  last_reset: '1970-01-01T00:00:00+00:00'
  state_class: 'total_increasing'
  device_class: energy
  unit_of_measurement: kWh

sensor.smart_plug_pool_filter_energy_monitor:
  last_reset: '1970-01-01T00:00:00+00:00'
  state_class: 'total_increasing'
  device_class: energy
  unit_of_measurement: kWh

Why would I rather want to manually install a script, MQTT broker and configure sensors, instead of just using the built-in integration?
If you believe that more and useful information could be retrieved from the Envoy device, why don’t you just contribute to the built-in integration?

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:

  customize_glob:
    sensor.currents*:
      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.

Cheers

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.

sensor:
- platform: template
  sensors:
    power_ups:
      friendly_name: UPS
      unit_of_measurement: W
      device_class: power
      value_template: "{{ state_attr('switch.sonoff_1000bda5e7', 'power') }}"    
    history1_ups:
      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:

sensor.energy_spent_ups:
  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:
image
and even cost is being calculated:
image

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)

recorder:
  commit_interval: 5
  purge_keep_days: 365
  include:
    entities:
      - 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 https://www.tmrow.com/blog/green-electricity-contracts/

2 Likes

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