# packages/adaptive_lighting_bedroom_template.yaml # # Adaptive Lighting Mode System - Bedroom Template # # CUSTOMIZATION INSTRUCTIONS: # 1. Copy this file to a new file named after your room (e.g., adaptive_lighting_master_bedroom.yaml) # 2. Search and replace "bedroom" with your room name throughout # 3. Update entity IDs to match your actual devices # 4. Adjust available modes in input_select as desired # 5. Customize mode settings in the automation # 6. Place in config/packages/ directory # # Prerequisites: # - packages/adaptive_lighting_global.yaml loaded # - Adaptive Lighting integration installed # - Adaptive Lighting switch created for this room # - Inovelli Blue Dimmer paired with Zigbee2MQTT in Smart Bulb Mode # # Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 1589-1672 # ============================================================================= # INPUT HELPERS # ============================================================================= input_select: bedroom_lighting_mode: name: "Bedroom Lighting Mode" options: - "Adaptive" # Standard AL following sun - "Reading" # Bright, cool white - "Relaxing" # Dim, warm white - "Sleep" # Very dim, red/amber - "Manual Override" # Full user control, AL paused initial: "Adaptive" icon: mdi:lightbulb-multiple input_boolean: bedroom_weekend_mode: name: "Bedroom Weekend Mode" icon: mdi:sleep initial: off # ============================================================================= # AUTOMATIONS # ============================================================================= automation: # --------------------------------------------------------------------------- # Mode Application # --------------------------------------------------------------------------- # When mode changes, apply appropriate Adaptive Lighting settings # Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 192-306 # --------------------------------------------------------------------------- - id: bedroom_apply_lighting_mode alias: "Bedroom: Apply Lighting Mode Settings" description: "Apply AL settings based on selected lighting mode" mode: restart trigger: - platform: state entity_id: input_select.bedroom_lighting_mode - platform: homeassistant event: start variables: mode: "{{ states('input_select.bedroom_lighting_mode') }}" switch_entity: "switch.adaptive_lighting_bedroom" # UPDATE THIS mode_colors: "{{ states('input_text.adaptive_lighting_mode_colors') | from_json }}" action: - choose: # Adaptive Mode - Standard AL following sun - conditions: - condition: template value_template: "{{ 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 # Reading Mode - Bright cool white # Option 1: Read from centralized settings (recommended for maintainability) - conditions: - condition: template value_template: "{{ 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'}) }}" # Alternative: Hardcode values directly (simpler but less maintainable) # - conditions: # - condition: template # value_template: "{{ mode == 'Reading' }}" # sequence: # - service: adaptive_lighting.change_switch_settings # data: # min_brightness: 80 # max_brightness: 100 # min_color_temp: 4500 # max_color_temp: 5500 # transition: 2 # use_defaults: current # Relaxing Mode - Dim warm white - conditions: - condition: template value_template: "{{ mode == 'Relaxing' }}" sequence: - variables: settings: "{{ states('input_text.adaptive_lighting_settings_relaxing') | 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'}) }}" # Sleep Mode - Very dim red/amber - conditions: - condition: template value_template: "{{ mode == 'Sleep' }}" sequence: - variables: settings: "{{ states('input_text.adaptive_lighting_settings_sleep') | 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'}) }}" # Manual Override - Pause AL completely - conditions: - condition: template value_template: "{{ mode == 'Manual Override' }}" sequence: - service: adaptive_lighting.set_manual_control data: entity_id: "{{ switch_entity }}" manual_control: true # Update LED color on Inovelli switch to match mode # NOTE: Update entity_id to match your switch - service: number.set_value target: entity_id: number.bedroom_switch_led_color_when_on # UPDATE THIS data: value: "{{ mode_colors.get(mode, 170) }}" # --------------------------------------------------------------------------- # Weekend Mode - Auto Enable/Disable # --------------------------------------------------------------------------- # Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 894-926 # --------------------------------------------------------------------------- - id: bedroom_weekend_mode_auto_enable alias: "Bedroom: Enable Weekend Mode Friday/Saturday" trigger: - platform: time at: "22:00:00" condition: - condition: time weekday: ["fri", "sat"] action: - service: input_boolean.turn_on target: entity_id: input_boolean.bedroom_weekend_mode - id: bedroom_weekend_mode_auto_disable alias: "Bedroom: Disable Weekend Mode Sunday-Thursday" trigger: - platform: time at: "22:00:00" condition: - condition: time weekday: ["sun", "mon", "tue", "wed", "thu"] action: - service: input_boolean.turn_off target: entity_id: input_boolean.bedroom_weekend_mode # --------------------------------------------------------------------------- # Weekend Mode - Apply AL Adjustments # --------------------------------------------------------------------------- # Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 928-961 # --------------------------------------------------------------------------- - id: bedroom_weekend_mode_apply alias: "Bedroom: Apply Weekend Mode AL Adjustments" trigger: - platform: state entity_id: input_boolean.bedroom_weekend_mode - platform: homeassistant event: start variables: weekend_mode: "{{ is_state('input_boolean.bedroom_weekend_mode', 'on') }}" switch_entity: "switch.adaptive_lighting_bedroom" # UPDATE THIS action: - choose: - conditions: - condition: template value_template: "{{ weekend_mode }}" sequence: # Weekend settings: Later sunrise, lower max brightness - service: adaptive_lighting.change_switch_settings target: entity_id: "{{ switch_entity }}" data: sunrise_time: "10:00:00" sunset_time: "01:00:00" max_brightness: 60 use_defaults: current - conditions: - condition: template value_template: "{{ not weekend_mode }}" sequence: # Weekday settings: Reset to defaults - service: adaptive_lighting.change_switch_settings target: entity_id: "{{ switch_entity }}" data: use_defaults: configuration