I’m trying to run an automation at a certain time if a door sensor has not fired for 60 seconds or longer. However, as coded, it runs all of the time, even if the sensor has fired in the last 60 seconds. Is this not the correct use of the timestamp attribute (or is it coded wrong)?
alias: Zooz Door Sensor Test Duplicate5
description: >-
Turn Light Red If Drawer Sensor Not Opened For 60 Seconds
trigger:
- platform: time
at: '20:35:00'
condition:
- condition: template
value_template: >-
{{ ( as_timestamp(now()) -
as_timestamp(state_attr('binary_sensor.open_close_xs_sensor_access_control_window_door_is_open',
'last_triggered')) |int(0) ) > 60 }}
action:
- service: light.turn_on
target:
entity_id: light.desk_lamp
data:
color_name: red
flash: short
mode: single
1 post - 1 participant