Skip to content

Instantly share code, notes, and snippets.

@zeltak
Created November 11, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeltak/95ab7f9a2aeb2d40a219de5a5fd2e5aa to your computer and use it in GitHub Desktop.
Save zeltak/95ab7f9a2aeb2d40a219de5a5fd2e5aa to your computer and use it in GitHub Desktop.
alias: guest light automation
description: guest automation for lights on/off
trigger:
- type: motion
platform: device
device_id: bf4f40f0e5729debfffc56ddd7e5f576
entity_id: binary_sensor.guest_motion
domain: binary_sensor
id: motion-detected
- type: no_motion
platform: device
device_id: bf4f40f0e5729debfffc56ddd7e5f576
entity_id: binary_sensor.guest_motion
domain: binary_sensor
id: motion-stopped
condition:
- condition: state
entity_id: input_boolean.guest_autoswitch
state: "on"
action:
- choose:
- conditions:
- condition: trigger
id: motion-detected
- condition: time
before: "22:30:00"
weekday:
- sun
- sat
- fri
- thu
- wed
- tue
- mon
after: "07:00:00"
sequence:
- service: light.turn_on
data:
brightness: 255
color_temp: 337
target:
entity_id: light.guest
- conditions:
- condition: trigger
id: motion-detected
- condition: time
after: "22:30:00"
before: "07:00:00"
weekday:
- sun
- sat
- fri
- thu
- wed
- tue
- mon
sequence:
- service: light.turn_on
data:
brightness: 40
rgb_color:
- 58
- 136
- 254
target:
entity_id: light.guest
- conditions:
- condition: trigger
id: motion-stopped
- condition: state
entity_id: binary_sensor.guest_contact
state: "off"
for:
hours: 0
minutes: 10
seconds: 0
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.guest
- conditions:
- condition: trigger
id: motion-stopped
- condition: state
entity_id: binary_sensor.guest_contact
state: "on"
for:
hours: 0
minutes: 3
seconds: 0
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.guest
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment