Skip to content

Instantly share code, notes, and snippets.

@thoraxe
Created January 31, 2021 20:19
Show Gist options
  • Save thoraxe/76655601ef128cdba10dfdcaab9b2a70 to your computer and use it in GitHub Desktop.
Save thoraxe/76655601ef128cdba10dfdcaab9b2a70 to your computer and use it in GitHub Desktop.
- alias: Turn on main stairs and landing lights on lower sensor movement
trigger:
platform: state
entity_id: binary_sensor.main_stairs_bottom_sensor_occupancy
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 %}
1
{% endif %}
- service: light.turn_on
entity_id: light.downstairs_landing_light
data_template:
brightness: >-
{% if state_attr('sun.sun','elevation') > 3 %}
255
{% else %}
50
{% endif %}
- service: light.turn_on
entity_id: light.upstairs_hallway_light
data_template:
brightness: >-
{% if state_attr('sun.sun','elevation') > 3 %}
255
{% else %}
1
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment