Energy Management in Home Assistant

This looks amazing, thanks HA team!

Has anyone got this working with the fronius integration?

It looks like the sensors don’t have the required attributes.

Okay. Looks like the SolarEdge other sensors need last_reset added with the same value as the “date” attribute as they reset their values daily. I’ve managed to get them to show up by hard-coding their values, but not sure what code change would be required to update the integration.

state_class: measurement
last_reset: <set to the "date" atribute somehow>

2 Likes

Cheers mate. I’ve just added the code you supplied. All sensors seem to be working, and I’ve added them to the energy page, but grid consumption and return to grid are not showing anything. I’ve given it a few hours so something should be showing.

EDIT: Hmm, seems to have just updated. LOL. Now to check to make sure all the values are correct.

For what it’s worth I opened an issue to track this as my experience mirrors yours so far.

Thanks @dgaust, I got my sensors hooked up like yours are but I had to change the base sensors from sensor.envoy_current_energy_XXXXX to sensor.envoy_current_power_XXXXX. Would you please confirm that this is correct? I think they renamed those sensors for unit accuracy since they are reporting Watts (power) and not Watt-hours (energy).

      solar_export_value:
        friendly_name: Solar Export Value
        icon_template: mdi:solar-panel
        unit_of_measurement: "W"
        device_class: power
        value_template: >
          {% set value = (('%0.1f' | format(states('sensor.envoy_current_power_production') | float - states('sensor.envoy_current_power_consumption') | float)) | float) %}
          {% if value  <= 0 -%} 
            0
          {%- else -%}
            {{ value | round(2) }}
          {%- endif %}

      house_consumption_value:
        friendly_name: House Importing Value
        icon_template: mdi:transmission-tower
        unit_of_measurement: "W"
        device_class: power
        value_template: >
          {% set value = (('%0.1f' | format(states('sensor.envoy_current_power_consumption') | float - states('sensor.envoy_current_power_production') | float)) | float) %}
          {% if value  <= 0 -%} 
            0
          {%- else -%}
            {{ value | round(2) }}
          {%- endif %}

Unfortunately, I still don’t see the “Exported Energy” option I created to select from the “Return to grid” dropdown box. However, maybe I need that sensor to have some value besides zero on it (since it’s nighttime and I have not exported anything to the grid since creating the sensor)?
Hopefully, tomorrow I’ll see it pop up in there and I’ll be ready to go…

Yes, they may have changed, I’ve had the integration for almost a year now - so those entities have been around a while.

It looks ok to me - but you now need to create the other sensors and point them to these template sensors (yes, it’s a little complex).

- platform: integration
  source: sensor.house_consumption_value
  name: Imported Energy
  unit_prefix: k
  round: 2
  method: left

- platform: integration
  source: sensor.solar_export_value
  name: Exported Energy
  unit_prefix: k
  round: 2
  method: left

Restart, and then check to make sure those sensors exist - and also make sure they both have the following attributes

device_class: energy
state_class: measurement
last_reset: '2021-07-31T11:04:08.091669+00:00' (just any time in the past is fine)

If they’re not there, just use the customise entity option to add/change them.

They should then be available to select.

edit: Sorry, saw you’d created those integration sensors. So just double check the attributes are there.

2 Likes

Thanks @dgaust, I got it working with your help. It was that I needed to force the units as well (via customize). Once I did that I saw the “Exported Energy” option available.

I’m really getting excited about this new Energy Management in HA. I wonder if we’ll eventually be able to represent the array per-panel like the Enphase Enlighten app:
image

I’ve been wanting to do something like this with Home Assistant for so long… :smiley:

Is there a way to add a fixed daily cost to the energy cost calculation? I’m thinking like an extra entry field here:

8 Likes

Yet? Suggests this is possibly coming, is that correct?

How on earth did you get a Fronius to show up in here? I’ve spent the better part of the day trying to get either of the two integrations for them to show useful data

I didn’t do anything special, this is the code:

sensor:
  - platform: fronius
    resource: http://192.168.1.141
    scan_interval: 10
    monitored_conditions:
    - sensor_type: inverter
    - sensor_type: meter
    - sensor_type: power_flow

I’ll be checking tomorrow to see if the ones I’ve selected produce the correct values.

First of all great work !

But I’m missing home battery integration on the dashboard. Is this planned for the future.

What hardware to get for easiest setup to monitor my household energy consumption?
I’ve got a Sonoff Pow but it’s only monitoring the fridge at the moment.
Shelly EM seems like a good option?

How are you seeing AUD/kWh ? i’m seeing EUR when my location is correct in the system as far as I know

image

Just to add to my previous reply, the following sensors give the correct values:

Frenck’s reply from earlier:

There is a new setting for local currency.

2 Likes

I’ve got my Energy values coming in as KNX sensors. Unfortunately, they do not support device_class or state_class attributes. Is there a way, how I can make them still work?

Could someone please add support to all the KNX energy sensors?

Thanks for sharing your config. I have copied your fronius integration config and the energy config and this is what I get:

The 9.4 kWh is my total production today not the current production. Did it take a while to sort it self out? Do you mind sharing a screen shot of your energy page?

Do you have default_config:? Otherwise add my: integration to your config

It’s energy though, not power, so “current” production doesn’t make sense. It has to be over a period of time. The top-right graphic shows the daily stats. I don’t think this new “energy” integration does power. This is mine for reference. 0.7kWh is the total solar production since I set it up 4 hours ago:

1 Like