Hallo an das Forum,
ich hänge an folgendem Thema. Ich möchte eine Lampe mittels eines Bewegungsmelders einschalten, wenn eine bestimmte Lichtschwelle unterschritten ist. Ich möchte diese Lampe 10 Sekunden bevor sie ausgeschaltet wird auf 10% dimmen.
Dazu hab ich denn Blueprint motion-activated light angepasst. Leider wird der angepasste Blueprint scheinbar nicht als Code erkannt. Ich habe versucht den Fehler mit der KI zu finden. Leider ist mir das nicht gelungen.. Hier mein Code:
blueprint:
name: Motion-activated Light with Illuminance Condition and Dim Before Off
description: >
Turn on a light when motion is detected and illuminance is below a threshold.
Dim the light 10 seconds before turning off.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
filter:
- device_class: occupancy
domain: binary_sensor
- device_class: motion
domain: binary_sensor
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time (in seconds) to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 10
max: 3600
unit_of_measurement: seconds
illuminance_entity:
name: Illuminance Sensor
description: Sensor for measuring light level (lux).
selector:
entity:
domain: sensor
illuminance_threshold:
name: Illuminance Threshold (Lux)
description: Light only turns on when illuminance is below this value.
default: 50
selector:
number:
min: 0
max: 1000
unit_of_measurement: lx
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
condition:
- condition: numeric_state
entity_id: !input illuminance_entity
below: !input illuminance_threshold
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_target
data:
brightness_pct: 100
- alias: "Wait until there is no motion"
wait_for_trigger:
- platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait before dimming"
delay:
seconds: "{{ (int(no_motion_wait) - 10) | max(0) }}"
- alias: "Dim light to 10%"
service: light.turn_on
target: !input light_target
data:
brightness_pct: 10
- alias: "Wait 10 seconds"
delay:
seconds: 10
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
Mir ist nicht klar, wo der Fehler sein könnte. Für Hilfestellung wäre ich dankbar.
Grüße Sven