I have the automation below that works just fine… only the profile line is ignored. I’m trying to set the profile using an input (so I cant change it at different times of day). At the moment the input is simply set to ‘concentrate’. I’ve re-written this 100 different ways but each time the template part is just ignored (it works if you skip the template bit and just type ‘concentrate’ into the automation file). Any help much appreciated.
- id: '1535320640889'
alias: Turn on Conservatory light when there is movement
trigger:
- entity_id: binary_sensor.conservatory_motion_sensor_fibaro
platform: state
to: 'on'
condition:
- below: '201'
condition: numeric_state
entity_id: sensor.conservatory_motion_sensor_fibaro_luminance
action:
- data_template:
entity_id: light.conservatory_lights_group
profile: >
{states.input_select.time_of_day.state}
service: light.turn_on
- data:
entity_id: input_select.last_room_with_motion
option: Conservatory
service: input_select.select_option
These are the built in names from the csv. The code works fine if I type them in place of the template code. I’m open to alternative solutions (such as setting xy_color directly based on inputs).
sometimes it is a bit tricky to get templates with input_selects options. Especially when quotes are involved. Are you positive the state of the input_select matches the syntactical requirements of the profile?
I have limited experience with the profiles, and only use 1:
which (probably) means there should be no quotes around the profile. Can you confirm the input_select doesn’t have quotes either?
btw you have some (lack of) indentations contrary to what seems to be the default. Not sure if it would help, but just to be sure, try:
- alias: Turn on Conservatory light when there is movement
id: 'Turn on Conservatory light when there is movement'
trigger:
platform: state
entity_id: binary_sensor.conservatory_motion_sensor_fibaro
to: 'on'
condition:
condition: numeric_state
entity_id: sensor.conservatory_motion_sensor_fibaro_luminance
below: '201'
action:
- service: light.turn_on
data_template:
entity_id: light.conservatory_lights_group
profile: >
{{states('input_select.time_of_day')}}
- service: input_select.select_option
data:
entity_id: input_select.last_room_with_motion
option: Conservatory
btw 2: I’ve recently rewritten all my state conditions as value_templates, and have positive experience on that regarding readability but also performance. Might be impossible but nonetheless.