Timer to turn switch On/Off

I want to turn on the switch for an hour and then keep it off for an hour. Then this repeats as long as I want it.
Basically, on for a set time and then off for a set time, then on for a set time, and off for a set time. It's like a loop.
What type of timer or flow would do this?

Two conditions. The "if I wont it" means most probably manual override. Any other case it should switch in every hour change.

The inject node can be set to fire message hourly. Your wish will be gate to allow the hourly message to do the switching, So called the "gate". And the switching is just turn over the current state. To know the current state,it takes to know the state so it should be even stored in some context or can be asked from device.

So - to give a good advice - it takes to know related aspects of your setup.

A simple solution...

oppo

[{"id":"a7d157913092ce7b","type":"inject","z":"f8cf7ea5344d6287","name":"every 2 mins","props":[{"p":"payload"}],"repeat":"120","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":115,"y":920,"wires":[["2d960bb3aacbf37d"]]},{"id":"2d960bb3aacbf37d","type":"trigger","z":"f8cf7ea5344d6287","name":"","op1":"","op2":"off","op1type":"pay","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":285,"y":920,"wires":[["5afc656133b343b3"]]},{"id":"5afc656133b343b3","type":"debug","z":"f8cf7ea5344d6287","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":455,"y":920,"wires":[]}]

Edit - just seen @hotNipi 's post (cross post), it's good advice :+1:

Which hardware do you use for control timer and output (relay) ?

Thank you for the suggestions. I am still a little confused because I am trying to turn on 6 relays, but 2 at a time. I want to fire two relays for an hour and then turn them off to fire the other two for an hour and so on.

You didn't say that in your first post... (this point was highlighted in hotnipi's comment above)

But...

[{"id":"a7d157913092ce7b","type":"inject","z":"b3b413d1.05b1b","name":"every 3 mins","props":[{"p":"payload"}],"repeat":"180","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":130,"y":1545,"wires":[["2d960bb3aacbf37d","27324a9eeb602acf"]]},{"id":"2d960bb3aacbf37d","type":"trigger","z":"b3b413d1.05b1b","name":"","op1":"","op2":"off","op1type":"pay","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":300,"y":1545,"wires":[["5afc656133b343b3"]]},{"id":"5afc656133b343b3","type":"debug","z":"b3b413d1.05b1b","name":"Relay 1 & 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":1545,"wires":[]},{"id":"999c7d6c257117f1","type":"trigger","z":"b3b413d1.05b1b","name":"","op1":"","op2":"off","op1type":"pay","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":445,"y":1590,"wires":[["4e234c73842104f0"]]},{"id":"4e234c73842104f0","type":"debug","z":"b3b413d1.05b1b","name":"Relay 3 & 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":605,"y":1590,"wires":[]},{"id":"6e168a4613cf85ce","type":"trigger","z":"b3b413d1.05b1b","name":"","op1":"","op2":"off","op1type":"pay","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":580,"y":1635,"wires":[["39b7760d58873fee"]]},{"id":"39b7760d58873fee","type":"debug","z":"b3b413d1.05b1b","name":"Relay 4 & 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":735,"y":1635,"wires":[]},{"id":"27324a9eeb602acf","type":"delay","z":"b3b413d1.05b1b","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":290,"y":1590,"wires":[["5f521392ac381917","999c7d6c257117f1"]]},{"id":"5f521392ac381917","type":"delay","z":"b3b413d1.05b1b","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":435,"y":1635,"wires":[["6e168a4613cf85ce"]]}]

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