Sorry for a potentially stupid question, but I’m still confused with YAML syntax. Your example is valid if included in the configuration.yaml file, isn’t it?
If I want it to be in a separate template.yaml, what should it look like?
Thanks, that looks good. What happens if I restart Home Assistant? Will it still reset?
What about this more complex scenario:
sensor_1 is on or (sensor_2 is on and sensor_3 is above 25)
>> on
sensor_1 and (sensor_2 is off or sensor_3 is below 25 (both since 20 minutes))
>> off
You could use a time pattern trigger but it would be more efficient and respond faster if you use a home assistant start event trigger, you would also have to adjust your state template.
That does not make anything more robust.
You are only using resources for nothing. If you trigger on the event that will happen as the event happens and the time pattern will always trigger too late however shot the time pattern is.