Switch/inject button?

I have a code that works when I press the inject button. My inject button will inject a true every 1 sec so my flow will continuously run.

How do I do the same thing with a dashboard switch?

Switch into a trigger node set to repeat. And reset on the off value

Something like this:

[{"id":"359eb642.b7e4ca","type":"ui_switch","z":"703c61ac.837e1","name":"","label":"switch","tooltip":"","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":true,"onvalueType":"bool","onicon":"","oncolor":"","offvalue":false,"offvalueType":"bool","officon":"","offcolor":"","x":1800,"y":460,"wires":[["dc9a2b52.d06fb"]]},{"id":"dc9a2b52.d06fb","type":"switch","z":"703c61ac.837e1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1930,"y":460,"wires":[["b3406f62.84ea1"],["9503f4b8.fad368"]]},{"id":"a7d0ba60.4b2048","type":"trigger","z":"703c61ac.837e1","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-250","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":2260,"y":460,"wires":[[]]},{"id":"b3406f62.84ea1","type":"change","z":"703c61ac.837e1","name":"true?","rules":[{"t":"set","p":"delay","pt":"msg","to":"8000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":2060,"y":430,"wires":[["a7d0ba60.4b2048"]]},{"id":"9503f4b8.fad368","type":"change","z":"703c61ac.837e1","name":"false?","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2060,"y":490,"wires":[["a7d0ba60.4b2048"]]},{"id":"fd5bc002.5b9f38","type":"comment","z":"703c61ac.837e1","name":"Read me *","info":"Optional.\nSet the delay here if you want.\nOr you can just set it in the `trigger` node.","x":2070,"y":390,"wires":[]}]
1 Like

Yup. This did it. Thanks!

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