I have set up the Shelly3EM module to measure my solar power.
For this purpose I have created a sensor that sums up all three phases as follows, which works perfectly:
template:
- sensor:
- name: "Shelly3EM02: Total power"
unique_id: shelly3em02_power_total
state: >-
{{
[ states('sensor.shelly3em02_channel_a_power'),
states('sensor.shelly3em02_channel_b_power'),
states('sensor.shelly3em02_channel_c_power'),
] | map('float') | sum
}}
unit_of_measurement: W
device_class: power
state_class: measurement
availability: >-
{{
[ states('sensor.shelly3em02_channel_a_power'),
states('sensor.shelly3em02_channel_b_power'),
states('sensor.shelly3em02_channel_c_power'),
] | map('is_number') | min
}}
The problem is, that when the solar panels do not produce any energy, the sensor shows minimal negative values between 2 and 3 watts.
So I decided to create another sensor which should take the value from the sensor above but only allow values 0 (zero) and positive values as follows:
template:
- sensor:
- name: "Shelly3EM02: Total power positive only"
unique_id: shelly3em02_power_total_positive_only
unit_of_measurement: W
state: >-
{{ [ states('sensor.shelly3em02_power_total')|round(1), 0 ]|max }}
Unfortunately the reult is always “unavailable”.
Any suggestions what the problem could be?
Thanks a bunch in advance!