Hi everyone,
I'm new to Nodered, but i have played around with it for 2 days. I think i know some basic things. But i'm struggling with the following problems:
I want to build a flow that can handle two separated outputs. One is set ON/OFF of the Auto/Manual mode. The other is the data to be processed.
The flows i post here is just my sample for testing:
[{"id":"319a8fa5.9db74","type":"inject","z":"d2dd1bf4.363198","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":157.5,"y":599,"wires":[["5168bcc0.ed15e4"]]},{"id":"2523ee3e.b34762","type":"debug","z":"d2dd1bf4.363198","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":967,"y":637,"wires":[]},{"id":"5168bcc0.ed15e4","type":"ui_switch","z":"d2dd1bf4.363198","name":"","label":"Manual/Auto","tooltip":"","group":"2b2c4836.f67468","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":379.5,"y":600,"wires":[["f3261285.dfc9e"]]},{"id":"ff10b8f0.4974a8","type":"function","z":"d2dd1bf4.363198","name":"Data","func":"msg.topic = \"Data\";\n//msg.message = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":421,"y":454,"wires":[["69d44bc3.eb2044"]]},{"id":"f3261285.dfc9e","type":"switch","z":"d2dd1bf4.363198","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":591.5,"y":596,"wires":[["bfdc1e4.ece91e"],["8d9d24a7.626c88"]]},{"id":"8d9d24a7.626c88","type":"function","z":"d2dd1bf4.363198","name":"Auto_OFF","func":"msg.payload = \"Manual\";\nreturn msg;","outputs":1,"noerr":0,"x":760,"y":629,"wires":[["2523ee3e.b34762"]]},{"id":"9d38685b.9f5a08","type":"inject","z":"d2dd1bf4.363198","name":"","topic":"","payload":"10","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":188,"y":441,"wires":[["ff10b8f0.4974a8"]]},{"id":"ae6b13d4.88df2","type":"inject","z":"d2dd1bf4.363198","name":"","topic":"","payload":"4","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":185,"y":482,"wires":[["ff10b8f0.4974a8"]]},{"id":"5c8beae7.342d64","type":"function","z":"d2dd1bf4.363198","name":"Control","func":"if(msg.payload.State == true){\n if(msg.payload.Data <= 5){\n msg.payload = 1;\n return msg;\n }else{\n msg.payload = 0;\n return msg;\n }\n}\n","outputs":1,"noerr":0,"x":1094.5,"y":503,"wires":[["c9983fbf.06c01"]]},{"id":"e5b1531c.6fbcf","type":"debug","z":"d2dd1bf4.363198","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1101.5,"y":602,"wires":[]},{"id":"bfdc1e4.ece91e","type":"function","z":"d2dd1bf4.363198","name":"Auto_ON","func":"msg.topic = \"State\";\nreturn msg;","outputs":1,"noerr":0,"x":747.5,"y":546,"wires":[["2523ee3e.b34762","69d44bc3.eb2044"]]},{"id":"83dd3e04.46089","type":"inject","z":"d2dd1bf4.363198","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":156,"y":645,"wires":[["5168bcc0.ed15e4"]]},{"id":"69d44bc3.eb2044","type":"join","z":"d2dd1bf4.363198","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":898.5,"y":457,"wires":[["81468a2e.e31fd8","5c8beae7.342d64"]]},{"id":"81468a2e.e31fd8","type":"debug","z":"d2dd1bf4.363198","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1077,"y":458,"wires":[]},{"id":"c9983fbf.06c01","type":"ui_slider","z":"d2dd1bf4.363198","name":"","label":"Fan","tooltip":"0 to Full Speed","group":"2b2c4836.f67468","order":0,"width":0,"height":0,"passthru":true,"outs":"end","topic":"Fan Control","min":0,"max":10,"step":1,"x":1099,"y":557,"wires":[["e5b1531c.6fbcf"]]},{"id":"2b2c4836.f67468","type":"ui_group","z":"","name":"Test","tab":"66e1dcb.e5b8924","order":1,"disp":true,"width":"6","collapse":false},{"id":"66e1dcb.e5b8924","type":"ui_tab","z":"","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]
Ideally, when the auto mode is ON, the flows will process the data and change the value of the slider. When auto mode is OFF, the flows will do nothing.
My problem for this flow is: When i turn the auto mode ON, it's working fine. But when i turn it back to OFF, it still process data.
Does anyone have any idea how to fix this?