Template trigger only work in templates editor

Hello!

I have this template trigger that results in “true” when it supposed to in the template editor but it doesn’t do the same when put into the automation.yaml

value_template: "{% if((as_timestamp(now())-as_timestamp(states.switch.sonoff__room_fan.last_updated)) | int /60) > (states.input_slider.bedroomfan_timer_minutes.state | int + states.input_slider.bedroomfan_timer_hours.state | int * 60) -%}true{% endif %}"

Any idea why?

probably because it doesn’t evaluate to a boolean.
Try this:

`

“{{((as_timestamp(now())-as_timestamp(states.switch.sonoff__room_fan.last_updated)) | int /60) > (states.input_slider.bedroomfan_timer_minutes.state | int + states.input_slider.bedroomfan_timer_hours.state | int * 60) }}”

`

I copied your template and in the editor it shows the correct state, but the actual (same) template sensor not updating its state. Why is that? :thinking: