Hi,
now that I’m finally rolling out home assistant in my flat, i wanted to create a BP on my own for my room lighting to learn how to use BPs properly.
But HA throws this error:
BP automation failed to set up.
Error:Invalid blueprint: Missing input definition for .
Below is what I currently have. What am I doing wrong here? AI models are not much of a help.
#####################################################################
# Blueprint: Motion-based lighting with sun, time and lux
# Author: HrHauptfeld
# Version: 2025.10.18
# Description: Motion-based automation for lights with customizable
# colors, brightness and illuminance control
#####################################################################
blueprint:
name: "Motion-based Lighting Automation with sun, time and lux"
description: |
# ⭐ Motion-based Lighting Automation ⭐
Turn lights on/off based on motion, time, sun position, and illuminance.
Fully customizable colors and brightness for different periods of the day.
**Version:** 2025.10.18
**Help:** [Home Assistant Community](https://community.home-assistant.io/)
<details>
<summary><strong>Features Overview</strong></summary>
✅ Motion sensor triggers for automatic lighting
✅ Day, Late Day, and Night color and brightness customization
✅ Optional illuminance-based control
✅ Structured UI with collapsible feature sections
✅ Flexible timing: choose fixed times or sun state
</details>
domain: automation
input:
motion_sensor:
name: "Motion sensor"
description: "Select the motion sensor that triggers the lights."
selector:
entity:
domain: binary_sensor
light_target:
name: "Target light"
selector:
target:
entity:
domain: light
#########################################################
# Motion & Light Control (Feature Section)
#########################################################
feature_section:
name: "⚙️ Motion & Light Control"
icon: mdi:motion-sensor
collapsed: true
description: |
<details>
<summary><strong>How Motion & Light Control Works</strong></summary>
- When motion is detected, the lights turn on immediately.
- After motion stops, lights turn off after the specified delay.
- Use high-quality motion sensors to prevent false triggers.
- Combine multiple sensors with groups if needed.
- Ensure the lights you select support brightness and color if you plan to customize them.
</details>
input:
motion_off_delay:
name: "Motion off delay"
description: "Delay before turning off lights after no motion."
default:
minutes: 2
seconds: 2
selector:
duration: {}
#########################################################
# Sun & Time Settings (Feature Section)
#########################################################
sunTime_section:
name: "☀️ Sun & Time Settings"
icon: mdi:weather-sunset
collapsed: true
description: |
<details>
<summary><strong>Sun & Time Settings Guidance</strong></summary>
- The day period defines when your "Daytime" color/brightness applies.
- Night is applied after sunset.
- Adjust these times to match your lifestyle or geographic location.
</details>
input:
time_mode:
name: "Time mode"
description: "Choose whether to use fixed times or sun entity for day/night separation."
default: sun
selector:
select:
options:
- label: "Fixed times"
value: fixed
- label: "Sun entity"
value: sun
day_start:
name: "Day start time"
description: "ONLY works when 'Fixed times' are selected"
default: "08:42:21"
selector:
time: {}
day_end:
name: "Day end time"
description: "Always works (for evening lights)"
default: "16:21:16"
selector:
time: {}
#########################################################
# Illuminance Control (Feature Section)
#########################################################
illuminance_section:
name: "💡 Illuminance Control (optional)"
icon: mdi:brightness-6
collapsed: true
description: |
<details>
<summary><strong>Illuminance Control Guidance</strong></summary>
- Lights will only turn on if the measured illuminance is below this threshold.
- Leave the sensor empty if you want lights to always respond to motion.
</details>
input:
illuminance_sensor:
name: "Illuminance sensor (optional)"
description: "Optional sensor to prevent unnecessary lighting."
default: []
selector:
entity:
domain: sensor
device_class: illuminance
illuminance_threshold:
name: "Illuminance threshold"
description: "ONLY works with a light sensor selected (duh!)"
default: 1221
selector:
number:
min: 0
max: 5000
unit_of_measurement: lx
mode: box
#########################################################
# Color & Brightness Customization (Feature Section)
#########################################################
color_section:
name: "🎨 Light Colors & Brightness"
icon: mdi:lightbulb
collapsed: true
description: |
<details>
<summary><strong>Color & Brightness Guidance</strong></summary>
- Day, Late Day, and Night periods each have configurable colors and brightness.
- Use soft colors at night to reduce glare and preserve circadian rhythm.
- Bright whites are ideal for daytime work areas.
- Adjust sliders to suit your preference or room type.
</details>
input:
day_color:
name: "Daytime color"
description: "RGB color for daytime lighting."
default: [255, 244, 229]
selector:
color_rgb: {}
day_brightness:
name: "Daytime brightness"
description: "Brightness percentage for daytime lighting."
default: 77
selector:
number:
min: 1
max: 100
unit_of_measurement: "%"
mode: slider
late_color:
name: "Evening color"
description: "RGB color for evening lighting."
default: [8, 169, 232]
selector:
color_rgb: {}
late_brightness:
name: "Evening brightness"
description: "Brightness percentage for evening lighting."
default: 88
selector:
number:
min: 1
max: 100
unit_of_measurement: "%"
mode: slider
night_color:
name: "Nighttime color"
description: "RGB color for night lighting."
default: [255, 0, 0]
selector:
color_rgb: {}
night_brightness:
name: "Nighttime brightness"
description: "Brightness percentage for night lighting."
default: 42
selector:
number:
min: 1
max: 100
unit_of_measurement: "%"
mode: slider
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input motion_sensor
to: "on"
- platform: state
entity_id: !input motion_sensor
to: "off"
for: !input motion_off_delay
condition: []
action:
- choose:
# --- Motion detected ---
- conditions:
- condition: state
entity_id: !input motion_sensor
state: "on"
sequence:
- choose:
# --- Daytime (fixed times) ---
- conditions:
- condition: template
value_template: >
{{ input('time_mode') == 'fixed' }}
- condition: time
after: !input day_start
before: !input day_end
sequence:
- choose:
- conditions:
- condition: template
value_template: >
{{ (input('illuminance_sensor') != none)
and (states(input('illuminance_sensor'))|int(99999) <= input('illuminance_threshold')|int)
or (input('illuminance_sensor') == none) }}
sequence:
- service: light.turn_on
target: !input light_target
- delay: "00:00:01"
- service: light.turn_on
target: !input light_target
data:
transition: 1
rgb_color: !input day_color
brightness_pct: !input day_brightness
- service: logbook.log
data:
name: "Motion Lighting"
message: "Day branch triggered"
# --- Daytime (sun above horizon) ---
- conditions:
- condition: template
value_template: >
{{ input('time_mode') == 'sun' }}
- condition: state
entity_id: sun.sun
state: "above_horizon"
sequence:
- choose:
- conditions:
- condition: template
value_template: >
{{ (input('illuminance_sensor') != none)
and (states(input('illuminance_sensor'))|int(99999) <= input('illuminance_threshold')|int)
or (input('illuminance_sensor') == none) }}
sequence:
- service: light.turn_on
target: !input light_target
- delay: "00:00:01"
- service: light.turn_on
target: !input light_target
data:
transition: 1
rgb_color: !input day_color
brightness_pct: !input day_brightness
- service: logbook.log
data:
name: "Motion Lighting"
message: "Day branch triggered"
# --- Evening (after day_end until sunset) ---
- conditions:
- condition: template
value_template: >
{{ input('time_mode') == 'fixed' }}
- condition: time
after: !input day_end
- condition: state
entity_id: sun.sun
state: "above_horizon"
sequence:
- service: light.turn_on
target: !input light_target
- delay: "00:00:01"
- service: light.turn_on
target: !input light_target
data:
transition: 1
rgb_color: !input late_color
brightness_pct: !input late_brightness
- service: logbook.log
data:
name: "Motion Lighting"
message: "Late Day branch triggered"
# --- Nighttime (sun below horizon) ---
- conditions:
- condition: state
entity_id: sun.sun
state: "below_horizon"
sequence:
- service: light.turn_on
target: !input light_target
- delay: "00:00:01"
- service: light.turn_on
target: !input light_target
data:
transition: 1
rgb_color: !input night_color
brightness_pct: !input night_brightness
- service: logbook.log
data:
name: "Motion Lighting"
message: "Night branch triggered"
# --- Motion cleared (turn lights off after delay) ---
- conditions:
- condition: state
entity_id: !input motion_sensor
state: "off"
sequence:
- service: light.turn_off
target: !input
