Set input select based on MQTT

Trying to set up voice control with zanzito. Ran into the problem of automation.
Zanzito publighes the following message
/kitchenvoice off

And have the following rule in place. Wonder where made a mistake

- alias: Kitchen lights voice control
  trigger:
    - platform: mqtt
      topic: /kitchenvoice/#
  action:
  - service: input_select.select_option
    data_template:
      entity_id: input_select.kitchen_light
      option: >
        {%- if trigger.payload == "off"%}
          "off"
        {%- elif trigger.payload == "romantic"%}
          "romantic"
        {%- endif -%}

Try like this:

- alias: Kitchen lights voice control
  trigger:
    - platform: mqtt
      topic: '/kitchenvoice'
  action:
  - service: input_select.select_option
    data_template:
      entity_id: input_select.kitchen_light
      option: >
        {%- if trigger.payload == "off" %}
            "off"
        {%- elif trigger.payload == "romantic" %}
            "romantic"
        {%- endif -%}
1 Like

Thank you. Worked out well

1 Like