Set_options for input_select using node-red

Hi all, I’m trying to set an input_select entity via the service set_option with node-red.
I’m using the following function in node-red to define the payload for the call service node

msg.payload.service = "input_select.set_options";
msg.payload.data = {"options":"17"};
msg.payload.target = {"entity_id":"input_select.ch_target_temperature"};
return msg;

I’ve used numerous variations for this, like:

msg.payload.service = "input_select.set_options";
msg.payload.data.options="17";
msg.payload.target.entity_id=input_select.ch_target_temperature;
return msg;

Any suggestion would help
Thx, PPee

here’s your data format:

msg.payload = {"data":{"options":["1","2","3"]}}

then feed that payload into a call service node with the entity defined. (in my code where I did this, I also fed the actual input_select in through moustache templates.)

Now here’s the rub: (that you may or may not already know)

Once this WORKS - it does not survive restart - also, the options you add will not show up in the UI. You’ll be able to set them but not select them. For my use case it doesn’t satisfy my requirements (has to be user selectable in UI) so I had to abandon the idea. If that doesn’t matter to you - have fun. :slight_smile:

It feels VERY broken. It’s not - there’s multiple bugs in Github against it where they get closed: Working as designed.

Are you trying to set all the available options for an “input_select”, or select one of the pre-defined ones?

“set_options” does the former, whereas “select_option” does the latter. Given you’re only providing one value (17), I suspect you’re wanting “select_option”.

Thx, I combined both your remarks.
Indeed Michael I meant select_option, thx
Then I adapted the payload Nathan provided to

msg.payload = {"data":{"options":"17"}};

and in the call-service node I set entity_id to ‘input_select.ch_target_temperature’ and Service to ‘select_option’

Now debug info gives

26/01/2023, 10:26:16node: f753d7c5610303f7
msg : string[60]
"Call-service error. extra keys not allowed @ data['options']"

mmmmmm, I found my mistake, for the service set_options it is it is “options” but for the service I needed, select_option it is “option”. …

msg.payload = {"data":{"option":"17"}};