Hello,
This post ist the continuation of this thread Energy export daily sensor not available.
As beginner in the HA community I am not allowed to add further replies to the original thread.
The topic/problem is
Energy Export Daily sensor cannot be selected in Energie Dashboard.
Energy Export Daily sensor does not have a measurement unit.
The latest configuration is
sensor:
# Sensor for Riemann sum of energy import (W -> Wh)
- platform: integration
source: sensor.power_import
name: energy_import_sum
unit_prefix: k
round: 2
method: left
# Sensor for Riemann sum of energy export (W -> Wh)
- platform: integration
source: sensor.power_export
name: energy_export_sum
unit_prefix: k
round: 2
method: left
# Sensor for Riemann sum of energy consumption (W -> Wh)
- platform: integration
source: sensor.power_consumption
name: energy_consumption_sum
unit_prefix: k
round: 2
method: left
template:
- sensor:
# Template sensor for values of power import (active_power > 0)
- name: "Power Import"
unit_of_measurement: 'W'
state_class: measurement
device_class: power
state: >
{% if states('sensor.shelly_em3_channel_a_power')|float(0) + states('sensor.shelly_em3_channel_b_power')|float(0) + states('sensor.shelly_em3_channel_c_power')|float(0) > 0 %}
{{ states('sensor.shelly_em3_channel_a_power')|float(0) + states('sensor.shelly_em3_channel_b_power')|float(0) + states('sensor.shelly_em3_channel_c_power')|float(0) }}
{% else %}
0
{% endif %}
availability: >
{{
[ states('sensor.shelly_em3_channel_a_power'),
states('sensor.shelly_em3_channel_b_power'),
states('sensor.shelly_em3_channel_c_power')
] | map('is_number') | min
}}
# Template sensor for values of power export (active_power < 0)
- name: "Power Export"
unit_of_measurement: 'W'
state_class: measurement
device_class: power
state: >
{% if states('sensor.shelly_em3_channel_a_power')|float(0) + states('sensor.shelly_em3_channel_b_power')|float(0) + states('sensor.shelly_em3_channel_c_power')|float(0) < 0 %}
{{ (states('sensor.shelly_em3_channel_a_power')|float(0) + states('sensor.shelly_em3_channel_b_power')|float(0) + states('sensor.shelly_em3_channel_c_power')|float(0))|abs }}
{% else %}
0
{% endif %}
availability: >
{{
[ states('sensor.shelly_em3_channel_a_power'),
states('sensor.shelly_em3_channel_b_power'),
states('sensor.shelly_em3_channel_c_power')
] | map('is_number') | min
}}
# Template sensor for values of power consumption
- name: "Power Consumption"
unit_of_measurement: 'W'
state_class: measurement
device_class: power
state: >
{% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
{% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
{{ (states('sensor.power_solargen')|float(0)) - states('sensor.power_export')|float(0) }}
{% else %}
{{ states('sensor.power_import')|float(0) + states('sensor.power_solargen')|float(0) }}
{% endif %}
utility_meter:
energy_import_daily:
source: sensor.energy_import_sum
name: Energy Import Daily
cycle: daily
energy_import_monthly:
source: sensor.energy_import_sum
name: Energy Import Monthly
cycle: monthly
energy_export_daily:
source: sensor.energy_export_sum
name: Energy Export Daily
cycle: daily
energy_export_monthly:
source: sensor.energy_export_sum
name: Energy Export Monthly
cycle: monthly
energy_consumption_daily:
source: sensor.energy_consumption_sum
name: Energy Consumption Daily
cycle: daily
energy_consumption_monthly:
source: sensor.energy_consumption_sum
name: Energy Consumption Monthly
cycle: monthly
The latest post from Moderator @tom_l
Blockquote
Have you exported any energy since making the change?
It won’t update until you do.
Also check Developer Tools → Statistics and press any Fix Issue buttons that are there.
-
Yes, I have exported energy to the net and the sensor shows data.
-
I have checked DevTools > Statistics: There is no Fix Issue Button. It shows “no issue”
-
DevTools > Stats checked: Energy Export Daily does not show attributes “unit_of_measurement” and “device_class”. Even after removing and recreating configuration & sensors the attributes have not changed.
Since the process of removing the configuration & sensors, restarting HA, adding the configuration and restarting HA does not add the missing measurement unit and therefore does not solve the problem, is there a way to add the missing attributes “unit_of_measurement: kWH” and “device class: energy” manually?
Thx for your support