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"
92 lines
2.7 KiB
YAML
92 lines
2.7 KiB
YAML
blueprint:
|
|
name: Apply Lighting Mode Settings
|
|
description: Data-driven mode application using convention-based entity lookup
|
|
domain: automation
|
|
input:
|
|
mode_input_select:
|
|
name: Mode Input Select
|
|
description: Dropdown helper tracking current lighting mode
|
|
selector:
|
|
entity:
|
|
domain: input_select
|
|
|
|
adaptive_lighting_switch:
|
|
name: Adaptive Lighting Switch
|
|
description: AL switch for this room
|
|
selector:
|
|
entity:
|
|
domain: switch
|
|
integration: adaptive_lighting
|
|
|
|
led_color_entity:
|
|
name: LED Color Entity (Optional)
|
|
description: Number entity for LED color (e.g., Inovelli switch)
|
|
default: {}
|
|
selector:
|
|
entity:
|
|
domain: number
|
|
|
|
mode: restart
|
|
max_exceeded: silent
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: !input mode_input_select
|
|
- platform: homeassistant
|
|
event: start
|
|
|
|
variables:
|
|
mode_select: !input mode_input_select
|
|
al_switch: !input adaptive_lighting_switch
|
|
led_entity: !input led_color_entity
|
|
mode: "{{ states(mode_select) }}"
|
|
settings_entity: >-
|
|
input_text.adaptive_lighting_settings_{{ mode | lower | replace(' ', '_') }}
|
|
settings: "{{ states(settings_entity) | from_json }}"
|
|
behavior: "{{ settings.behavior | default('adaptive_lighting') }}"
|
|
manual_control: "{{ settings.manual_control | default(false) }}"
|
|
al_config: "{{ settings.al_config | default({}) }}"
|
|
led_color: "{{ settings.led_color | default(170) }}"
|
|
|
|
action:
|
|
# Always set manual_control state based on mode settings
|
|
- service: adaptive_lighting.set_manual_control
|
|
data:
|
|
entity_id: "{{ al_switch }}"
|
|
manual_control: "{{ manual_control }}"
|
|
|
|
# Execute behavior-specific actions
|
|
- choose:
|
|
# Behavior: adaptive_lighting
|
|
- conditions: "{{ behavior == 'adaptive_lighting' }}"
|
|
sequence:
|
|
- service: adaptive_lighting.change_switch_settings
|
|
target:
|
|
entity_id: "{{ al_switch }}"
|
|
data: "{{ al_config | combine({'use_defaults': 'current'}) }}"
|
|
|
|
# Behavior: scene
|
|
- conditions: "{{ behavior == 'scene' }}"
|
|
sequence:
|
|
- service: scene.turn_on
|
|
target:
|
|
entity_id: "{{ settings.scene_entity }}"
|
|
|
|
# Behavior: script
|
|
- conditions: "{{ behavior == 'script' }}"
|
|
sequence:
|
|
- service: script.turn_on
|
|
target:
|
|
entity_id: "{{ settings.script_entity }}"
|
|
|
|
# Update LED color if entity provided
|
|
- if:
|
|
- condition: template
|
|
value_template: "{{ led_entity not in [none, {}, ''] }}"
|
|
then:
|
|
- service: number.set_value
|
|
target:
|
|
entity_id: "{{ led_entity }}"
|
|
data:
|
|
value: "{{ led_color }}"
|