I have created this template in Developer Templates and I can see the calculated value are correct and see the status change from (False,) to (True,) in Developer Templates but it does not trigger in the automation. Can someone correct my code to make it work?
Thanks
alias: Water heater element 2 on
description: Turn on water heater element 2 if there is excess solar power
trigger:
- platform: template
value_template: >-
{% set pvinverter_power =
(states('sensor.victron_pvinverter_power_total_32','')) | float * -1000 |
float %}
{% set solarcharger_total =
states('sensor.victron_solarcharger_yield_power_226') | float +
states('sensor.victron_solarcharger_yield_power_100') | float %}
{{ pvinverter_power | float > solarcharger_total | float, }}