Assign input_select value to another input_select in automation?

Hi all,

is there a way to assign the value of a input_select.A to another input_select.B in a automation ?
I tried to use the service: input_select.set_options with data: options: input_select.B like this

sequence:
  - service: input_select.set_options
    data:
      options: input_select.B
    target:
      entity_id: input_select.A

But input_select.A is not set to the value of input_select.B, it set to the string “input_select.B” that is no member of input_select.A :slight_smile:

I also tried to set data to {{ states(‘input_select.B’) | string }}

But getting data back after saving automation with data set to: “[object Object]”: null

Is there a way to get it working ?

input_select.set_options sets the list of options available to be selected, it does not directly set the state (except if you only give it one option).

What exactly are you trying to do? Does A already have all the options that B has, or do they need to be added? If the options already match, you can use input_select.select_option.

sequence:
  - service: input_select.select_option
    data:
      option: "{{ states('input_select.B') }}"
    target:
      entity_id: input_select.A

Thanks that looks good, it looks like my mistake was options & " | string".

A & B have the same options, yes.
B holds the last selected value (option) when A changes to one of the last 4 options, than A will return to its last value (value of B) after one minute.

I used input_select.select_options, but think the states string was incorrect, so getting the error [object…

No, using the string filter just didn’t do anything since states are always strings… the issue was using the wrong service call i.e. set_options vs. select_option. The "[object Object]": null is usually because the templates are not properly wrapped in quotes.

Sorry, i edited the last comment before you answer,
→ it looks like my mistake was options & " | string".

Good to know that the there has to be quotes arround the instruction, this was not clear before.

Thanks for your help !