From ea426e56ef8afc9cb5c76f178361d839b794dca5 Mon Sep 17 00:00:00 2001 From: John Ogle Date: Sat, 20 Dec 2025 14:38:21 -0800 Subject: [PATCH] Fix input_text max length constraint for mode colors - Add max: 255 parameter to adaptive_lighting_mode_colors input_text - Minify JSON to fit within Home Assistant's 100 character default limit - Remove adaptive_lighting_mode_settings input_text (too long, convert to comments) - Remove get_mode_settings script (no longer needed) - Fix template syntax: use states() instead of state_attr() for input_text values - Convert mode settings to reference documentation comments This fixes the 'Initial value length not in range 0-100' error from Home Assistant. --- .../automation/inovelli_mode_cycling.yaml | 2 +- packages/adaptive_lighting_global.yaml | 145 +++--------------- 2 files changed, 22 insertions(+), 125 deletions(-) diff --git a/blueprints/automation/inovelli_mode_cycling.yaml b/blueprints/automation/inovelli_mode_cycling.yaml index a5a270e..b5432ee 100644 --- a/blueprints/automation/inovelli_mode_cycling.yaml +++ b/blueprints/automation/inovelli_mode_cycling.yaml @@ -67,7 +67,7 @@ action: current_index: "{{ available_modes.index(current_mode) }}" next_index: "{{ (current_index + 1) % (available_modes | length) }}" next_mode: "{{ available_modes[next_index] }}" - mode_colors: "{{ state_attr('input_text.adaptive_lighting_mode_colors', 'state') | from_json }}" + mode_colors: "{{ states('input_text.adaptive_lighting_mode_colors') | from_json }}" next_color: "{{ mode_colors.get(next_mode, 170) }}" # Change to next mode diff --git a/packages/adaptive_lighting_global.yaml b/packages/adaptive_lighting_global.yaml index e72cf5f..984e6dd 100644 --- a/packages/adaptive_lighting_global.yaml +++ b/packages/adaptive_lighting_global.yaml @@ -20,120 +20,32 @@ input_text: adaptive_lighting_mode_colors: name: "AL Mode Color Mappings (JSON)" + max: 255 + # JSON minified to fit in 255 char limit initial: >- - { - "Adaptive": 170, - "Reading": 42, - "Relaxing": 21, - "Sleep": 0, - "Manual Override": 212, - "Theater": 127, - "Party": 234, - "Homework": 85, - "Play": 148, - "Cooking": 42, - "Dining": 21, - "Cleanup": 170 - } + {"Adaptive":170,"Reading":42,"Relaxing":21,"Sleep":0, + "Manual Override":212,"Theater":127,"Party":234,"Homework":85, + "Play":148,"Cooking":42,"Dining":21,"Cleanup":170} # ============================================================================= -# MODE SETTINGS DEFINITIONS +# MODE SETTINGS REFERENCE # ============================================================================= -# Standard settings for each mode -# Used as reference when creating mode application automations +# Standard settings for each mode are documented below +# These are NOT stored as entities - they are hardcoded in each room's automation +# +# Adaptive: Standard AL following sun (use_defaults: configuration) +# Reading: min_brightness 80, max_brightness 100, min_color_temp 4500, max_color_temp 5500 +# Relaxing: min_brightness 20, max_brightness 40, min_color_temp 2000, max_color_temp 2500 +# Sleep: min_brightness 1, max_brightness 5, min_color_temp 2000, sleep_rgb_color [255,50,0] +# Theater: min_brightness 5, max_brightness 20, min_color_temp 3000, max_color_temp 4000 +# Party: min_brightness 60, max_brightness 90, min_color_temp 3500, max_color_temp 4500 +# Homework: min_brightness 85, max_brightness 100, min_color_temp 4000, max_color_temp 5000 +# Play: min_brightness 60, max_brightness 85, min_color_temp 4000, max_color_temp 5000 +# Cooking: min_brightness 90, max_brightness 100, min_color_temp 4500, max_color_temp 5500 +# Dining: min_brightness 40, max_brightness 70, min_color_temp 2500, max_color_temp 3500 +# Cleanup: min_brightness 80, max_brightness 100, min_color_temp 4000, max_color_temp 5000 # ============================================================================= - adaptive_lighting_mode_settings: - name: "AL Mode Settings Reference (JSON)" - initial: >- - { - "Adaptive": { - "description": "Standard AL following sun", - "use_defaults": "configuration" - }, - "Reading": { - "description": "Bright, cool white", - "min_brightness": 80, - "max_brightness": 100, - "min_color_temp": 4500, - "max_color_temp": 5500, - "transition": 2 - }, - "Relaxing": { - "description": "Dim, warm white", - "min_brightness": 20, - "max_brightness": 40, - "min_color_temp": 2000, - "max_color_temp": 2500, - "transition": 5 - }, - "Sleep": { - "description": "Very dim red/amber", - "min_brightness": 1, - "max_brightness": 5, - "min_color_temp": 2000, - "max_color_temp": 2000, - "sleep_rgb_color": [255, 50, 0], - "transition": 2 - }, - "Theater": { - "description": "Dim, cool for movies", - "min_brightness": 5, - "max_brightness": 20, - "min_color_temp": 3000, - "max_color_temp": 4000, - "transition": 3 - }, - "Party": { - "description": "Bright, dynamic for socializing", - "min_brightness": 60, - "max_brightness": 90, - "min_color_temp": 3500, - "max_color_temp": 4500, - "transition": 1 - }, - "Homework": { - "description": "Bright, neutral for focus", - "min_brightness": 85, - "max_brightness": 100, - "min_color_temp": 4000, - "max_color_temp": 5000, - "transition": 2 - }, - "Play": { - "description": "Medium bright, energizing", - "min_brightness": 60, - "max_brightness": 85, - "min_color_temp": 4000, - "max_color_temp": 5000, - "transition": 2 - }, - "Cooking": { - "description": "Bright, cool task lighting", - "min_brightness": 90, - "max_brightness": 100, - "min_color_temp": 4500, - "max_color_temp": 5500, - "transition": 1 - }, - "Dining": { - "description": "Medium, warm for meals", - "min_brightness": 40, - "max_brightness": 70, - "min_color_temp": 2500, - "max_color_temp": 3500, - "transition": 3 - }, - "Cleanup": { - "description": "Bright, standard for cleaning", - "min_brightness": 80, - "max_brightness": 100, - "min_color_temp": 4000, - "max_color_temp": 5000, - "transition": 1 - } - } - # ============================================================================= # HELPER SCRIPTS # ============================================================================= @@ -151,20 +63,5 @@ script: response_variable: "color" response: color: >- - {% set colors = state_attr('input_text.adaptive_lighting_mode_colors', 'state') | from_json %} + {% set colors = states('input_text.adaptive_lighting_mode_colors') | from_json %} {{ colors.get(mode, 170) }} - - get_mode_settings: - alias: "Get AL Settings for Mode" - description: "Returns the AL settings dictionary for a given mode" - fields: - mode: - description: "Mode name" - example: "Reading" - sequence: - - stop: "Settings retrieved" - response_variable: "settings" - response: - settings: >- - {% set all_settings = state_attr('input_text.adaptive_lighting_mode_settings', 'state') | from_json %} - {{ all_settings.get(mode, {}) }}