Hey there, i am trying to create an if/else statement for my energymeter. this sensor shows my energy consumption. if the value is positive, i get energy from the grid. if the value is negative, i give energy to the grid. I would like to create a new sensor, which shows me the amount of energy i am giving to the grid. the following code shows my idea. the config starts with no errors, but the sensor only shows “not available”
sensor:
- platform: template
sensors:
einspeiseleistung:
value_template: >-
{% if states('sensor.Haus_Leistung_W') > 0 %}
0
{% else %}
{{ states('sensor.Haus_Leistung_W') | abs }}
{% endif %}
Do you have an idea?