123 lines
4.7 KiB
YAML
123 lines
4.7 KiB
YAML
# packages/adaptive_lighting_living_room_template.yaml
|
|
#
|
|
# Adaptive Lighting Mode System - Living Room Template
|
|
#
|
|
# CUSTOMIZATION INSTRUCTIONS:
|
|
# 1. Copy this file and rename for your room
|
|
# 2. Search and replace "living_room" with your room name
|
|
# 3. Update entity IDs to match your devices
|
|
# 4. Adjust modes as desired
|
|
# 5. Place in config/packages/ directory
|
|
#
|
|
# Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 1512-1587
|
|
|
|
# =============================================================================
|
|
# INPUT HELPERS
|
|
# =============================================================================
|
|
|
|
input_select:
|
|
living_room_lighting_mode:
|
|
name: "Living Room Lighting Mode"
|
|
options:
|
|
- "Adaptive"
|
|
- "Theater"
|
|
- "Party"
|
|
- "Reading"
|
|
initial: "Adaptive"
|
|
icon: mdi:lightbulb-multiple
|
|
|
|
# =============================================================================
|
|
# AUTOMATIONS
|
|
# =============================================================================
|
|
|
|
automation:
|
|
# ---------------------------------------------------------------------------
|
|
# Mode Application
|
|
# ---------------------------------------------------------------------------
|
|
- id: living_room_apply_lighting_mode
|
|
alias: "Living Room: Apply Lighting Mode Settings"
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_select.living_room_lighting_mode
|
|
- platform: homeassistant
|
|
event: start
|
|
variables:
|
|
mode: "{{ states('input_select.living_room_lighting_mode') }}"
|
|
switch_entity: "switch.adaptive_lighting_living_room" # UPDATE THIS
|
|
mode_colors: "{{ states('input_text.adaptive_lighting_mode_colors') | from_json }}"
|
|
action:
|
|
- choose:
|
|
- conditions: "{{ mode == 'Adaptive' }}"
|
|
sequence:
|
|
- service: adaptive_lighting.set_manual_control
|
|
data:
|
|
entity_id: "{{ switch_entity }}"
|
|
manual_control: false
|
|
- service: adaptive_lighting.change_switch_settings
|
|
target:
|
|
entity_id: "{{ switch_entity }}"
|
|
data:
|
|
use_defaults: configuration
|
|
|
|
- conditions: "{{ mode == 'Theater' }}"
|
|
sequence:
|
|
- variables:
|
|
settings: "{{ states('input_text.adaptive_lighting_settings_theater') | from_json }}"
|
|
- service: adaptive_lighting.set_manual_control
|
|
data:
|
|
entity_id: "{{ switch_entity }}"
|
|
manual_control: false
|
|
- service: adaptive_lighting.change_switch_settings
|
|
target:
|
|
entity_id: "{{ switch_entity }}"
|
|
data: "{{ settings | combine({'use_defaults': 'current'}) }}"
|
|
|
|
- conditions: "{{ mode == 'Party' }}"
|
|
sequence:
|
|
- variables:
|
|
settings: "{{ states('input_text.adaptive_lighting_settings_party') | from_json }}"
|
|
- service: adaptive_lighting.set_manual_control
|
|
data:
|
|
entity_id: "{{ switch_entity }}"
|
|
manual_control: false
|
|
- service: adaptive_lighting.change_switch_settings
|
|
target:
|
|
entity_id: "{{ switch_entity }}"
|
|
data: "{{ settings | combine({'use_defaults': 'current'}) }}"
|
|
|
|
- conditions: "{{ mode == 'Reading' }}"
|
|
sequence:
|
|
- variables:
|
|
settings: "{{ states('input_text.adaptive_lighting_settings_reading') | from_json }}"
|
|
- service: adaptive_lighting.set_manual_control
|
|
data:
|
|
entity_id: "{{ switch_entity }}"
|
|
manual_control: false
|
|
- service: adaptive_lighting.change_switch_settings
|
|
target:
|
|
entity_id: "{{ switch_entity }}"
|
|
data: "{{ settings | combine({'use_defaults': 'current'}) }}"
|
|
|
|
- service: number.set_value
|
|
target:
|
|
entity_id: number.living_room_switch_led_color_when_on # UPDATE THIS
|
|
data:
|
|
value: "{{ mode_colors.get(mode, 170) }}"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Auto-Reset Mode to Adaptive When Lights Turn Off
|
|
# ---------------------------------------------------------------------------
|
|
- id: living_room_reset_mode_on_off
|
|
alias: "Living Room: Reset Mode to Adaptive When Off"
|
|
trigger:
|
|
- platform: state
|
|
entity_id: light.living_room # UPDATE THIS
|
|
to: 'off'
|
|
action:
|
|
- service: input_select.select_option
|
|
target:
|
|
entity_id: input_select.living_room_lighting_mode
|
|
data:
|
|
option: "Adaptive"
|