Page 1 of 1

dzvents sequence switches after different time delays

Posted: Wednesday 03 January 2018 21:24
by parrotface
hi I am trying to sequence several switches in a sequence with different time delays between each switch but can't realy seem to get started.
example switch 1 on for 5 mins then off
switch 2 on for 15 mins then off
switch 3 on for 7 mins then off
repeat above

this sequence I need to turn on with one switch using a timer

I have tried various ideas and looking for some fresh ideas or even better an example script
Thanks in advance

Re: dzvents sequence switches after different time delays

Posted: Thursday 04 January 2018 12:51
by dannybloe

Code: Select all

return {
	on =  { 
		devices = { 'triggerSwitch' }
	},
	execute = function(domoticz, device) 
		if (device.active) then
			-- asuming that these switches are currently Off:
			domoticz.devices('switch1').switchOn().forMin(5)
			domoticz.devices('switch2').switchOn().forMin(15)
			domoticz.devices('switch3').switchOn().forMin(7)
		end
	end	
}
Just to give you an idea. Note that if you re-issue the switchOn() command BEFORE the previous forMin() has been completed you have to change it a little bit. See this post.

Re: dzvents sequence switches after different time delays

Posted: Wednesday 10 January 2018 11:06
by parrotface
thanks for reply
I now have some ideas to work on
thanks

Re: dzvents sequence switches after different time delays

Posted: Wednesday 10 January 2018 12:08
by parrotface
Hi tried your script and it works
What I am trying to do is turn on switch2 on after switch1 times out
then turn on switch3 when switch2 times out
Then keep repeating the process until the trigger switch is turned Off
The trigger switch can then be turned on/off manually or use the timer function in domoticz
Many Thanks for your help