Refactor global package to nested schema
Convert mode definitions from flat to nested JSON schema: - Embed LED colors in mode settings (remove separate color mapping) - Add behavior, manual_control, and led_color to top level - Nest AL settings in al_config object for service validation - Reduce from 11 to 8 essential modes (remove Reading, Homework, Play) Modes now use nested structure to avoid AL service validation errors while maintaining extensibility for different behavior types.
This commit is contained in:
@@ -9,106 +9,76 @@
|
|||||||
# packages: !include_dir_named packages/
|
# packages: !include_dir_named packages/
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# MODE COLOR MAPPINGS (ROYGBIV Scheme)
|
# MODE SETTINGS DEFINITIONS
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# These colors are used for LED feedback on Inovelli switches
|
# Each mode has its own input_text helper with nested JSON schema
|
||||||
# Values are hue (0-255) for Zigbee2MQTT ledColorWhenOn/Off parameter
|
# Schema: {"behavior": "adaptive_lighting"|"scene"|"script",
|
||||||
#
|
# "manual_control": true|false,
|
||||||
# Reference ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md lines 112-131
|
# "led_color": 0-255,
|
||||||
|
# "al_config": {AL settings dict}}
|
||||||
|
# Room automations use convention-based lookup to apply settings
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
input_text:
|
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}
|
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
# MODE SETTINGS DEFINITIONS
|
|
||||||
# =============================================================================
|
|
||||||
# Each mode has its own input_text helper to stay within 255 char limit
|
|
||||||
# Room automations read these to apply appropriate AL settings
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
# Adaptive mode - uses default AL configuration
|
# Adaptive mode - uses default AL configuration
|
||||||
adaptive_lighting_settings_adaptive:
|
adaptive_lighting_settings_adaptive:
|
||||||
name: "AL Settings: Adaptive"
|
name: "AL Settings: Adaptive"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"use_defaults":"configuration"}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":170,"al_config":{"use_defaults":"configuration"}}'
|
||||||
|
|
||||||
# Reading mode - bright, cool white
|
|
||||||
adaptive_lighting_settings_reading:
|
|
||||||
name: "AL Settings: Reading"
|
|
||||||
max: 255
|
|
||||||
initial: '{"min_brightness":80,"max_brightness":100,"min_color_temp":4500,"max_color_temp":5500,"transition":2}'
|
|
||||||
|
|
||||||
# Relaxing mode - dim, warm white
|
# Relaxing mode - dim, warm white
|
||||||
adaptive_lighting_settings_relaxing:
|
adaptive_lighting_settings_relaxing:
|
||||||
name: "AL Settings: Relaxing"
|
name: "AL Settings: Relaxing"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":20,"max_brightness":40,"min_color_temp":2000,"max_color_temp":2500,"transition":5}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":21,"al_config":{"min_brightness":20,"max_brightness":40,"min_color_temp":2000,"max_color_temp":2500,"transition":5}}'
|
||||||
|
|
||||||
# Sleep mode - very dim red/amber
|
# Sleep mode - very dim red/amber
|
||||||
adaptive_lighting_settings_sleep:
|
adaptive_lighting_settings_sleep:
|
||||||
name: "AL Settings: Sleep"
|
name: "AL Settings: Sleep"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":1,"max_brightness":5,"min_color_temp":2000,"sleep_rgb_color":[255,50,0],"transition":2}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":0,"al_config":{"min_brightness":1,"max_brightness":5,"min_color_temp":2000,"sleep_rgb_color":[255,50,0],"transition":2}}'
|
||||||
|
|
||||||
# Theater mode - dim, cool for movies
|
# Theater mode - dim, cool for movies
|
||||||
adaptive_lighting_settings_theater:
|
adaptive_lighting_settings_theater:
|
||||||
name: "AL Settings: Theater"
|
name: "AL Settings: Theater"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":5,"max_brightness":20,"min_color_temp":3000,"max_color_temp":4000,"transition":3}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":127,"al_config":{"min_brightness":5,"max_brightness":20,"min_color_temp":3000,"max_color_temp":4000,"transition":3}}'
|
||||||
|
|
||||||
# Party mode - bright, dynamic for socializing
|
# Party mode - bright, dynamic for socializing
|
||||||
adaptive_lighting_settings_party:
|
adaptive_lighting_settings_party:
|
||||||
name: "AL Settings: Party"
|
name: "AL Settings: Party"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":60,"max_brightness":90,"min_color_temp":3500,"max_color_temp":4500,"transition":1}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":234,"al_config":{"min_brightness":60,"max_brightness":90,"min_color_temp":3500,"max_color_temp":4500,"transition":1}}'
|
||||||
|
|
||||||
# Homework mode - bright, neutral for focus
|
|
||||||
adaptive_lighting_settings_homework:
|
|
||||||
name: "AL Settings: Homework"
|
|
||||||
max: 255
|
|
||||||
initial: '{"min_brightness":85,"max_brightness":100,"min_color_temp":4000,"max_color_temp":5000,"transition":2}'
|
|
||||||
|
|
||||||
# Play mode - medium bright, energizing
|
|
||||||
adaptive_lighting_settings_play:
|
|
||||||
name: "AL Settings: Play"
|
|
||||||
max: 255
|
|
||||||
initial: '{"min_brightness":60,"max_brightness":85,"min_color_temp":4000,"max_color_temp":5000,"transition":2}'
|
|
||||||
|
|
||||||
# Cooking mode - bright, cool task lighting
|
# Cooking mode - bright, cool task lighting
|
||||||
adaptive_lighting_settings_cooking:
|
adaptive_lighting_settings_cooking:
|
||||||
name: "AL Settings: Cooking"
|
name: "AL Settings: Cooking"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":90,"max_brightness":100,"min_color_temp":4500,"max_color_temp":5500,"transition":1}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":42,"al_config":{"min_brightness":90,"max_brightness":100,"min_color_temp":4500,"max_color_temp":5500,"transition":1}}'
|
||||||
|
|
||||||
# Dining mode - medium, warm for meals
|
# Dining mode - medium, warm for meals
|
||||||
adaptive_lighting_settings_dining:
|
adaptive_lighting_settings_dining:
|
||||||
name: "AL Settings: Dining"
|
name: "AL Settings: Dining"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":40,"max_brightness":70,"min_color_temp":2500,"max_color_temp":3500,"transition":3}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":21,"al_config":{"min_brightness":40,"max_brightness":70,"min_color_temp":2500,"max_color_temp":3500,"transition":3}}'
|
||||||
|
|
||||||
# Cleanup mode - bright, standard for cleaning
|
# Cleanup mode - bright, standard for cleaning
|
||||||
adaptive_lighting_settings_cleanup:
|
adaptive_lighting_settings_cleanup:
|
||||||
name: "AL Settings: Cleanup"
|
name: "AL Settings: Cleanup"
|
||||||
max: 255
|
max: 255
|
||||||
initial: '{"min_brightness":80,"max_brightness":100,"min_color_temp":4000,"max_color_temp":5000,"transition":1}'
|
initial: '{"behavior":"adaptive_lighting","manual_control":false,"led_color":170,"al_config":{"min_brightness":80,"max_brightness":100,"min_color_temp":4000,"max_color_temp":5000,"transition":1}}'
|
||||||
|
|
||||||
# Manual Override mode - pauses AL completely (no settings needed)
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# USAGE NOTES
|
# USAGE NOTES
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# To access mode colors in templates:
|
# To access mode settings in blueprints/automations:
|
||||||
# {% set colors = states('input_text.adaptive_lighting_mode_colors') | from_json %}
|
# {% set mode = states('input_select.room_lighting_mode') %}
|
||||||
# {{ colors.get('Reading', 170) }}
|
# {% set settings_entity = 'input_text.adaptive_lighting_settings_' ~ (mode | lower | replace(' ', '_')) %}
|
||||||
|
# {% set settings = states(settings_entity) | from_json %}
|
||||||
|
# {{ settings.behavior }} # "adaptive_lighting", "scene", "script"
|
||||||
|
# {{ settings.manual_control }} # true/false - controls AL manual control state
|
||||||
|
# {{ settings.led_color }} # 0-255 hue value for LED feedback
|
||||||
|
# {{ settings.al_config }} # Dict to pass to adaptive_lighting.change_switch_settings
|
||||||
#
|
#
|
||||||
# To access mode settings in templates:
|
# To add custom modes:
|
||||||
# {% set settings = states('input_text.adaptive_lighting_settings_reading') | from_json %}
|
# See ADDING_MODES.md for complete tutorial
|
||||||
# {{ settings.min_brightness }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user