Enable a switch

I would like to start the power supply of a NAS with a switch. To avoid activating the switch by mistake I would like to attach another switch to enable the first one for i.e. 5 seconds. after the 5 seconds no more activating of the first switch should be possible. On the other hand the status of the first switch should be ON also after the enabled time until shut off manually.
Any ideas to help me please?

Erwin

Hi Erwin,

I've prepared something for you.

[{"id":"ef1fc105685aed46","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"08ed4bf3d8fe21d9","type":"ui_switch","z":"ef1fc105685aed46","name":"","label":"NAS on/off","tooltip":"","group":"e924fd1fd06cf83a","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":370,"y":240,"wires":[["0344fa4b5d334dbe"]]},{"id":"040e3cd0157b0925","type":"change","z":"ef1fc105685aed46","name":"","rules":[{"t":"set","p":"gate","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":160,"wires":[[]]},{"id":"0344fa4b5d334dbe","type":"switch","z":"ef1fc105685aed46","name":"","property":"gate","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":300,"wires":[["08ed4bf3d8fe21d9","4610c433a0a4734d"],[]]},{"id":"2302680fbf4e2b27","type":"ui_switch","z":"ef1fc105685aed46","name":"","label":"Enable","tooltip":"","group":"e924fd1fd06cf83a","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":360,"y":80,"wires":[["c9376a86c72a1cbd"]]},{"id":"c9376a86c72a1cbd","type":"trigger","z":"ef1fc105685aed46","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":540,"y":140,"wires":[["2302680fbf4e2b27","040e3cd0157b0925","9d39129e738d8f80"]]},{"id":"9d39129e738d8f80","type":"ui_text","z":"ef1fc105685aed46","group":"e924fd1fd06cf83a","order":2,"width":0,"height":0,"name":"","label":"Enable:","format":"{{msg.payload}}","layout":"row-spread","className":"","x":740,"y":120,"wires":[]},{"id":"4610c433a0a4734d","type":"ui_text","z":"ef1fc105685aed46","group":"e924fd1fd06cf83a","order":2,"width":0,"height":0,"name":"","label":"NAS:","format":"{{msg.payload}}","layout":"row-spread","className":"","x":730,"y":300,"wires":[]},{"id":"e924fd1fd06cf83a","type":"ui_group","name":"Default","tab":"854bd9cd49df7ac1","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"854bd9cd49df7ac1","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

I hope I have understood your needs well.

Stepan

1 Like

That is a good idea so something isn't accidently swiped while scrolling down, Nice one @Napest

Many thanks. Thats a wonderful solution.

Erwin

Or use the built in enabled property to actually disable the switch, no context needed or switch node.

[{"id":"cf150158.9206d8","type":"ui_button","z":"ef1fc105685aed46","name":"","group":"e924fd1fd06cf83a","order":8,"width":0,"height":0,"passthru":false,"label":"Enable","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":350,"y":140,"wires":[["c9376a86c72a1cbd"]]},{"id":"c9376a86c72a1cbd","type":"trigger","z":"ef1fc105685aed46","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":540,"y":140,"wires":[["9d39129e738d8f80","c086f399.b02cd"]]},{"id":"9d39129e738d8f80","type":"ui_text","z":"ef1fc105685aed46","group":"e924fd1fd06cf83a","order":2,"width":0,"height":0,"name":"","label":"Enabled:","format":"{{msg.payload}}","layout":"row-spread","className":"","x":750,"y":120,"wires":[]},{"id":"c086f399.b02cd","type":"change","z":"ef1fc105685aed46","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"enabled","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":160,"wires":[["08ed4bf3d8fe21d9"]]},{"id":"08ed4bf3d8fe21d9","type":"ui_switch","z":"ef1fc105685aed46","name":"","label":"NAS on/off","tooltip":"","group":"e924fd1fd06cf83a","order":0,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":380,"y":220,"wires":[["4610c433a0a4734d"]]},{"id":"4610c433a0a4734d","type":"ui_text","z":"ef1fc105685aed46","group":"e924fd1fd06cf83a","order":2,"width":0,"height":0,"name":"","label":"NAS:","format":"{{msg.payload}}","layout":"row-spread","className":"","x":590,"y":220,"wires":[]},{"id":"e924fd1fd06cf83a","type":"ui_group","name":"Default","tab":"854bd9cd49df7ac1","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"854bd9cd49df7ac1","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

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