Yes, I use Envoy and participated in the beta. You need to create some additional sensors for ‘real time’ consumption and export.
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_energy_production') | float - states('sensor.envoy_current_energy_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_energy_consumption') | float - states('sensor.envoy_current_energy_production') | float)) | float) %}
{% if value <= 0 -%}
0
{%- else -%}
{{ value | round(2) }}
{%- endif %}
You then create two additional sensors using the Reimann Sum integration and point them to the sensors created above
- 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
During the beta, one of these sensors had all the required values, but one didn’t. So I had to customise to add the device_class: energy, state_class: measurement and last_reset value.
Then set the imported energy sensor to be the ‘Grid Consumption’, exported exergy sensor as ‘Return to Grid’
Hi @tvds
I have a Saj inversor, and I found a workaround, but I’m facing a little issue.
My inversor goes on standby at night, and the sensor on HA becomes unavailable, so I used a workround:
I use a template sensor to count when the sensor isn’t “unavailable” or “unknow”:
The only issue is at the end of solar production, the sensor get an astronic value, and I can’t figure out how to solve it. Example, today I produced 12.5KWh, and the utility_meter was counting good, until the inverter goes standby, after that, the sensor shows 74.9KWh as production today.
Standard Solaredge integration, and although it has access to consumption, self consumption, generation, exported to grid etc it doesn’t show up.
I’ve created template sensors that replicate all those values again with state_class: measurement but still no luck as it appears template sensors aren’t supported.
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>
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.
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.
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:
I’ve been wanting to do something like this with Home Assistant for so long…
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