In my case is not possible to use the automation.
When I save the automation the code is set in automation.yaml but the automation is not in the list of the automations.
I tried to import using the import function of HA. Now I am getting this error:
Blueprint Motion-activated Switch and or Light with Elevation generated invalid automation with inputs OrderedDict([('motion_entity', 'binary_sensor.presence_78'), ('light_target', OrderedDict([('entity_id', 'light.flur_eg')]))]): expected a dictionary for dictionary value @ data['action'][0]['target']. Got None
How do I get rid of this message?
I had the same issue as people mention above but figured it was probably due to not using and configuring the switch. I removed the switch section and the switch actions and now the automation appears.
The blueprint now looks as follows:
blueprint:
name: Motion-activated Switch and or Light with Elevation
domain: automation
source_url: https://community.home-assistant.io/t/motion-activate-light-or-switch-based-on-daylight-sun-elevation/265010
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
default: ''
no_motion_wait:
name: Wait time
description: Time to wait until the light should be turned off.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
step: 1.0
mode: slider
below_elevation:
name: Below sun elevation
description: Solar elevation. This is the angle between the sun and the horizon.
Negative values mean the sun is below the horizon.
default: 3
selector:
number:
min: -90.0
max: 90.0
unit_of_measurement: degrees
step: 1.0
mode: slider
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'off'
to: 'on'
variables:
below_elevation: !input 'below_elevation'
condition:
- '{{ state_attr(''sun.sun'',''elevation'') <= (below_elevation | float)}}'
action:
- wait_for_trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'on'
to: 'off'
- delay: !input 'no_motion_wait'
- service: light.turn_on
target: !input 'light_target'
- wait_for_trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'on'
to: 'off'
- delay: !input 'no_motion_wait'
- service: light.turn_off
target: !input 'light_target'
Thanks for the nice Elevation setup, but unfortuanally the actions did not work. So I spend some time fixing them. And maybe for some who still looking for Elevation + Motion + Timer. For the newer ones like me you can paste these in the Blueprint folder with the Home Assistant editor.
My final working result is:
blueprint:
name: Motion-activated Switch and or Light with Elevation
domain: automation
source_url: https://community.home-assistant.io/t/motion-activate-light-or-switch-based-on-daylight-sun-elevation/265010
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
multiple: false
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: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
below_elevation:
name: Below sun elevation
description: Solar elevation. This is the angle between the sun and the horizon.
Negative values mean the sun is below the horizon.
default: 1
selector:
number:
min: -90.0
max: 90.0
unit_of_measurement: degrees
step: 1.0
mode: slider
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: 'off'
to: 'on'
variables:
below_elevation: !input below_elevation
condition:
- '{{ state_attr(''sun.sun'',''elevation'') <= (below_elevation | float)}}'
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- delay: !input no_motion_wait
- service: light.turn_off
target: !input light_target
Guys has this been solved yet. I use save this blueprint but does not show up under my automation list however it shows in my automation.ymal file.
Thanks
Yes it does show up in my Blueprints BUT when I have finished creating the Automation and I click save, the automation does not appear in my where all my Automations are ? That automation is missing ?
Mmmmhhh I just deleted mine for testing and it worked normal. But is it still working? And there should be a add to your automations file too. (Code below) Or have you tried that with a other working Blueprint from the Home Assistant forum? Maybe theres a error in your confinguration.
id: '1659296007324'
alias: Motion-activated Switch and or Light with Elevation
description: ''
use_blueprint:
path: homeassistant/Lichtautomatik_Flur.yaml
input:
motion_entity: binary_sensor.0x00158d0008367c92_occupancy
light_target:
entity_id: light.licht_flur
no_motion_wait: 5
below_elevation: 5
When you paste the File dont forget the ending of the file â.yamlâ
Hey Iâd love to use this, itâs perfect for my usecase.
However, as others have mentioned â thereâs something thatâs preventing this automation from being created. Iâve gone through the config steps, and when I hit save it simply doesnât save or show up in my automations list.
I tried deleting and reinstalling the blueprint, no dice. Other blueprints save & work as expected.
Lmk if I can share anything to help debug.
Edit: after some digging and testing on my end, afaik the script as originally posted is simply broken due to the switch functionality.
I updated the blueprint that OP posted in a follow-up comment (requires HA file editor, and a basic knowledge of messing around with your core .yaml files), and that seemed to work with the notable change that it no longer includes âswitch,â just âlightâ with the sun functionality.
For my situation with a smartplug I was hoping for switch, I ultimately just updated the smartplug switch entity to light and proceedes to setup the automation in my UI. It finally showed up in my automations list, yay.