Compare commits

..

4 Commits

Author SHA1 Message Date
96ab81f7ae Fix Adaptive mode not restoring lighting conditions
The blueprint was unconditionally overriding use_defaults to 'current',
preventing modes from specifying their own use_defaults value. This caused
Adaptive mode (which uses use_defaults: 'configuration') to keep the current
settings instead of resetting to configuration defaults.

Modified the data template to conditionally add use_defaults: 'current' only
when not already present in al_config, allowing modes like Adaptive to use
their specified value while maintaining backward compatibility.
2025-12-21 18:27:46 -08:00
aeb9d99930 Fix YAML block scalar causing template line-wrapping in blueprints
Replace block scalar (>-) with regular quoted strings for settings_entity
templates. The block scalar was causing Home Assistant to wrap lines in
the middle of the replace() function call, breaking the template parsing.

This fixes:
- LED color not updating in mode cycling automation
- Mode settings not being applied in apply mode automation

The templates now stay on a single line and parse correctly.
2025-12-21 18:10:46 -08:00
6f612787a1 Update Inovelli mode cycling blueprint to use nested schema
Replace reference to deleted adaptive_lighting_mode_colors entity with
convention-based mode settings lookup. The blueprint now extracts led_color
from each mode's nested JSON schema (input_text.adaptive_lighting_settings_{{mode}})
instead of using a separate color mapping entity.

This fixes the error:
"ValueError: Template error: from_json got invalid input 'unknown' when
rendering template '{{ states('input_text.adaptive_lighting_mode_colors') | from_json }}'"
2025-12-21 18:03:52 -08:00
16319e5bc4 Fix blueprint input section structure to nest under blueprint key
Move input definitions from root level to be nested under the blueprint
section. Home Assistant requires input declarations to be under
blueprint.input, not at the root level.

This fixes import errors:
- "Missing input definition for adaptive_lighting_switch, led_color_entity, mode_input_select"
- "Missing input definition for sunrise_time, sunset_time, weekend_mode_boolean, adaptive_lighting_switch, max_brightness"
- "Missing input definition for toggle_time, weekend_mode_boolean"
2025-12-21 17:53:47 -08:00
4 changed files with 82 additions and 79 deletions

View File

@@ -2,8 +2,7 @@ blueprint:
name: Apply Lighting Mode Settings name: Apply Lighting Mode Settings
description: Data-driven mode application using convention-based entity lookup description: Data-driven mode application using convention-based entity lookup
domain: automation domain: automation
input:
input:
mode_input_select: mode_input_select:
name: Mode Input Select name: Mode Input Select
description: Dropdown helper tracking current lighting mode description: Dropdown helper tracking current lighting mode
@@ -41,8 +40,7 @@ variables:
al_switch: !input adaptive_lighting_switch al_switch: !input adaptive_lighting_switch
led_entity: !input led_color_entity led_entity: !input led_color_entity
mode: "{{ states(mode_select) }}" mode: "{{ states(mode_select) }}"
settings_entity: >- settings_entity: "input_text.adaptive_lighting_settings_{{ mode | lower | replace(' ', '_') }}"
input_text.adaptive_lighting_settings_{{ mode | lower | replace(' ', '_') }}
settings: "{{ states(settings_entity) | from_json }}" settings: "{{ states(settings_entity) | from_json }}"
behavior: "{{ settings.behavior | default('adaptive_lighting') }}" behavior: "{{ settings.behavior | default('adaptive_lighting') }}"
manual_control: "{{ settings.manual_control | default(false) }}" manual_control: "{{ settings.manual_control | default(false) }}"
@@ -64,7 +62,12 @@ action:
- service: adaptive_lighting.change_switch_settings - service: adaptive_lighting.change_switch_settings
target: target:
entity_id: "{{ al_switch }}" entity_id: "{{ al_switch }}"
data: "{{ al_config | combine({'use_defaults': 'current'}) }}" data: >
{% if 'use_defaults' not in al_config %}
{{ al_config | combine({'use_defaults': 'current'}) }}
{% else %}
{{ al_config }}
{% endif %}
# Behavior: scene # Behavior: scene
- conditions: "{{ behavior == 'scene' }}" - conditions: "{{ behavior == 'scene' }}"

View File

@@ -13,7 +13,8 @@
# Requirements: # Requirements:
# - Inovelli Blue Dimmer (VZM31-SN) paired with Zigbee2MQTT # - Inovelli Blue Dimmer (VZM31-SN) paired with Zigbee2MQTT
# - input_select helper with available modes # - input_select helper with available modes
# - packages/adaptive_lighting_global.yaml for mode colors # - Mode settings entities following convention: input_text.adaptive_lighting_settings_{{mode}}
# - Each mode must have led_color field in nested JSON schema
# #
# Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 144-182 # Reference: ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 144-182
@@ -71,8 +72,9 @@ action:
current_index: "{{ available_modes.index(current_mode) }}" current_index: "{{ available_modes.index(current_mode) }}"
next_index: "{{ (current_index + 1) % (available_modes | length) }}" next_index: "{{ (current_index + 1) % (available_modes | length) }}"
next_mode: "{{ available_modes[next_index] }}" next_mode: "{{ available_modes[next_index] }}"
mode_colors: "{{ states('input_text.adaptive_lighting_mode_colors') | from_json }}" next_mode_settings_entity: "input_text.adaptive_lighting_settings_{{ next_mode | lower | replace(' ', '_') }}"
next_color: "{{ mode_colors.get(next_mode, 170) }}" next_mode_settings: "{{ states(next_mode_settings_entity) | from_json }}"
next_color: "{{ next_mode_settings.led_color | default(170) }}"
# Change to next mode # Change to next mode
- service: input_select.select_option - service: input_select.select_option

View File

@@ -2,8 +2,7 @@ blueprint:
name: Weekend Mode Apply Settings name: Weekend Mode Apply Settings
description: Adjust AL settings when weekend mode toggles description: Adjust AL settings when weekend mode toggles
domain: automation domain: automation
input:
input:
weekend_mode_boolean: weekend_mode_boolean:
name: Weekend Mode Boolean name: Weekend Mode Boolean
description: Toggle helper for weekend mode description: Toggle helper for weekend mode

View File

@@ -2,8 +2,7 @@ blueprint:
name: Weekend Mode Schedule name: Weekend Mode Schedule
description: Auto-enable/disable weekend mode based on day of week description: Auto-enable/disable weekend mode based on day of week
domain: automation domain: automation
input:
input:
weekend_mode_boolean: weekend_mode_boolean:
name: Weekend Mode Boolean name: Weekend Mode Boolean
description: Toggle helper for weekend mode description: Toggle helper for weekend mode