Skip to content

Instantly share code, notes, and snippets.

@zeltak
Created October 16, 2022 17:15
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/437159f7ab0c5eac1ee23f22284f6968 to your computer and use it in GitHub Desktop.
Save zeltak/437159f7ab0c5eac1ee23f22284f6968 to your computer and use it in GitHub Desktop.
alias: yard lights automation
description: yard automation for lights on/off
trigger:
- type: occupied
platform: device
device_id: 69f6be5c3f03a0d931cac057e97fcfe2
entity_id: binary_sensor.patio_motion
domain: binary_sensor
id: motion-detected
- type: not_occupied
platform: device
device_id: 69f6be5c3f03a0d931cac057e97fcfe2
entity_id: binary_sensor.patio_motion
domain: binary_sensor
id: motion-stopped
for:
hours: 0
minutes: 3
seconds: 0
- type: opened
platform: device
device_id: d8024fbf1f7258a1070cb67a10711cb7
entity_id: binary_sensor.patio_contact
domain: binary_sensor
id: contact-open
- type: not_opened
platform: device
device_id: d8024fbf1f7258a1070cb67a10711cb7
entity_id: binary_sensor.patio_contact
domain: binary_sensor
id: contact-closed
for:
hours: 0
minutes: 3
seconds: 0
- type: opened
platform: device
device_id: 9699766d624895ed79ad4e3003bc5541
entity_id: binary_sensor.backdoor_contact
domain: binary_sensor
id: contact-open-backdoor
- type: not_opened
platform: device
device_id: 9699766d624895ed79ad4e3003bc5541
entity_id: binary_sensor.backdoor_contact
domain: binary_sensor
id: contact-close-backdoor
for:
hours: 0
minutes: 6
seconds: 0
condition:
- condition: state
entity_id: input_boolean.yard_autoswitch
state: "on"
- condition: state
entity_id: light.patio
state: "off"
- condition: state
entity_id: light.sideyard
state: "off"
- condition: time
after: "18:00:00"
before: "07:00:00"
weekday:
- mon
- tue
- thu
- wed
- fri
- sat
- sun
action:
- choose:
- conditions:
- condition: trigger
id: motion-detected
- condition: trigger
id: contact-open
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.patio
- conditions:
- condition: trigger
id: motion-stopped
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.patio
- conditions:
- condition: trigger
id: contact-open-backdoor
sequence:
- service: light.turn_on
data: {}
target:
entity_id:
- light.sideyard
- light.patio
- conditions:
- condition: trigger
id: contact-close-backdoor
sequence:
- service: light.turn_off
data: {}
target:
entity_id:
- light.patio
- light.sideyard
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment