Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created February 7, 2020 11:05
Show Gist options
  • Save d0ugal/3909cb20343a1a937c23b9c0711a57da to your computer and use it in GitHub Desktop.
Save d0ugal/3909cb20343a1a937c23b9c0711a57da to your computer and use it in GitHub Desktop.
sensor:
- platform: template
sensors:
study_active_scene:
entity_id:
- binary_sensor.in_game
- binary_sensor.study_lights_on
- binary_sensor.study_sockets_on
- input_boolean.study_alert
- input_boolean.study_front_door_motion
- input_boolean.study_front_door_ding
- input_boolean.study_presence_override
value_template: >-
{% if is_state('binary_sensor.study_presence', 'off') %}
scene.study_lights_off
{% elif is_state('input_boolean.study_alert', 'on') %}
scene.study_lights_purple
{% elif is_state('input_boolean.study_front_door_ding', 'on') %}
scene.study_lights_red
{% elif is_state('input_boolean.study_front_door_motion', 'on') %}
scene.study_lights_yellow
{% elif is_state('input_boolean.study_presence_override', 'on') %}
scene.study_lights_bright
{% elif is_state('binary_sensor.in_game', 'on') %}
scene.study_lights_game
{% elif is_state('binary_sensor.study_lights_on', 'on') %}
scene.study_lights_flux
{% else %}
scene.study_lights_off
{% endif %}
- alias: Study Scene Activator
trigger:
- platform: state
entity_id: sensor.study_active_scene
- platform: time_pattern
minutes: '/2'
seconds: 0
action:
- service: scene.turn_on
data_template:
entity_id: "{{ states.sensor.study_active_scene.state }}"
- condition: template
value_template: "{{ states.sensor.study_active_scene.state == 'scene.study_lights_flux' }}"
- service: switch.study_flux_update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment