Hi,
my name is Christoph an I’m new to Home Assistant. I’m slowly progressing and learn how to edit the config.yaml. But now I’m stuck.
I’ve managed to build a simple sensor(strom_total) which sums all power signals to one total power consumption. (Shelly 3EM). This surely sounds like the simplest task for the most of you guys, but for me this is my first success.
Now I need a second sensor (strom_total_over1500) which only shows the power consumption higher than 1500W (if the value is lower than 1500 it should send 0.0). This is as well working as expected.
And here ist my Problem. For a third sensor (strom_total_BZ) I copied the second sensor an changed its definition to calculate the difference between the actual Power and 1500W for the case that my overall power consumption is lower than 1500.
If I try to restart an get this third sensor working I receive an error message “invalid config” and I can not find the reason… searched other topics, read the documentations, tried to stick to the same syntax which works for the second sensor without any issues.
I hope you guys could help me out. Thank you in advance.
Chris
template:
sensors:
strom_total:
friendly_name: "Leistung Hausanschluss"
value_template: "{{ (states('sensor.shellyem3_c45bbe7989b8_channel_a_power')|float + states('sensor.shellyem3_c45bbe7989b8_channel_b_power')|float + states('sensor.shellyem3_c45bbe7989b8_channel_c_power')|float)}}"
unit_of_measurement: W
strom_total_kwh:
friendly_name: "Stromverbrauch_kwh"
value_template: "{{ (states('sensor.shellyem3_c45bbe7989b8_channel_a_energy')|float + states('sensor.shellyem3_c45bbe7989b8_channel_b_energy')|float + states('sensor.shellyem3_c45bbe7989b8_channel_c_energy')|float)}}"
unit_of_measurement: kWh
strom_total_over1500:
friendly_name: "Leistung über 1500"
value_template: >
{% if states("sensor.strom_total")|float > 1500 %}
{{ (states("sensor.strom_total")|float - 1500)}}
{% else %} 0.0
{% endif %}
unit_of_measurement: W
# strom_total_BZ:
# friendly_name: "Leistungsreserve BZ"
# value_template: >
# {% if states("sensor.strom_total")|float < 1500 %}
# {{ (1500 - states("sensor.strom_total")|float) }}
# {% else %} 0.0
# {% endif %}
# unit_of_measurement: W