How to change Input_Select value in Node-RED

What node would I use to change an input select value based on the state of another input select?

So many options here. Can you give an example of what you’re doing with it?

You can use a straight function node, coupled with a get state node, or change node or trigger node, etc etc. The best method really depends on how it’s being used

I have an input select that chooses “pool mode”. The options are Pool, Spa, Off, Freeze, and Service. I have four automated valves that change direction (I’m using Input Selects for them too, but since they only have two choices, maybe a better path?)…I would like them to change depending on which mode is chosen.

Just use the switch node and output based on the input state.

How do you change an input select?

Use the “call service” node?

I’m unclear how to pass the payload or parameter to the input select. Any advice. Would I just be better off using an input_boolean. Is there any way to change from on/off to spa/pool for example?

Using “update_entity” in the Service field didn’t work and I obviously can’t use turn_on or turn_off…

Why are you using the homeassistant domain?

Use the input select domain and then the services associated with that domain will populate in the options.

Just look at your developer tools, services page on your home assistant and it will tell you what format to use.

That is getting me closer, but I’m still a little unsure how to use the “options”.

I would like it to pass the payload from the switch node, is that the proper way to do this?

You know if you put a debug node on there you will see exactly what your msg contains.

I do, and the message payload is simply “Basin” or “Spa”, but I don’t know how to pass that on to the input_select call service node. I know how to do a workaround using input_booleans, but I like to learn, so was hoping I could figure out the right way to do it using this method.

So instead of looking at JUST the payload, you can set the debug node to output the entire msg. FYI

Well, you need to pass that value to the input_select, which usually means it needs to be formatted correctly. Usually that entails using a change node or a function node.

You should NOT be trying to set options. You should be using SELECT OPTION

If you go to your developers tools, services page, like I already told you to do, you would see what you had available to you.

If you put a call service node on, and fill out the fields with your input_select, and put that on a debug, you would see the exact format you need.

image

msg.payload.data.option

Thank you for your patience, that is very helpful.

I was able to accomplish what I was looking for with{"option":"{{payload}}"}

Now trying to keep all my input_selects, input_booleans, and dashboard switches synced is another fun issue, but I think I have that working for the time being. I’ll keep an eye on it, as it could be disastrous in production if I have valves violently switching directions every fraction of a second due to a loop :slight_smile:

Could you show how you did it exactly? I’m trying to do the same thing…

In the call service node, for the “DATA” field, you use

{"option":"{{payload}}"}

1 Like

I found what I did wrong, thank you!