I’m using the built in Motion Detection blueprint and trying to use an alternative light group depending on sun elevation.
I’ve already successfully set it up to vary the timer based on sun elevation, like so
- id: "1610642684966"
alias: Kitchen Motion Activated Lights
description: ""
use_blueprint:
path: homeassistant/motion_light.yaml
input:
no_motion_wait: '{{ ''60'' if state_attr("sun.sun", "elevation") < 3.5 else ''600'' }}'
motion_entity: binary_sensor.kitchen_motion_sensor_occupancy
light_target:
entity_id: light.kitchen_and_conservatory_lights
However, when I use the same technique to try and achieve the same for entity_id
, I get the error
2021-01-22 18:07:32 ERROR (MainThread) [homeassistant.components.automation] Blueprint Motion-activated Light generated invalid automation with inputs OrderedDict([('no_motion_wait', '{{ \'60\' if state_attr("sun.sun", "elevation") < 3.5 else \'600\' }}'), ('motion_entity', 'binary_sensor.kitchen_motion_sensor_occupancy'), ('light_target', OrderedDict([('entity_id', '{{ \'light.kitchen_and_conservatory_lights\' if state_attr("sun.sun", "elevation") < 3.5 else \'light.kitchen_and_conservatory_lights\' }}')]))]): not a valid value for dictionary value @ data['action'][0]['target']['entity_id']. Got None
Here’s what I’m trying
- id: "1610642684966"
alias: Kitchen Motion Activated Lights
description: ""
use_blueprint:
path: homeassistant/motion_light.yaml
input:
no_motion_wait: '{{ ''60'' if state_attr("sun.sun", "elevation") < 3.5 else ''600'' }}'
motion_entity: binary_sensor.kitchen_motion_sensor_occupancy
light_target:
entity_id: '{{ ''light.kitchen_lights'' if state_attr("sun.sun", "elevation") < 3.5 else ''light.kitchen_and_conservatory_lights'' }}'
Is it just that the template isn’t being evalutated for entity_id? Or have I made a more fundamental error?