Could somebody help me spot the mistake I am making in this automation. I made it via the Home Assistant automatons UI.
I want the study lamp to be turned on when the motion sensor is turned-on and study lamp to be turned off 5 minutes after the motion sensor is turned off.
I’ve tried to use the trigger ids mithu-table-on and mithu-table-off for the two motion trigger states, and use that in the action part of the automation.
alias: 'Study Lamp Toggle: Based on trigger IDs (motion trigger) and 2 time conditions'
description: ''
trigger:
- type: motion
platform: device
device_id: c316cb8ed428d88d280ad86fc793f20f
entity_id: binary_sensor.motion_table_mithu
domain: binary_sensor
id: mithu-table-on
- type: no_motion
platform: device
device_id: c316cb8ed428d88d280ad86fc793f20f
entity_id: binary_sensor.motion_table_mithu
domain: binary_sensor
id: mithu-table-off
for:
hours: 0
minutes: 5
seconds: 0
condition:
- condition: time
before: '08:00:00'
after: '05:00:00'
weekday:
- mon
- tue
- wed
- thu
- sun
- fri
- sat
- condition: time
before: '21:45:00'
after: '17:00:00'
weekday:
- mon
- tue
- wed
- thu
- sun
- fri
- sat
action:
- choose:
- conditions:
- condition: trigger
id: mithu-table-on
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.study_lamp_mithu
- conditions:
- condition: trigger
id: mithu-table-off
sequence:
- service: light.turn_off
data:
flash: short
target:
entity_id: light.study_lamp_mithu
default: []
mode: single
Debug trace shows this: