Dont quite know how to format the syntax for this template (brackets/curly brackets) so Id appreciate any help
I have two sensors - one binary and the other is numeric. I want to subtract a value of 6000 if a binary sensor (sensor.chiller_power_on_off) is ‘on’ from a numeric power sensor called (sensor.plant_power_consumption) to give me a numeric value for a third numeric sensor (plant_alert_power)
- platform: template
sensors:
plant_alert_power:
value_template: >-
{% if states('binary_sensor.chiller_power_on_off') == 'on' %}
{% states('sensor.plant_power_consumption') | float - 6000 %}
{% else %}
{% states('sensor.plant_power_consumption') | float %}
{% endif %}
Im absolutely terrible at Jinja formatting and the dev tools panel really doesnt help w if/else/endif for a value template (works gloriously for binary sensors)
Just cant seem to get it working correctly
Thanks Jinja HA community… =)