I have this working - my instant consumption is delivered to Home Assistant via MQTT from an RFXComm433 stick. I had already previously set up the integration component to get daily, weekly, monthly, quarterly and yearly readings out of this (using the utility_meter integration). The sensor I use with the integration component is being picked up in the Energy dashboard with no modifications:
- platform: mqtt
name: "House Electric"
state_topic: "dhjm/rfxgateway/CM119_160/0xC872"
device_class: power
unit_of_measurement: 'W'
value_template: "{{ value_json.power.value | int }}"
- platform: integration
source: sensor.house_electric
name: House Electric KWh
unit_prefix: k
round: 2
I buy certified renewable electricity from Tibber. It would be cool if the energy-monitoring panel could take that into account when showing me how much power is renewable.
Not sure what the practice is around the world, but in Norway it is possible to buy electricity that is certified to be renewable (all Tibber-customers use this - which should easily account for the majority of Home Assistant users in Norway with functioning consumption-monitoring).
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.