Editing a switch node base value from the dashboard

Hello everyone,

I have a question : Can you somehow edit the base value of a switch node in dashboard?

In my case the switch node sends a payload when the value is bigger than 3000 but can i somehow edit that value from the dashboard instead of opening it from the node itself?? eg.: instead of 3000 to be 200?

Instead of a fixed value in the switch node use a global variable.

Also if the value to be compared against is in the message then you can compare against msg.some_attribute

Can you please send me an example flow? I have no idea how to do it.
I would really appreciate it

Have a careful read of the node red docs page Working with Messages, then tell us what in particular you don't know how to do, if you still don't.

So i set up a switch to compare it to msg.topic (base value of it comes from an inject and the value is 10)
And then i pass a number there as an msg.payload which is bigger and one which is smaller than 10 but nothing happens

[{"id":"2cf862d7.502fee","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"77567440.2acd0c","type":"debug","z":"2cf862d7.502fee","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":910,"y":340,"wires":[]},{"id":"7746ae89.6899d","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["aa8de96b.435838"]]},{"id":"23600647.be59ba","type":"switch","z":"2cf862d7.502fee","name":"","property":"paylaod","propertyType":"msg","rules":[{"t":"gt","v":"topic","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":260,"wires":[["77567440.2acd0c"]]},{"id":"cde726a8.aed498","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"2000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":140,"wires":[["23600647.be59ba"]]},{"id":"d21c3318.3c516","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"3","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":180,"wires":[["23600647.be59ba"]]},{"id":"aa8de96b.435838","type":"change","z":"2cf862d7.502fee","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":300,"wires":[["23600647.be59ba","77567440.2acd0c"]]}]

Same happens if i use a global varaible

[{"id":"79ee503e.0c074","type":"function","z":"2cf862d7.502fee","name":"","func":"var a= global.get(\"temp\");\nmsg.payload= a;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":540,"wires":[[]]}]

Try this (note, as well as trying to use values from multiple messages at once you had misspelt payload in the switch node

image

[{"id":"42cb070e.d85ea8","type":"debug","z":"57017347.8029cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":280,"wires":[]},{"id":"c91cf0f9.979468","type":"inject","z":"57017347.8029cc","name":"p: 10, t:3","props":[{"p":"payload"},{"p":"topic","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":240,"y":280,"wires":[["6e4a835a.9b3c04"]]},{"id":"6e4a835a.9b3c04","type":"switch","z":"57017347.8029cc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"topic","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":280,"wires":[["42cb070e.d85ea8"]]},{"id":"b1c8961e.31701","type":"inject","z":"57017347.8029cc","name":"p: 10, t:2000","props":[{"p":"payload"},{"p":"topic","v":"2000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":230,"y":340,"wires":[["6e4a835a.9b3c04"]]}]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.