Energy Management in Home Assistant

It looks like it’s because they are missing the device_class.

They work for me now. I converted my legacy template sensors to the new format.

Here is a newbie instruction for getting Enphase Envoy setup in the new Energy feature of 2021.8

Open up configuration.yaml

template:
  - sensor:
        name: Grid Export Power
        state_class: measurement
        icon: mdi:solar-panel
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_serialnumber_current_power_production') | int - states('sensor.envoy_serialnumber_current_power_consumption') | int ] | max }}

  - sensor:
        name: Grid Import Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_serialnumber_current_power_consumption') | int - states('sensor.envoy_serialnumber_current_power_production') | int ] | max }}

sensor:
  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    unit_prefix: k
    unit_time: h

  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    unit_prefix: k
    unit_time: h
3 Likes

Would like to know this too Dave - same situation (in Melbourne). I still need to work out what to input for declination and azimuth also.

The rounding was a hangover for another template I had that displayed the current status of import/export in kW rather than plain watts.

I just never removed it when I derived these particular templates from that one.

inst_energy_difference:
      friendly_name: Instant Energy Difference
      icon_template: >
        {% set value = ('%0.1f' | format(states('sensor.envoy_current_energy_production') | float - states('sensor.envoy_current_energy_consumption') | float)) | float %}
        {% if value > 0 -%} 
            mdi:solar-panel
        {%- elif value < 0 -%}
            mdi:transmission-tower
        {%- else -%}
            mdi:power-off
        {%- endif %}
      friendly_name_template: >
        {% set value = ('%0.1f' | format(states('sensor.envoy_current_energy_production') | float - states('sensor.envoy_current_energy_consumption') | float)) | float %}
        {% if value > 0 -%} 
            Currently Exporting
        {%- elif value < 0 -%}
            Currently Importing
        {%- else -%}
            Balanced
        {%- endif %}
      unit_of_measurement: "kW"
      device_class: power
      value_template: >
        {% set value = (('%0.1f' | format(states('sensor.envoy_current_energy_production') | float - states('sensor.envoy_current_energy_consumption') | float)) | float) / 1000 %}
        {% if value  < 0 -%} 
          {{ (value * -1) | round(2) }}
        {%- else -%}
          {{ value | round(2) }}
        {%- endif %}
1 Like

I’ve just sent the Forecast.Solar devs an email explaining the situation and asking for the added functionality… We can only hope.

Hi Knut Kohl,

I live in Australia where we have government regulations regarding the maximum inverter size for residential properties, however the limit on solar panel capacity is higher. This means that we can have 6.6kW of panels but only a 5kW inverter. The benefit of this setup is that during the lower light periods of the day (morning and evening) we generate more power than we would if the panels and inverter were both 5kW, however we are still limited to a 5kW max output peak.

This creates an odd graph of solar output throughout the day compared to a simple 5kW / 5kW system. We basically generate that of a 6.6kW system up until it reaches 5kW, then plateaus at 5kW until the afternoon, then ramps down as if it was a 6.6kW system (from below 5kW).

Would it be possible to have such settings added to Forecast.Solar to accommodate this type of configuration? As I say, this is the same for all Australian residents with full capacity solar systems, so there is a huge user base. I just don’t think many people would think about this when setting up Forecast.Solar.

It would be great if you could consider this added functionality.

Regards,

Dave M

2 Likes

Have anyone configured necessary energy sensors via REST sensors?.

I have an interface with my inverter from which I retrieve that with REST sensors (consumption, production, balance, injection, etc.)

Is it possible?

Is it useful in Melbourne anyway? The home page says they have no data for most of Australia yet, definitely including Melbourne.

The Fronius integration polls the inverter with a REST API and publishes each measurement as an entity. You could write a custom integration to do something similar or maybe use the RESTful sensor integration depending on the format.

If you already have the data published to PVOutput you could also get it back from there using the PVOutput integration although obviously that’s a cloud dependency you might wish to avoid.

The Fronius integration doesn’t seem to provide great energy figures (limitation of the inverter), only power, so I use some template sensors and the integration and utility_meter integrations to get the data in a useful format.

Just scrolled through all the posts in this thread and don’t think this was mentioned:

I have a 2kWp PV installation connected to the grid and use an automation with my 2kW water heater to get advantage of Portugal’s 15 minute net metering.
The result is, each 15 minute period, I use some energy from the grid but the net energy is negative (more injection than consumption).

Is there a way to see use the net energy values in the Energy management instead of the “instant” energy integrations?
If not, is this in the table for a future improvement?

Anyway, congratulations to the devs for this amazing feature.

For me it doesnt graph at all,

I did add the devices in energy,
left it for 14 hours still nothing…

Is there somewhere a energy log ?
so i can see if it’s reporting any activity.

regards

how did u convert them?

I managed to get them in the list, but after 14 hours no graph :frowning:

Nice!

I have a lot’s of esphome devices reporting their power usage (pzem004t for the whole house mains, various sockets with power metering hardware) and lot’s of switches with static loads I just added a template_sensor reporting the power usage (for example a light switch with a 8w light bulb will show a Assumed Power of 8w in home assistant when the switch is on.

Thing is that I’m not able to add the last group to home assistant energy management.

It’s only possible for devices which have power monitoring capabilities.

For me that’s very annoying because I loose a lot’s of information like all the power consumption for lightning.

How can I overcome this and feed home assistant all the information I have about my power usage?

Hi all,

Taking a look at the Energy panel, once I have configured Consumption, Solar Production and injection entities (via rest sensor converted to template sensor), I get these values which seem something strange:

Taking a look to the graphs, I think there is something wrong. My consumption sensor shows the “current” consumption (updated each 5 seconds) so I do not know if this is exactly what Energy entity needs.

In the other hand, Solar production is the same. My sensor shows the “current production”, updated each 5 seconds. It has no sense to have negative values in solar production or 300% consumed in solar energy KPI in the right column.

What is going wrong?

I find it all weid, still not showing up anything.

@frenck
is there a file containing that information about the new energy ?
i think it’s not showing up because i tested with devices previously as Watt instead of kWh… maybe it messed up.
It got updated yesterday to kWh output but still no graph after 14hours

regards

after updating to the last core-update i get this message all the time i visit /energy or refresh

Logger: frontend.js.latest.202108040
Source: components/system_log/__init__.py:190
First occurred: 16:20:13 (1 occurrences)
Last logged: 16:20:13

https://MY-DNS:8123/lovelace/0:0:0 Uncaught

// UPDATE: solved, did not show up after full reboot.

or something like a shelly or sonoff POW R2 depending on HVAC power requirements

I can get all data except self-consumption - don’t know why ? I added a data source about the production value during the day - this could be the reason?

did u manually add the devices ?

and how long does did it take the bars to show ?

Use a ‘modern’ style template, not a ‘legacy’ style template. Then they can be added to the energy tab.

1 Like

Is there a possibility to create energy graphs for just one PV pannel. I added 3 PV inputs but this makes the graph a bit overloaded with the forecast. It would be nice to have control on the energy graphs. Same question for the energy graph showing to grid, from grid and solar. It would be nice to create my own copy of that graph an control what or what not to show.