I’m looking for a way to trigger an automation when it changes to on but only if that device has been off for a certain amount of time. example my bed detects when some one is laying in it, I want it to perform an action when I lay in it but only if I have not been laying in it recently (like within the last 15 minutes)
alias: example
trigger:
- platform: state
entity_id: binary_sensor.bed
from: 'off'
to: 'on'
condition:
- condition: template
value_template: "{{ now() - trigger.from_state.last_changed > timedelta(minutes=15) }}"
action:
... etc ...
2 Likes