Hi,
My first time posting here, been struggling for literal hours with this one.
I’m trying to set up a template select with dynamic name changes. Got all of that to work, only problem is getting the state to actually change. It seems perpetually stuck between either unknown or unavailable.
The code in my automation to test the state change
action:
- service: select.select_option
data:
entity_id: select.yamaha_a8a_scene_selector_template
option: >
{% set options = state_attr('select.yamaha_a8a_scene_selector_template', 'options') %}
{% for option in options %}
{% if '7' in option %}
{{ option }}
{% break %}
{% endif %}
{% endfor %}
Produces the error: Error running action
Option 7 - PC Viewing - 0 7 is not valid for entity select.yamaha_a8a_scene_selector_template, valid options are: 1 - Movie Viewing - 0 1 , 2 - Full Stereo Listening - 0 2 , 3 - NET Radio Listening - 0 3 , 4 - Radio Listening - 0 4 , 5 - Analog Audio Listening - 0 5 , 6 - Game Playing - 0 6 , 7 - PC Viewing - 0 7 , 8 - AV Viewing - 0 8
However, pasting the exact same code in the developer tools template editor produces the desired result:
7 - PC Viewing - 0 7
Essentially, it seems like the code for some reason is being interpreted as having the word option appended to the dynamic name change, even though to my knowledge I don’t have any such word coming out of the template select, or the template sensor from which the template select derives its options and names for said options. But developer tools clearly shows the code being interpreted correctly.
The template select was created in the GUI, so I don’t know how to copy the code for that over to the forum.
Logs show the same error when trying to execute the automation, but nothing beyond what’s already shown.
Am I doing something wrong, did I miss something, or did I discover a bug?
Thank you very much in advance, really appreciate it!