Skip to content

Instantly share code, notes, and snippets.

@rhooper
Created January 2, 2016 06:10
Show Gist options
  • Save rhooper/c5e700464a3bb1dc598e to your computer and use it in GitHub Desktop.
Save rhooper/c5e700464a3bb1dc598e to your computer and use it in GitHub Desktop.
Enhanced auto-light config for home assistant
switch:
platform: mock
switches:
LR Autolight: on
automation:
- alias: Turn on LR lights
trigger:
platform: state
entity_id: binary_sensor.lr_motion
state: "on"
condition:
- platform: state
entity_id: script.timer_off
state: "off"
- platform: state
entity_id: switch.lr_autolight
state: "on"
action:
service: homeassistant.turn_on
entity_id: script.timed_lamp
- alias: Restart LR light timer
trigger:
platform: state
entity_id: binary_sensor.lr_motion
state: "on"
condition:
platform: state
entity_id: script.timer_off
state: "on"
action:
service: homeassistant.turn_on
entity_id: script.reset_timer
script:
timed_lamp:
alias: "LR On"
sequence:
- execute_service: script.turn_on
service_data:
entity_id: script.reset_timer
- execute_service: scene.turn_on
service_data:
entity_id: scene.lr_on_day
reset_timer:
alias: "LR Timer Reset"
sequence:
- execute_service: script.turn_off
service_data:
entity_id: script.timer_off
- execute_service: script.turn_on
service_data:
entity_id: script.timer_off
timer_off:
alias: "LR Timer"
sequence:
- delay:
minutes: 20
- execute_service: scene.turn_off
service_data:
entity_id: scene.lr_on_day
- execute_service: scene.turn_on
service_data:
entity_id: scene.lr_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment