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.
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
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}}"}
I found what I did wrong, thank you!
After following this thread, this is what worked for me.
Sharing here in case others find it useful:
Thanks! that helped me a lot…
Can someone cast an eye across my issue. Ive read through the post a few times trying to pick up how to do this, but not having much luck. I’d like to send a number value to my servo for it to move to that position. I’m getting a call service error with the below setup. (the error is below)
The very bottom image is the debug when i control it from the lovelace ui, where it actually works.
a nudge in the right direction would be much appreciated!
Thanks
Gav
/config/automations.yaml
trigger:
platform: state
entity_id: input_number.servo_control3
action:
- service: esphome.halloween01_control_servo3
data_template:
level: '{{ trigger.to_state.state | int }}'
/config/configuration.yaml
servo_control3:
initial: 0
min: -100
max: 100
step: 1
mode: slider