Hi,
Looking for a little help, I’m trying to setup a light automation that will turn the lights off after a certain amount of time with the timeout varying depending on the time of night. I’ve set it up using the GUI but I’ve pasted the YAML below.
Any help is appreciated.
alias: Ensuite Lights Off
description: ""
trigger:
- type: no_motion
platform: device
device_id: cdfc0e9129eac4ce312f885b1e0ee86e
entity_id: binary_sensor.lumi_lumi_motion_ac02_764a4e00_ias_zone
domain: binary_sensor
for:
hours: 0
minutes: 2
seconds: 0
condition: []
action:
- if:
- condition: time
weekday:
- sun
- sat
- fri
- thu
- wed
- tue
- mon
after: "22:59:59"
before: "05:30:00"
- type: is_no_motion
condition: device
device_id: cdfc0e9129eac4ce312f885b1e0ee86e
entity_id: binary_sensor.lumi_lumi_motion_ac02_764a4e00_ias_zone
domain: binary_sensor
for:
hours: 0
minutes: 1
seconds: 0
then:
- type: turn_off
device_id: f28f2c471af2b9dfbac70387b1034dba
entity_id: light.hey_smart_bulb
domain: light
- type: turn_off
device_id: c514899deb68b75102905c09b4e10621
entity_id: light.hey_smart_bulb_2
domain: light
else:
- if:
- type: is_no_motion
condition: device
device_id: cdfc0e9129eac4ce312f885b1e0ee86e
entity_id: binary_sensor.lumi_lumi_motion_ac02_764a4e00_ias_zone
domain: binary_sensor
for:
hours: 0
minutes: 3
seconds: 0
then:
- type: turn_off
device_id: f28f2c471af2b9dfbac70387b1034dba
entity_id: light.hey_smart_bulb
domain: light
- type: turn_off
device_id: c514899deb68b75102905c09b4e10621
entity_id: light.hey_smart_bulb_2
domain: light
mode: single