The If-Then-Else portion of this automation is not working correctly. Even when I wait more than 10 seconds, the Then is performed, when I trigger the automation. In the visual editor, if I click Run This Action, it evaluates correctly. What could be going on here?
triggers:
- trigger: state
entity_id:
- binary_sensor.aqara_fp2_b_presence_main_zone
to: "on"
id: Presence
- trigger: state
entity_id:
- binary_sensor.aqara_fp2_b_presence_main_zone
to: "off"
id: Absence
for:
hours: 0
minutes: 0
seconds: 5
actions:
- choose:
- conditions:
- condition: trigger
id:
- Presence
sequence:
- if:
- condition: template
value_template: >-
{{ as_timestamp(now()) -
as_timestamp(states.binary_sensor.aqara_fp2_b_presence_main_zone.last_changed)
< 10 }}
then:
- action: scene.turn_on
metadata: {}
data: {}
target:
entity_id: scene.last_basement_lights
else:
- action: scene.turn_on
metadata: {}
data: {}
target:
entity_id: scene.basement_all_bright_day```