Dzvents as sprinkler controler

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

Moderator: leecollings

Post Reply
Dembe
Posts: 9
Joined: Saturday 14 September 2019 9:45
Target OS: Windows
Domoticz version:
Contact:

Dzvents as sprinkler controler

Post by Dembe »

Hello everyone,,
i would like to control my sprinkler system (4 valves visible as switches in domoticz)
what would be best approach to create dummy switch controlled with dzvents
i want to run (on switch) https://www.quickppsr.com.au/
1 valve (x min on then switch off)
2 valve (x min on then switch off)
3 valve (x min on then switch off)
4 valve (x min on then switch off)
it even possible to run script for so long?
problem is that i want to be able switch off at anytime and interrupt program and disable valves anytime....?
Last edited by Dembe on Monday 21 October 2019 16:52, edited 1 time in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dzvents as sprinkler controler

Post by waaren »

Dembe wrote: Saturday 19 October 2019 0:24 I would like to control my sprinkler system (4 valves visible as switches in domoticz)
Sorry but I don't understand your requirement. Can you please explain in a bit more words what you try to to achieve ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Dzvents as sprinkler controler

Post by hoeby »

Could this be a start?

Code: Select all

--Script version: 19101902

local valve1dummy = dz.devices("Valve1dummy")  -- Change name between " " to your dummy device name.
local valve1name  = dz.devices("Valve1name")   -- Change name between " " to your valve device name.
local valve1on    = "5"                        -- Change number between " ", this is time valve is ON, in minutes.

local valve2dummy = dz.devices("Valve2dummy")  -- Change name between " " to your dummy device name.
local valve2name  = dz.devices("Valve2name")   -- Change name between " " to your valve device name.
local valve2on    = "5"                        -- Change number between " ", this is time valve is ON, in minutes.

local valve3dummy = dz.devices("Valve3dummy")  -- Change name between " " to your dummy device name.
local valve3name  = dz.devices("Valve3name")   -- Change name between " " to your valve device name.
local valve3on    = "5"                        -- Change number between " ", this is time valve is ON, in minutes.

local valve4dummy = dz.devices("Valve4dummy")  -- Change name between " " to your dummy device name.
local valve4name  = dz.devices("Valve4name")   -- Change name between " " to your valve device name.
local valve4on    = "5"                        -- Change number between " ", this is time valve is ON, in minutes.

debug = false                                  -- Set to true to enable extra log-info, set to false to disable extra log-info.

-------------------------------------------------------
------------ Do not modify below this line ------------
-------------------------------------------------------

return {
	on = {
		devices = {
			Valve1dummy,
			Valve2dummy, 
			Valve3dummy,
			Valve4dummy,
		}
	},
	execute = function(dz, device)
	    --Valve 1 script
	    if dz.devices(Valve1dummy).state == 'On' then
	        valve1name.switchOn().forMin(valve1on)
	        if debug then
	            print ('Debug valve-script, ' ..valve1name.. ' is switch on for ' ..valve1on.. ' minutes.')
	        end
	    else
	        valve1name.switchOff()
	        if debug then
	            print ('Debug valve-script, ' ..valve1name.. ' is switch off.')
	        end
	    end
		
             --Valve 2 script
	     if dz.devices(Valve2dummy).state == 'On' then
	        valve2name.switchOn().forMin(valve2on)
	        if debug then
	            print ('Debug valve-script, ' ..valve2name.. ' is switch on for ' ..valve2on.. ' minutes')
	        end
	    else
	        valve2name.switchOff()
	        if debug then
	            print ('Debug valve-script, ' ..valve2name.. ' is switch off.')
	        end
	    end
	    
	    --Valve 3 script
	    if dz.devices(Valve3dummy).state == 'On' then
	        valve3name.switchOn().forMin(valve3on)
	        if debug then
	            print ('Debug valve-script, ' ..valve3namen.. ' is switch on for ' ..valve3on.. ' minutes')
	        end
	    else
	        valve3name.switchOff()
	        if debug then
	            print ('Debug valve-script, ' ..valve3name.. ' is switch off.')
	        end
	    end
		
	     --Valve 4 script
	     if dz.devices(Valve4dummy).state == 'On' then
	        valve4name.switchOn().forMin(valve4on)
	        if debug then
	            print ('Debug valve-script, ' ..valve4namen.. ' is switch on for ' ..valve4on.. ' minutes')
	        end
	    else
	        valve4name.switchOff()
	        if debug then
	            print ('Debug valve-script, ' ..valve4name.. ' is switch off.')
	        end
	    end
    end
}

--[[
Release notes:
V19101901: Script is made. Not tested.
V19101902: Debug added.

]]--
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: Dzvents as sprinkler controler

Post by pvklink »

Is this what you want? (i have 6 irrigation zones, each zone has his own timers)
irri.png
irri.png (130.43 KiB) Viewed 498 times
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
besix
Posts: 99
Joined: Friday 25 January 2019 11:33
Target OS: Linux
Domoticz version: beta
Location: Poland
Contact:

Re: Dzvents as sprinkler controler

Post by besix »

pvklink wrote: Wednesday 23 October 2019 22:25 Is this what you want? (i have 6 irrigation zones, each zone has his own timers)
irri.png
Can you share a solution? It's interesting.
Thanks in advance
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest