Input_select.set_options doesnt work

Hi everybody,

Neeeded some help. I search many days ago and read many many topic about this but it’s doesn’t work and i don’t find where is ma fault

I try purely based on this

input_select:
  who_cooks:
    name: Who cooks today
    options:
      - Select
      - Paulus
      - Anne Therese
    initial: Select
    icon: mdi:panda
  living_room_preset:
    options:
      - Visitors
      - Visitors with kids
      - Home Alone

automation:
  - alias: change select
    trigger:
      platform: state
      entity_id: input_select.who_cooks
    action:
      service: input_select.set_options
      data:
        entity_id: input_select.living_room_preset
        options: >
          {% if trigger.to_state.state == 'Paulus' %}
            ["Item A", "Item B", "Item C"]
          {% elif trigger.to_state.state == 'radio' %}
            ["19", "20", "21"]
          {% endif %}

But look the bug

Where is ma bug please ?

Your template returns a string not a list.

I believe template typing was included in the latest release, but you have to manually enable it. I haven’t had chance to look at it yet, so can’t help much further than that.

It’s due to the reason mf_social provided.

If you are using version 0.117.X you can enable the new ‘Native Types’ feature (caution: it’s in beta and may cause other templates in your system to behave in an unforeseen way).

Native types support for templates

If you set legacy_templates: false your templates can produce value types other than just string (such as int, float, list, dict, etc).

Ok thanks a lot, yes im in 0.117 and i forget this new feature

I don’t want to test beta template :wink:

I will to do it with python script then if a find the topic where i see the workaround by parsing a json

:wink:

1 Like