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.
This commit is contained in:
2025-12-21 18:10:46 -08:00
parent 6f612787a1
commit aeb9d99930
2 changed files with 2 additions and 4 deletions

View File

@@ -40,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) }}"

View File

@@ -72,8 +72,7 @@ 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] }}"
next_mode_settings_entity: >- next_mode_settings_entity: "input_text.adaptive_lighting_settings_{{ next_mode | lower | replace(' ', '_') }}"
input_text.adaptive_lighting_settings_{{ next_mode | lower | replace(' ', '_') }}
next_mode_settings: "{{ states(next_mode_settings_entity) | from_json }}" next_mode_settings: "{{ states(next_mode_settings_entity) | from_json }}"
next_color: "{{ next_mode_settings.led_color | default(170) }}" next_color: "{{ next_mode_settings.led_color | default(170) }}"