#A button to go through SOME options of a "select" entity

1 messages · Page 1 of 1 (latest)

vocal pollen
#

I 've got a heater which is operated by different modes displayed in a select menu :

  • Comfort
    ~~- Comfort -1
  • Comfort -2~~
  • Eco
  • Frost protection
  • OFF

I'd like to make a button to go through the options that aren't crossed
Because making a button with a tap-action that would be: perform_action: select.select_next
would have the correct behavior but would make me go through comfort -1 and comfort -2 that I don't want.

That's why I tried this:
tap_action: action: perform-action perform_action: select.select_option target: device_id: da9e0899fc6239769448a6e5f1b1121d data: option: > {% set state = states['select.radiateur_salon_pilot_wire_mode'].state %} {% if (state == "comfort" %} eco {% elif state == "eco" %} comfort {% elif state == "frost_protection" %} off {% else %} mdi:power {% endif%}

But it won't work, displaying the following error:

the option {% set state = states['select.radiateur_salon_pilot_wire_mode'].state %} {% if (state == "comfort") %} eco {% elif state == "eco" %} comfort {% elif state == "frost_protection" %} off {% else %} mdi:power {% endif%} isn't valid for the following entity: select.radiateur_salon_pilot_wire_mode, correct options are : comfort, eco, frost_protection, off, comfort_-1, comfort_-2.

It seems like the "option" field can't get any templating... I don't what to do...
Can anyone help ?

Thank you in advance

old raven
#

You can't put templates there, in a tap_action

#

you can make a script with templates, and then call the script on tap_action

vocal pollen
#

oooh ok that's what I thought. Thank you very much

torpid gate
#

You could also make a select template helper that just doesn't have those options and an action on select of "set the main select to match this one"
Then you can just use the select_next on the template select