dzvents sequence switches after different time delays

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

dzvents sequence switches after different time delays

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzvents sequence switches after different time delays

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Re: dzvents sequence switches after different time delays

Post by parrotface »

thanks for reply
I now have some ideas to work on
thanks
parrotface
Posts: 36
Joined: Monday 02 February 2015 15:50
Target OS: Linux
Domoticz version:
Location: Cheshire England
Contact:

Re: dzvents sequence switches after different time delays

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest