diff --git a/packages/lighting/lighting.yaml b/packages/lighting/lighting.yaml index c4d2ed3..f464955 100644 --- a/packages/lighting/lighting.yaml +++ b/packages/lighting/lighting.yaml @@ -41,11 +41,88 @@ scene: entities: light.living_room_light: "off" +# ----------------------------------------------------------------------------- +# Lighting Scripts +script: + + # Update Home Theater Lighting State + ht_player_lighting_update: + alias: Home Theater Lighting State Update + mode: restart + sequence: + - alias: Only run during Twilight/Night + condition: "{{ state_attr('sun.sun', 'elevation') < 0 }}" + + # Select Home Theater Player State + - choose: + # Playing + - conditions: "{{ is_state('input_select.ht_player_state', 'Playing') }}" + sequence: + - choose: + - conditions: "{{ is_state('input_select.ht_lighting_mode', 'Normal') }}" + sequence: + - service: scene.turn_on + target: + entity_id: scene.home_theater_dim + data: + transition: 3 + - conditions: "{{ is_state('input_select.ht_lighting_mode', 'Theater') }}" + sequence: + - service: scene.turn_on + target: + entity_id: scene.home_theater_off + data: + transition: 3 + + # Paused + - conditions: "{{ is_state('input_select.ht_player_state', 'Paused') }}" + sequence: + - choose: + - conditions: "{{ is_state('input_select.ht_lighting_mode', 'Normal') }}" + sequence: + - service: scene.turn_on + target: + entity_id: scene.home_theater_dim + data: + transition: 3 + - conditions: "{{ is_state('input_select.ht_lighting_mode', 'Theater') }}" + sequence: + - service: scene.turn_on + target: + entity_id: scene.home_theater_dim + data: + transition: 3 + + # Stopped + - conditions: "{{ is_state('input_select.ht_player_state', 'Stopped') }}" + sequence: + - choose: + - conditions: "{{ is_state('input_select.ht_lighting_mode', 'Normal') }}" + sequence: + - service: scene.turn_on + target: + entity_id: scene.home_theater_low + data: + transition: 3 + # ----------------------------------------------------------------------------- # Lighting Automations automation: # Automations for Home Theater + - alias: Home Theater Lighting + mode: queued + trigger: + - platform: homeassistant + event: start + - platform: state + entity_id: input_select.ht_player_state + - platform: numeric_state + entity_id: sun.sun + attribute: elevation + below: 0 + action: + - service: script.ht_player_lighting_update # Automations for Bedroom Nightstand Lamps - alias: Jen Nightstand Lamp