337 lines
8.9 KiB
YAML
337 lines
8.9 KiB
YAML
# Lighting Package
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Lighting State Helpers
|
|
input_select:
|
|
ht_lighting_mode:
|
|
name: Home Theater Lighting Mode
|
|
options:
|
|
- Normal # Lights Dim on Playing/Pause, Low on Stopped
|
|
- Theater # Lights Off on Playing, Dim on Pause, No Change on Stopped
|
|
- Disabled # No Lighting Control
|
|
initial: Normal
|
|
|
|
input_button:
|
|
ht_reload_lights:
|
|
name: 'Reload Home Theater Lights'
|
|
icon: mdi:lightbulb-on-outline
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Lighting Scenes
|
|
scene:
|
|
|
|
# Nighstand Scenes
|
|
- name: JP Nightstand High
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 255
|
|
|
|
- name: JP Nightstand Low
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 100
|
|
|
|
- name: JP Nightstand Dim
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 50
|
|
|
|
- name: JP Nightstand Off
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "off"
|
|
|
|
- name: Jen Nightstand High
|
|
entities:
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 255
|
|
|
|
- name: Jen Nightstand Low
|
|
entities:
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 100
|
|
|
|
- name: Jen Nightstand Dim
|
|
entities:
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 50
|
|
|
|
- name: Jen Nightstand Off
|
|
entities:
|
|
light.jen_nightstand_light:
|
|
state: "off"
|
|
|
|
|
|
- name: Both Nightstands High
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 255
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 255
|
|
|
|
- name: Both Nightstands Low
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 100
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 100
|
|
|
|
- name: Both Nightstands Dim
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "on"
|
|
brightness: 50
|
|
light.jen_nightstand_light:
|
|
state: "on"
|
|
brightness: 50
|
|
|
|
- name: Both Nightstands Off
|
|
entities:
|
|
light.jp_nightstand_light:
|
|
state: "off"
|
|
light.jen_nightstand_light:
|
|
state: "off"
|
|
|
|
# Home Theater Lighting Scenes
|
|
- name: Home Theater Normal
|
|
entities:
|
|
light.living_room_light:
|
|
state: "on"
|
|
brightness: 255
|
|
|
|
- name: Home Theater Low
|
|
entities:
|
|
light.living_room_light:
|
|
state: "on"
|
|
brightness: 100
|
|
|
|
- name: Home Theater Dim
|
|
entities:
|
|
light.living_room_light:
|
|
state: "on"
|
|
brightness: 50
|
|
|
|
- name: Home Theater Off
|
|
entities:
|
|
light.living_room_light: "off"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Lighting Scripts
|
|
script:
|
|
|
|
# Set Dimmer "Off" Brightness
|
|
set_dimmer_off_brightness:
|
|
description: Set the Dimmer Brightness While Keeping Light Off
|
|
mode: queued
|
|
fields:
|
|
entity_id:
|
|
description: Light
|
|
selector:
|
|
entity:
|
|
domain: light
|
|
brightness:
|
|
description: Off Brightness
|
|
selector:
|
|
number:
|
|
min: 0
|
|
max: 255
|
|
sequence:
|
|
- choose:
|
|
- conditions: "{{ is_state(entity_id, 'off') }}"
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: "{{ entity_id }}"
|
|
data:
|
|
brightness: "{{ brightness }}"
|
|
transition: 1
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: "{{ entity_id }}"
|
|
transition: 0
|
|
|
|
default:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: "{{ entity_id }}"
|
|
data:
|
|
brightness: "{{ brightness }}"
|
|
transition: 0
|
|
|
|
# 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') < 6.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 Morning Lighting
|
|
- alias: Set Dim Dining Room Light to Dim
|
|
mode: single
|
|
trigger:
|
|
- platform: time
|
|
at: "04:00:00"
|
|
condition:
|
|
- condition: time
|
|
after: "04:00:00"
|
|
weekday:
|
|
- mon
|
|
- tue
|
|
- wed
|
|
- thu
|
|
- fri
|
|
action:
|
|
- service: script.set_dimmer_off_brightness
|
|
data:
|
|
entity_id: light.dining_room_light
|
|
brightness: 64
|
|
|
|
# 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: 6.0
|
|
action:
|
|
- service: script.ht_player_lighting_update
|
|
|
|
# Automations for Bedroom Nightstand Lamps
|
|
- alias: Jen Nightstand Lamp
|
|
mode: single
|
|
trigger:
|
|
- device_id: 98d9a86c7838fdbfcbdaeceef9a98f36
|
|
domain: zha
|
|
platform: device
|
|
type: remote_button_short_press
|
|
subtype: remote_button_short_press
|
|
condition: []
|
|
action:
|
|
- type: toggle
|
|
device_id: 444b8c5db71e96e192187688e1140d9a
|
|
entity_id: light.jen_nightstand_light
|
|
domain: light
|
|
|
|
- alias: J.P. Nightstand Lamp
|
|
mode: single
|
|
trigger:
|
|
- device_id: f223ed24fe135bfd6bb7006dddb6b9f8
|
|
domain: zha
|
|
platform: device
|
|
type: remote_button_short_press
|
|
subtype: remote_button_short_press
|
|
condition: []
|
|
action:
|
|
- type: toggle
|
|
device_id: a9a219b3e184e045a40959605b4c2be0
|
|
entity_id: light.jp_nightstand_light
|
|
domain: light
|
|
|
|
- alias: Nighstand Lamps Auto
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: media_player.living_room_receiver
|
|
to: 'off'
|
|
condition:
|
|
- condition: time
|
|
after: '20:00:00'
|
|
before: '01:00:00'
|
|
action:
|
|
- service: scene.turn_on
|
|
target:
|
|
entity_id: scene.jen_nightstand_high
|
|
|
|
# Automations for Presence Changes
|
|
- alias: Turn On Porch Light after Chorale
|
|
trigger:
|
|
- platform: zone
|
|
entity_id: person.jpk
|
|
zone: zone.chorale_performance
|
|
event: leave
|
|
- platform: zone
|
|
entity_id: person.jpk
|
|
zone: zone.chorale_rehearsal
|
|
event: leave
|
|
condition:
|
|
- condition: state
|
|
alias: "Sun down"
|
|
entity_id: sun.sun
|
|
state: "below_horizon"
|
|
mode: queued
|
|
action:
|
|
- service: light.turn_on
|
|
entity_id: light.porch_light
|