Energy Management in Home Assistant

Thanks for the idea. I’ll give it a go. One of the problems is the newer Gen24 inverter doesn’t provide hourly and daily energy totals. Not sure why this is the case but according to the REST API manual:

And indeed here’s what I see when I call the API.
image

So I’ll have to find a way to calculate it myself using other data returned from the inverter. I also tried assigning some values to a utility meter. The values get assigned and I can see them in the Developer Tools, but they don’t show up in the Energy configuration dialogs. How did you add the Utility Meter values for your SolarEdge?.

They have to have the right unit (be a measure of Wh or kWh), device_class: energy and state_class:measurement.

If you get realtime readings from the Fronius inverters, you can probably use the Riemann Sum integration to produce the required kWh values from the W realtime values.

Integration - Riemann sum integral - Home Assistant (home-assistant.io)

Ah ok thanks that explains it. I can definitely read all the real time values so I’ll check out that integration for summing them.

Thanks!
In the meantime they updated the HA SAJ Integration. Working now :slight_smile:
You made your own component which works with their private cloud api?

You have to generate this Feed by doing calculations with your Input.

In EmonCMS, go to Setup → Inputs and click the little spanner to add the circled part to your solar production (assuming your solar generation reads power in W or kW, not energy Wh or kWh) to get that Feed.

In EmonCMS, I have 3 power inputs: solar production, grid power (this one goes negative for export) and a house fuse-box (called consumer unit here) consumption. Not directly measured is outdoor EV charging, but you can see it can be easily calculated.

When you add a process, the blue description text box below tells you the output from that process, the output is then fed into the next process, this way you can do mathematics (see screenshot order number 7 and 12) or logic (see number 15)

Is the energy dashboard expecting the grid export entity to be negative? Mine is positive (when viewed in developer tools etc) but shows as negative on the Energy page, resulting in the other figures being wrong.

Does the energy configuration need the energy figures to be daily, or accumulating indefinitely, or it doesn’t care?

My figures are derived from the Fronius power_flow figures, using an integration integration to convert this to total energy, and the utility meter integration to convert this to daily energy. The total energy entities don’t show up as an option for me in the Energy configuration but I think that is because they don’t have a suitable device_class, as it’s not an option on the integration integration.

Also I don’t get any calculated costs even though I set prices but that’s not a big deal.

Same here. My cost is always 0, no matter what figures I fill in. Is this something to do with localisation? Or using the wrong currency symbol?

I’m using a “comma” to indicate decimals, maybe I should use a dot?
Eur/kWh instead of €/kWh?

This is a great step for the HA community. Any tutorials how to make use of the new features and widgets for smappee?

I have some BlitzWolf SHP energy plugs with Tasmota installed. That send with MQTT energy consumption to HA. Why can’t I use it for Individual devices?

Like @Penn_Tangu I’d like to know where sensor.emcncms2_solar_all_time comes from?

Yes I am very interested in this too. What is the model of your smart meter?

Yeah. Ours uses 3/4G to report data as well (Tasmania). Wish it was available on Zigbee or wifi locally.

Because Tasmota is not updated yet. It is possible, but you have to create a new discovery message for energy for it to work.

Hi Developers. Thank you for your work with the Home Energy Management feature. I came to HA expressly to improve our energy management. In the interest of encouraging further development / refinement (and not as complaints) I’ve laid out a few issues that I think need attention:

  1. Battery Integration
    Solar households will increasingly have batteries to maximise self consumption of renewable generated energy and to avoid the high retail price of imported energy (compared to the wholesale rates from exported energy).

  2. Solar Forecast
    I was very excited to see the forecast.solar in the previous HA release. But unfortunately it has a geographic range limitation which is not well documented. Solcast is an alternative but requires a bit of work to put into HA well.

  3. Energy Distribution
    The Tesla inspired energy distribution component is very nice - but apart from the battery limitation it also seems to confuse the concepts of power and energy. That display with the moving ‘electrons’ should really be based on the current power flow (kW) not on overall energy movement (kWh). It would be good to be able to edit the attributes on the bubbles, like you can in the tesla_style_power_card. For instance, showing the current electricity price gives context to current grid power draw.

To help clarify some of the points above I’ve attached my current bespoke energy management dashboard. Thanks again.

15 Likes

Same here.

I also have a BlitzWolf flash with the latest esphome, also this plug doesn’t show up at individual devices

I have the same issue in PVOUTPUT. To use a sensor in Energy it needs to store the data as long_statistics.

When are data stored as long_statistics?

it needs the ‘state_class’ with type ‘measurement’.

But: how and where do I set that ‘state_class’

2 Likes

I am in a similar situation . I have Shelly 3EM for the three phases from the grid .All the entities are perfect with the integration of Shelly into HA through HACS ( ShellyForHass (Shelly integration)). I have the Shelly 1 at the devices. I am not able to display any entity in the Energy Dashboard . Similar message " Expected Data Source Not Listed" . Please assist.

If you want your Tasmota energy sensors to appear in the Energy tab, the solution is very simple :

Open MQTT explorer, copy the original discovery message to the clipboard, past in notepad, add “last_reset_topic”,“last_reset_value_template”,“device_class”,“state_class” and republish

example for a sonoff pow r2 :

orginal discovery message :

{"name":"powr2 ENERGY Total","stat_t":"~SENSOR","avty_t":"~LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"193EF5_ENERGY_Total","device":{"identifiers":["193EF5"]},"~":"powr2/tele/","unit_of_meas":"kWh","val_tpl":"{{value_json['ENERGY'].Total}}"}

new discovery message :

{"name":"powr2 ENERGY Total","stat_t":"~SENSOR","avty_t":"~LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"193EF5_ENERGY_Total","device":{"identifiers":["193EF5"]},"~":"powr2/tele/","unit_of_meas":"kWh","last_reset_topic":"powr2/tele/SENSOR","last_reset_value_template":"1970-01-01T00:00:00+00:00","device_class":"energy","state_class":"measurement","val_tpl":"{{ value_json['ENERGY'].Total }}"}

if you want to create a script, be sure to put {{ value_json[‘ENERGY’].Total }} between {% raw %}"{{ value_json[‘ENERGY’].Total }}"{% endraw %}

  scripttasmotapow2:
    sequence:     
      - service: mqtt.publish
        data:
          retain: true
          topic: homeassistant/sensor/193EF5_ENERGY_Total/config
          payload: >
            {"name":"powr2 ENERGY Total","stat_t":"~SENSOR","avty_t":"~LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"193EF5_ENERGY_Total","device":{"identifiers":["193EF5"]},"~":"powr2/tele/","unit_of_meas":"kWh","last_reset_topic":"powr2/tele/SENSOR","last_reset_value_template":"1970-01-01T00:00:00+00:00","device_class":"energy","state_class":"measurement","val_tpl":{% raw %}"{{ value_json['ENERGY'].Total }}"{% endraw %}}

If you are not used to writing json, use https://jsonformatter.org/ to see if you wrote valid json

image

1 Like