On-off sequence based on dummy switch status Topic is solved

Moderator: leecollings

Post Reply
vanenkelen
Posts: 5
Joined: Sunday 19 June 2022 16:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

On-off sequence based on dummy switch status

Post by vanenkelen »

Hi,

My first post here. I've been reading a lot and also been testing and experimenting a lot, but I couldn't find a way to solve my 'issue'. Therefore I took the step to post it here and ask for help. I'm afraid I'll have to move to one of the scripting subforums, but I hope someone knows how to solve this with a Blockly. My scripting skills are very poor.

What do I want to achieve:
Start: I turn a dummy switch on
Result: Domoticz switches a real powerswitch on for 1 minute, off for 10 minutes, on for 1 minute, off for 10 minutes, etc. etc. for as long as the dummy switch is turned on
End: I turn the dummy switch off, then the real powerswicht is turned off and the sequence is stopped.

Is this possible with blockly? And if not, which scripting language is best suited for a scripting noob?

NB: If I missed something in preparation for a first post or rules wrt a first post, I'm sorry and please guide me the way :idea:
Dave21w
Posts: 360
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: On-off sequence based on dummy switch status

Post by Dave21w »

Hi, give this a try, obviously adjusting the timing values to suite your needs. The reason you need 2 off times is because both timers will start at the same time so the first one is effectively your ON time and the second is your OFF time, remember your second off time value has to be both added together so given your post you need 60 in the first one and 660 in the second one, this will give you 1min on and 10mins off. The last 2 lines just mean if you switch it off again during the first minute it will go off straight away.

Hope the above makes sense
Timer Test.jpg
Timer Test.jpg (34.69 KiB) Viewed 2255 times
Regards
Dave
vanenkelen
Posts: 5
Joined: Sunday 19 June 2022 16:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: On-off sequence based on dummy switch status

Post by vanenkelen »

It works, thanks! Only I'm not sure why... haha. I've read your post three times and am still trying to understand the logic, but it does exactly what I want. And indeed 60-660 in seconds gives me my 1 minute on and 10 minutes off.

Again, thanks!

While hitting the submit button something clicks in my head. So if I try to explain. The first timed off command (5 seconds in your example) sets the timed physical switch off. The second second off-command (10 seconds in your example) triggers the first rule of the blockly again?

That is interesting behaviour to reuse in other scripts!
Dave21w
Posts: 360
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: On-off sequence based on dummy switch status

Post by Dave21w »

Your welcome and your description is certainly accurate as to what happens, its not quite how I would describe it but if you understand it better using those rules then that's good news, I came up with that blocky years ago as I needed to cycle a mains socket on and off every 15 minutes. Like you my scripting knowledge could be written on the back of a postage stamp :lol:

Regards
Dave
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests