Unfortunately due to limitations I am not allowed to add further replies - will reuse this post for further information
First of all: Thx for your patience, now I got it …
The problem was already in that post #7. I have fixed it and configuration loads as expected.
Finally this is the configuration I used, the result is below
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
Unfortunately the sensor “Energy export daily” still has no unit “kWh”, while the sensor “Energy export monthly”, which was recreated at the very same time, has the unit “kWh”. The sensor “Energy export daily” is working and collecting data, but still it cannot be selected for the Energy dashboard.
Update, 2023-05-26
Since I cannot add further replies (I am rated as beginner), I’ll add the reply to your latest post here:
- Yes, I have exported energy to the net.
- DevTools > Statistics checked: 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 the attributes have not changed as shown in the next screengrab.
Is there a way to add the missing attributes manually?
UPDATE
Because the beginners limitations for replies I have continued the discussion in this thread Energy export daily sensor not available 2