I have issues with one of my scripts. When triggered it never finishes when statement is not true. When statement is true, the script is working fine. What are I missing here?
where are people getting the idea of putting all of the newline characters in their templates coming from?
In the past I’ve never seen anyone doing this. But in the last couple of months it’s been happening more and more.
you don’t need those. Instead, you can do it in two ways and the second one is a bit easier to read especially if you put in the additional lines of code as suggested by Tom:
service_template: "{% if as_timestamp(now()) - as_timestamp(states.sensor.power_load_kitchen_sensor.last_updated) | int < 600 %} switch.turn_off {% endif %}"
or
service_template: >
{% if as_timestamp(now()) - as_timestamp(states.sensor.power_load_kitchen_sensor.last_updated) | int < 600 %}
switch.turn_off
{% endif %}