I’m trying to generate a blueprint for the following (working) automation
- id: '1665578010584'
alias: Light Kitchen
description: ''
trigger:
- platform: state
entity_id:
- switch.light_kitchen_and_dining_area_l1
from: 'off'
to: 'on'
id: light_off-on
- platform: state
entity_id:
- switch.light_kitchen_and_dining_area_l1
from: 'on'
to: 'off'
id: light_on-off
- platform: state
entity_id:
- binary_sensor.motion_kitchen_occupancy
from: 'off'
to: 'on'
id: motion_occupancy_started
- platform: state
entity_id:
- binary_sensor.motion_kitchen_occupancy
from: 'on'
to: 'off'
id: motion_occupancy_stopped
for:
hours: 0
minutes: '{{ (states(''input_number.light_on_time_kitchen'') | int / 60) | round(0,''floor'')
}}'
seconds: '{{ states(''input_number.light_on_time_kitchen'') | int % 60 }}'
condition:
- condition: state
entity_id: input_boolean.disable_all_automations
state: 'off'
action:
- choose:
- conditions:
- condition: trigger
id: light_off-on
- condition: not
conditions:
- condition: state
entity_id: timer.light_kitchen_helper_timer
state: active
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.light_kitchen_manual
- conditions:
- condition: trigger
id: motion_occupancy_started
- condition: state
entity_id: sensor.illumination_low_kitchen
state: 'True'
sequence:
- type: turn_on
device_id: 21903071448080aa0a9993c1aadf35a0
entity_id: switch.light_kitchen_and_dining_area_l1
domain: switch
- service: timer.start
data: {}
target:
entity_id: timer.light_kitchen_helper_timer
- conditions:
- condition: trigger
id: motion_occupancy_stopped
- condition: state
entity_id: input_boolean.light_kitchen_manual
state: 'off'
sequence:
- type: turn_off
device_id: 21903071448080aa0a9993c1aadf35a0
entity_id: switch.light_kitchen_and_dining_area_l1
domain: switch
- conditions:
- condition: trigger
id: light_on-off
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.light_kitchen_manual
mode: single
This is the blueprint I have generated from the automation above
blueprint:
name: Light via Motion or Manual
description: Light operates using a motion sensor or manual via a wall switch. If the light is off it is set to automatic mode. If the light turns on via the motion sensor it stays in automatic mode, whereas the mode changes to manual if the light is turned on using the light switch. To bring the light into manual mode if it is already turned on via the motion sensor, simply turn the light of and back on using the wall switch. If the light is in automatic mode, the motion sensor will turn it off once no motion is detected anymore and the light ON-Time (adjustable in the settings) has passed. If the light is in manual mode it stays on until turned off via the wall switch. The light activation via motion sensor is disabled at day time or if the room it too bright. Daytime is determined by the sun elevation angle which can be adjusted in the settengs. The illuminance threshold is adjustable in the settings as well.
domain: automation
input:
target_light:
name: Light
description: The target light for the automation
selector:
target:
entity:
domain:
- switch
- light
motion_sensor_occupancy:
name: Motion Sensor Occupancy
description: The motion sensor occupancy entity
selector:
entity:
domain: binary_sensor
device_class: motion
illumination_template_sensor:
name: Illumination Sensor
description: A template sensor which returns True if the illumionation is too low or the sun is below the horizont
selector:
entity:
domain: sensor
light_on_duration:
name: Light ON-Time Duration
description: This is an input_number providing the duration in seconds for which the light should stay ON after no motion is detected anymore.
selector:
entity:
automation_kill_switch:
name: Disable All Automation
description: A global kill switch (input_boolean) which disables all automations
selector:
entity:
domain: input_boolean
helper_switch_manual:
name: Helper Auto/Manual
description: An input_boolean which which stored the light operation mode (auto/mmanual)
selector:
entity:
domain: input_boolean
helper_timer:
name: Helper Timer
description: A deticated 2s timer
selector:
entity:
trigger:
- platform: state
entity_id:
- !input target_light
from: 'off'
to: 'on'
id: light_off-on
- platform: state
entity_id:
- !input target_light
from: 'on'
to: 'off'
id: light_on-off
- platform: state
entity_id:
- !input motion_sensor_occupancy
from: 'off'
to: 'on'
id: motion_occupancy_started
- platform: state
entity_id:
- !input motion_sensor_occupancy
from: 'on'
to: 'off'
id: motion_occupancy_stopped
for:
hours: 0
minutes: '{{ (states(''!input light_on_duration'') | int / 60) | round(0,''floor'') }}'
seconds: '{{ states(''!input light_on_duration'') | int % 60 }}'
condition:
- condition: state
entity_id: !input automation_kill_switch
state: 'off'
action:
- choose:
- conditions:
- condition: trigger
id: light_off-on
- condition: not
conditions:
- condition: state
entity_id: !input helper_timer
state: active
sequence:
- service: input_boolean.turn_on
target:
entity_id: !input helper_switch_manual
- conditions:
- condition: trigger
id: motion_occupancy_started
- condition: state
entity_id: !input illumination_template_sensor
state: 'True'
sequence:
- type: turn_on
entity_id: !input target_light
domain: switch
- service: timer.start
target:
entity_id: !input helper_timer
- conditions:
- condition: trigger
id: motion_occupancy_stopped
- condition: state
entity_id: !input helper_switch_manual
state: 'off'
sequence:
- type: turn_off
entity_id: !input target_light
domain: switch
- conditions:
- condition: trigger
id: light_on-off
sequence:
- service: input_boolean.turn_off
target:
entity_id: !input helper_switch_manual
mode: single
The configuration checker doesn’t find any errors and after reloading the automations the blueprint is shown under Settings / Automations & Scenes / Blueprints. If I create a new automation based on that blueprint with the UI, I can see the following new automation in the automations.yaml file.
- id: '1665587875234'
alias: Light Kitchen 2
description: ''
use_blueprint:
path: Markus/light_motion-manual.yaml
input:
motion_sensor_occupancy: binary_sensor.motion_kitchen_occupancy
target_light:
entity_id:
- switch.light_kitchen_and_dining_area_l1
illumination_template_sensor: sensor.illumination_low_kitchen
light_on_duration: input_number.light_on_time_kitchen
automation_kill_switch: input_boolean.disable_all_automations
helper_switch_manual: input_boolean.light_kitchen_manual
helper_timer: timer.light_kitchen_helper_timer
But unfortunately, the automation it is not shown in the UI. Also the automation is not working.
Could somebody please point me in the right direction to find out why the blueprint is not working?