Template no longer selecting

Hi all,

Run into a weird problem where a little template I have had running has been working perfectly fine for ages, now all of a sudden it doesn’t.

I had this in the action portion of my automation:

selectattr('attributes.friendly_name', 'eq', states('input_select.select_game '))

but now it just returns UndefinedError: list object has no element 0

If I change it to the below:

{{ states.sensor | selectattr('attributes.friendly_name', 'defined') | selectattr('attributes.friendly_name', 'eq', 'Clank! Legacy: Acquisitions Incorporated') | map(attribute='entity_id') | first }}

I get the expected result: sensor.boardgame_04_a1_59_1c_70_00_00

However, if I then change it to be dynamic and use the state of the select list like so:

{{ states.sensor | selectattr('attributes.friendly_name', 'defined') | selectattr('attributes.friendly_name', 'eq', states('input_select.select_game')) | map(attribute='entity_id') | first }}

I get UndefinedError: No first item, sequence was empty.

Any ideas how to get this working would be really appreciated.

Obvious question, but what is the state of input_select.select_game?
If it’s not “Clank! Legacy: Acquisitions Incorporated”, then your tests are not equivalent.

Furthermore, your first example uses input_text.board_game_selected_game.

Sorry updated, was trying to see if I get the same result using an input text and I do.

Yes the input_select state matches that, can see it in the dev tools and if I do {{ states('input_select.select_game')}} I get that coming out.