Bonjour,
J’essaye de créer mon propre blueprint pour gérer l’allumage automatique des lumières.
Je me suis inspiré d’autre blueprint mais je manque d’expérience.
J’ai essayé de faire un truc simple mais j’ai une erreur lors de l’exécution du blueprint au niveau des conditions.
blueprint:
name: Automatic light ON
description: ""
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 5
selector:
number:
min: 0
max: 60
unit_of_measurement: minutes
illuminance_sensor:
name: Illuminance sensor
description: This sensor will be used to determine the illumination.
default:
selector:
entity:
domain: sensor
device_class: illuminance
illuminance_cutoff_value:
name: Illuminance cutoff value
description: This input_number will be used to compare to the current illumination
to determine if it is low.
default:
selector:
number:
min: 0
max: 1000
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
variables:
light_entity: !input 'light_target'
illuminance_currently: !input 'illuminance_sensor'
illuminance_cutoff_value: !input 'illuminance_cutoff_value'
trigger:
- platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
condition:
- condition: template
value_template: '{{ state_attr(light_entity, ''brightness'')|int == 0 }}'
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- delay:
minutes: !input 'no_motion_wait'
- service: light.turn_off
target: !input light_target
Lors de l’exécution j’ai cette erreur:
Error: In 'template' condition: AttributeError: 'dict' object has no attribute 'lower'
Et dans step config:
condition: template
value_template: '{{ state_attr(light_entity, ''brightness'')|int == 0 }}'
En enlevant la condition la lumière s’allume bien donc c’est uniquement celle-ci qui pose problème (test si la lampe est déjà allumée).