Input_select.select_option template

Hi all,

I have an input_select with the options: None, TV, Music and Lights

I have a picture-elements image and I want the tap_action to change the input_select.

If the input_select is already ‘TV’ I want it to change to ‘None’, else, change it to TV.

This is what I have, but I’m getting the error:
Failed to call service input_select/select_option. required key not provided @ data ['option']

This is what I have so far in my ui-lovelace.yaml:

        tap_action:
          action: call-service
          service: input_select.select_option
          service_template:
            entity_id: input_select.living_room_item_selection
            option: >
              {% if is_state ('input_select.living_room_item_selection', 'TV') %} 
                None
              {% else %} 
                TV
              {% endif %}

This is giving me the above error. Any suggestions?

service_template should be data_template.

I’ve tried that too and unfortunately get the same error. Also tried moving entity_id to outside of the template, and changed the ‘None’ option to something else

Oh, sorry, I haven’t played with Lovelace much and skipped right past the fact that this is Lovelace configuration, not an automation or script. So I think service_template should actually be service_data. Next, I don’t think it accepts templates (although I might be wrong about that.) If it doesn’t, then you may need to write a script to do the “dirty work” and just call the script from the tap_action.

Yes sorry, I didn’t make that very clear (have edited now).
I think you may be right about it not accepting templates, I’ll go for a script instead.
Thanks for your help