Normally I'd write out the solution but here is a flow demonstrating it turning on and off a ui-led using a switch
, trigger
, delay
and change
nodes. You should be able to adapt it to your needs.
[{"id":"9f6951d1.47eee","type":"tab","label":"Test","disabled":false,"info":""},{"id":"66bfc89c.55c1f","type":"switch","z":"9f6951d1.47eee","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":290,"y":220,"wires":[["99a0ef7d.62fcf"],["b002a39.ef7776"]]},{"id":"99a0ef7d.62fcf","type":"trigger","z":"9f6951d1.47eee","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":460,"y":180,"wires":[["7aa06b8a.acd8b4","3163e7ae.c42568"]]},{"id":"3163e7ae.c42568","type":"delay","z":"9f6951d1.47eee","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":460,"y":80,"wires":[["99a0ef7d.62fcf"]]},{"id":"7aa06b8a.acd8b4","type":"ui_led","z":"9f6951d1.47eee","group":"b853aa95.01f38","order":1,"width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"green","value":"1","valueType":"num"},{"color":"red","value":"0","valueType":"num"}],"allowColorForValueInMessage":false,"name":"","x":910,"y":180,"wires":[]},{"id":"e98ec34b.4f4a4","type":"inject","z":"9f6951d1.47eee","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":180,"wires":[["66bfc89c.55c1f"]]},{"id":"4dd5c1b.e1fbdc","type":"inject","z":"9f6951d1.47eee","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":260,"wires":[["66bfc89c.55c1f"]]},{"id":"b002a39.ef7776","type":"change","z":"9f6951d1.47eee","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["8f1dbf6.b70354","a0219e49.8cb4c8"]]},{"id":"88aa448a.423f98","type":"inject","z":"9f6951d1.47eee","name":"Manual and startup reset","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":210,"y":360,"wires":[["b002a39.ef7776"]]},{"id":"a0219e49.8cb4c8","type":"change","z":"9f6951d1.47eee","name":"needed to turn of ui-led","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":220,"wires":[["7aa06b8a.acd8b4"]]},{"id":"8f1dbf6.b70354","type":"link out","z":"9f6951d1.47eee","name":"to RESET","links":["b3ed9183.7e5668"],"x":660,"y":300,"wires":[],"l":true},{"id":"b3ed9183.7e5668","type":"link in","z":"9f6951d1.47eee","name":"RESET","links":["8f1dbf6.b70354"],"x":250,"y":120,"wires":[["3163e7ae.c42568","99a0ef7d.62fcf"]],"l":true},{"id":"b853aa95.01f38","type":"ui_group","z":"","name":"Default","tab":"c0e9b3.7bfe565","disp":true,"width":"14","collapse":false},{"id":"c0e9b3.7bfe565","type":"ui_tab","z":"","name":"Test","icon":"dashboard","order":1,"disabled":false,"hidden":false}]