Compare commits
2 Commits
4f344e7b16
...
602a2b7e78
| Author | SHA1 | Date | |
|---|---|---|---|
| 602a2b7e78 | |||
| 27d322f09f |
@@ -8,7 +8,7 @@
|
|||||||
# Features:
|
# Features:
|
||||||
# - Cycles through available modes in input_select
|
# - Cycles through available modes in input_select
|
||||||
# - Updates LED color to match new mode (ROYGBIV scheme)
|
# - Updates LED color to match new mode (ROYGBIV scheme)
|
||||||
# - Flashes LED to confirm mode change (3-second pulse)
|
# - Flashes LED to confirm mode change (0.5-second pulse)
|
||||||
#
|
#
|
||||||
# Requirements:
|
# Requirements:
|
||||||
# - Inovelli Blue Dimmer (VZM31-SN) paired with Zigbee2MQTT
|
# - Inovelli Blue Dimmer (VZM31-SN) paired with Zigbee2MQTT
|
||||||
@@ -88,9 +88,9 @@ action:
|
|||||||
data:
|
data:
|
||||||
value: "{{ next_color }}"
|
value: "{{ next_color }}"
|
||||||
|
|
||||||
# Flash LED to confirm mode change (3-second pulse)
|
# Flash LED to confirm mode change (0.5-second pulse)
|
||||||
- service: mqtt.publish
|
- service: mqtt.publish
|
||||||
data:
|
data:
|
||||||
topic: "zigbee2mqtt/{{ zigbee2mqtt_device_name }}/set"
|
topic: "zigbee2mqtt/{{ zigbee2mqtt_device_name }}/set"
|
||||||
payload: >-
|
payload: >-
|
||||||
{"led_effect": {"effect": "pulse", "color": {{ next_color }}, "level": 100, "duration": 3}}
|
{"led_effect": {"effect": "pulse", "color": {{ next_color }}, "level": 100, "duration": 0.5}}
|
||||||
|
|||||||
235
packages/adaptive_lighting_bedroom_template.yaml
Normal file
235
packages/adaptive_lighting_bedroom_template.yaml
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
# 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
|
||||||
122
packages/adaptive_lighting_living_room_template.yaml
Normal file
122
packages/adaptive_lighting_living_room_template.yaml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
# 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"
|
||||||
38
packages/adaptive_lighting_simple_template.yaml
Normal file
38
packages/adaptive_lighting_simple_template.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# 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
|
||||||
Reference in New Issue
Block a user