diff --git a/blueprints/automation/apply_lighting_mode.yaml b/blueprints/automation/apply_lighting_mode.yaml new file mode 100644 index 0000000..d165013 --- /dev/null +++ b/blueprints/automation/apply_lighting_mode.yaml @@ -0,0 +1,92 @@ +blueprint: + name: Apply Lighting Mode Settings + description: Data-driven mode application using convention-based entity lookup + domain: automation + +input: + mode_input_select: + name: Mode Input Select + description: Dropdown helper tracking current lighting mode + selector: + entity: + domain: input_select + + adaptive_lighting_switch: + name: Adaptive Lighting Switch + description: AL switch for this room + selector: + entity: + domain: switch + integration: adaptive_lighting + + led_color_entity: + name: LED Color Entity (Optional) + description: Number entity for LED color (e.g., Inovelli switch) + default: {} + selector: + entity: + domain: number + +mode: restart +max_exceeded: silent + +trigger: + - platform: state + entity_id: !input mode_input_select + - platform: homeassistant + event: start + +variables: + mode_select: !input mode_input_select + al_switch: !input adaptive_lighting_switch + led_entity: !input led_color_entity + mode: "{{ states(mode_select) }}" + settings_entity: >- + input_text.adaptive_lighting_settings_{{ mode | lower | replace(' ', '_') }} + settings: "{{ states(settings_entity) | from_json }}" + behavior: "{{ settings.behavior | default('adaptive_lighting') }}" + manual_control: "{{ settings.manual_control | default(false) }}" + al_config: "{{ settings.al_config | default({}) }}" + led_color: "{{ settings.led_color | default(170) }}" + +action: + # Always set manual_control state based on mode settings + - service: adaptive_lighting.set_manual_control + data: + entity_id: "{{ al_switch }}" + manual_control: "{{ manual_control }}" + + # Execute behavior-specific actions + - choose: + # Behavior: adaptive_lighting + - conditions: "{{ behavior == 'adaptive_lighting' }}" + sequence: + - service: adaptive_lighting.change_switch_settings + target: + entity_id: "{{ al_switch }}" + data: "{{ al_config | combine({'use_defaults': 'current'}) }}" + + # Behavior: scene + - conditions: "{{ behavior == 'scene' }}" + sequence: + - service: scene.turn_on + target: + entity_id: "{{ settings.scene_entity }}" + + # Behavior: script + - conditions: "{{ behavior == 'script' }}" + sequence: + - service: script.turn_on + target: + entity_id: "{{ settings.script_entity }}" + + # Update LED color if entity provided + - if: + - condition: template + value_template: "{{ led_entity not in [none, {}, ''] }}" + then: + - service: number.set_value + target: + entity_id: "{{ led_entity }}" + data: + value: "{{ led_color }}" diff --git a/blueprints/automation/weekend_mode_apply_settings.yaml b/blueprints/automation/weekend_mode_apply_settings.yaml new file mode 100644 index 0000000..c23484c --- /dev/null +++ b/blueprints/automation/weekend_mode_apply_settings.yaml @@ -0,0 +1,85 @@ +blueprint: + name: Weekend Mode Apply Settings + description: Adjust AL settings when weekend mode toggles + domain: automation + +input: + weekend_mode_boolean: + name: Weekend Mode Boolean + description: Toggle helper for weekend mode + selector: + entity: + domain: input_boolean + + adaptive_lighting_switch: + name: Adaptive Lighting Switch + description: AL switch to adjust + selector: + entity: + domain: switch + integration: adaptive_lighting + + sunrise_time: + name: Weekend Sunrise Time + description: Delayed sunrise time for weekends + default: "10:00:00" + selector: + time: + + sunset_time: + name: Weekend Sunset Time + description: Extended sunset time for weekends + default: "01:00:00" + selector: + time: + + max_brightness: + name: Weekend Max Brightness + description: Reduced max brightness for weekends + default: 60 + selector: + number: + min: 1 + max: 100 + step: 1 + unit_of_measurement: "%" + +mode: restart +max_exceeded: silent + +trigger: + - platform: state + entity_id: !input weekend_mode_boolean + - platform: homeassistant + event: start + +variables: + weekend_boolean: !input weekend_mode_boolean + al_switch: !input adaptive_lighting_switch + sunrise_time: !input sunrise_time + sunset_time: !input sunset_time + max_brightness: !input max_brightness + weekend_active: "{{ is_state(weekend_boolean, 'on') }}" + +action: + - choose: + # Weekend mode ON - Apply adjustments + - conditions: "{{ weekend_active }}" + sequence: + - service: adaptive_lighting.change_switch_settings + target: + entity_id: "{{ al_switch }}" + data: + sunrise_time: "{{ sunrise_time }}" + sunset_time: "{{ sunset_time }}" + max_brightness: "{{ max_brightness }}" + use_defaults: current + + # Weekend mode OFF - Reset to defaults + - conditions: "{{ not weekend_active }}" + sequence: + - service: adaptive_lighting.change_switch_settings + target: + entity_id: "{{ al_switch }}" + data: + use_defaults: configuration diff --git a/blueprints/automation/weekend_mode_schedule.yaml b/blueprints/automation/weekend_mode_schedule.yaml new file mode 100644 index 0000000..4ad15c7 --- /dev/null +++ b/blueprints/automation/weekend_mode_schedule.yaml @@ -0,0 +1,46 @@ +blueprint: + name: Weekend Mode Schedule + description: Auto-enable/disable weekend mode based on day of week + domain: automation + +input: + weekend_mode_boolean: + name: Weekend Mode Boolean + description: Toggle helper for weekend mode + selector: + entity: + domain: input_boolean + + toggle_time: + name: Toggle Time + description: Time to check and toggle weekend mode + default: "22:00:00" + selector: + time: + +mode: single +max_exceeded: silent + +trigger: + - platform: time + at: !input toggle_time + +action: + - choose: + # Friday/Saturday - Enable weekend mode + - conditions: + - condition: time + weekday: [fri, sat] + sequence: + - service: input_boolean.turn_on + target: + entity_id: !input weekend_mode_boolean + + # Sunday-Thursday - Disable weekend mode + - conditions: + - condition: time + weekday: [sun, mon, tue, wed, thu] + sequence: + - service: input_boolean.turn_off + target: + entity_id: !input weekend_mode_boolean diff --git a/packages/adaptive_lighting_bedroom_template.yaml b/packages/adaptive_lighting_bedroom_template.yaml deleted file mode 100644 index 86bd075..0000000 --- a/packages/adaptive_lighting_bedroom_template.yaml +++ /dev/null @@ -1,235 +0,0 @@ -# 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 diff --git a/packages/adaptive_lighting_living_room_template.yaml b/packages/adaptive_lighting_living_room_template.yaml deleted file mode 100644 index 782b25a..0000000 --- a/packages/adaptive_lighting_living_room_template.yaml +++ /dev/null @@ -1,122 +0,0 @@ -# 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_lights # UPDATE THIS - to: 'off' - action: - - service: input_select.select_option - target: - entity_id: input_select.living_room_lighting_mode - data: - option: "Adaptive" diff --git a/packages/adaptive_lighting_simple_template.yaml b/packages/adaptive_lighting_simple_template.yaml deleted file mode 100644 index 7c261d4..0000000 --- a/packages/adaptive_lighting_simple_template.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# packages/adaptive_lighting_simple_template.yaml -# -# Adaptive Lighting Mode System - Simple Template -# -# For rooms that only need basic Adaptive Lighting without mode switching. -# Example: Bathrooms, closets, hallways -# -# CUSTOMIZATION INSTRUCTIONS: -# 1. Copy and rename for your room -# 2. Replace "simple_room" with your room name -# 3. Update entity IDs -# 4. This template has NO mode cycling (Adaptive only) -# -# For button actions like brightness boost, use the inovelli_button_actions blueprint - -# ============================================================================= -# CONFIGURATION -# ============================================================================= -# No input_select needed - always in Adaptive mode - -# ============================================================================= -# AUTOMATIONS -# ============================================================================= - -automation: - # --------------------------------------------------------------------------- - # Ensure AL is Always Active - # --------------------------------------------------------------------------- - - id: simple_room_ensure_adaptive_lighting - alias: "Simple Room: Ensure Adaptive Lighting Active" - trigger: - - platform: homeassistant - event: start - action: - - service: adaptive_lighting.set_manual_control - data: - entity_id: switch.adaptive_lighting_simple_room # UPDATE THIS - manual_control: false