Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thoraxe
Created February 16, 2021 00:50
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 thoraxe/61d1cc27a790ede1ac1e2172114f7f1d to your computer and use it in GitHub Desktop.
Save thoraxe/61d1cc27a790ede1ac1e2172114f7f1d to your computer and use it in GitHub Desktop.
- alias: Turn on main stairs and landing lights on stair sensor movement
trigger:
platform: state
entity_id: group.stairs_sensors
to: 'on'
action:
- service: light.turn_on
entity_id: light.main_stairs_light
data_template:
brightness: >-
{% if state_attr('sun.sun','elevation') > 3 %}
255
{% else %}
3
{% endif %}
- alias: Turn off downstairs landing lights 30 seconds after bottom sensor clear
trigger:
platform: state
entity_id: binary_sensor.main_stairs_bottom_sensor_occupancy
to: 'off'
for:
seconds: 30
action:
- service: light.turn_off
entity_id: light.downstairs_landing_light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment