i have a couple automations that (for example) trigger if a switch has been on for a certain amount of time. like this one for my dumb coffee maker:
- alias: auto turn off coffee maker
trigger:
platform: state
entity_id: switch.coffee_maker
to: 'on'
for:
minutes: 90
seconds: 0
action:
service: switch.turn_off
entity_id: switch.coffee_maker
the main problem i have with this is that it will never trigger if there’s a crash/reboot.
i figure for this one i could store when it turns ‘on’ as an input_number or input_datetime and check when greater than 90 minutes have passed. but i’m curious what others have done and if there are any clever ways that i’m missing.