Switch node to control ui

hy guys, can someone help me?
i have a problem with my switch node in my node-red, the example i want make some node to read value number 12 and another node read value 15 (i inject the value), and the system in dashboard.

but i want make the system to read the value when i push the one switch button. so the idea is when i push the button, the system will on and start read the value.

i hope you can help me, thanks.

regards,

Hi, while I'd like to help you, after reading what you wrote I'm confused are you takling about the switch node, the ui-switch node or both? Fully naming the node makes it easier for someone else to understand.

Please provide your flow (see: How to share code or flow json which will help me to understand your need.

[{"id":"79d8431.70b31bc","type":"inject","z":"cf0077fe.5d9298","name":"Humidity input","topic":"","payload":"60","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":220,"wires":[["ae443d2a.a26db","2aca00d8.9a4278"]]},{"id":"2bed75d9.3cf1ea","type":"debug","z":"cf0077fe.5d9298","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":160,"wires":[]},{"id":"2aca00d8.9a4278","type":"debug","z":"cf0077fe.5d9298","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":280,"wires":[]},{"id":"6cc4e05c.2f34a8","type":"ui_gauge","z":"cf0077fe.5d9298","name":"Temperature","group":"efa0f796.c5b4d","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperature","label":" °C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":530,"y":80,"wires":[]},{"id":"ae443d2a.a26db","type":"ui_gauge","z":"cf0077fe.5d9298","name":"Humidity","group":"efa0f796.c5b4d","order":1,"width":0,"height":0,"gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":520,"y":220,"wires":[]},{"id":"6e159f64.4502f8","type":"inject","z":"cf0077fe.5d9298","name":"Temperature input","topic":"","payload":"24","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":100,"wires":[["6cc4e05c.2f34a8","2bed75d9.3cf1ea"]]},{"id":"64252c0b.84ed5c","type":"ui_slider","z":"cf0077fe.5d9298","name":"","label":"input ppm","tooltip":"","group":"b644c928.54851","order":1,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":"100","max":"1200","step":"0.5","x":160,"y":420,"wires":[["5efb8af6.bbf64c","c6d279aa.9c723"]]},{"id":"c6d279aa.9c723","type":"ui_gauge","z":"cf0077fe.5d9298","name":"","group":"b644c928.54851","order":3,"width":0,"height":0,"gtype":"gage","title":"read ppm","label":"units","format":"{{value}}","min":"100","max":"1200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":440,"y":380,"wires":[]},{"id":"5efb8af6.bbf64c","type":"function","z":"cf0077fe.5d9298","name":"logic ppm","func":"var newmsg = {payload: msg.payload.toString()};\nm = msg.payload;\nt = msg.topic;\nppm = 1000;\nppmC=900;\n//hw = 25;\nif (m < ppmC)\n{\n    return {topic:t, payload:'on'};\n}\nif(m >= ppmC && m<=ppm)\n{\n    return {topic:t, payload: 'off'}\n}\nif (m > ppm)\n{\n    return {topic:t, payload: 'matikan mesin'}\n}\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":480,"wires":[["c3bbbac1.273d6","e12e94c2.0e22f8"]]},{"id":"c3bbbac1.273d6","type":"ui_led","z":"cf0077fe.5d9298","group":"b644c928.54851","order":2,"width":0,"height":0,"label":"","labelPlacement":"right","labelAlignment":"right","colorForValue":[{"color":"red","value":"off","valueType":"str"},{"color":"green","value":"on","valueType":"str"},{"color":"red","value":"matikan mesin","valueType":"str"}],"allowColorForValueInMessage":false,"name":"pump","x":490,"y":480,"wires":[]},{"id":"e12e94c2.0e22f8","type":"ui_text","z":"cf0077fe.5d9298","group":"b644c928.54851","order":3,"width":0,"height":0,"name":"Pompa nutrisi","label":"nutrition pump","format":"{{msg.payload}}","layout":"row-spread","x":520,"y":520,"wires":[]},{"id":"efa0f796.c5b4d","type":"ui_group","z":"","name":"Temp/Hum","tab":"51d25b77.d44fec","disp":true,"width":"6","collapse":false},{"id":"b644c928.54851","type":"ui_group","z":"","name":"Cek ppm","tab":"51d25b77.d44fec","disp":true,"width":"6","collapse":false},{"id":"51d25b77.d44fec","type":"ui_tab","z":"","name":"DHT","icon":"dashboard","disabled":false,"hidden":false}]

i have the code like that's, here i read 2 input form inject, but before the value is readed, i want make 1 button to start read the value, thanks.

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