Clock/timer device Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Andrex
Posts: 92
Joined: Thursday 18 February 2016 9:11
Target OS: Linux
Domoticz version:
Contact:

Clock/timer device

Post by Andrex »

I'm adding to DomoticZ the garden irrigation.
I've added a switch for every valve and a general "start timing" push button where I've added a timer for when the irrigation should start.
Now I need a couple of device where I can put the duration of the irrigation. I need 2 because 3 zones needs the same time and the other 7 need to stay open longer. Putting a "start" and "end" timer for each valve is not applicable since if I need to change the duration, I would have to modify all the 10 timers.
I will manage in Node Red the switch between valves, I just need to receive the start command (from the push button timer) and the duration.
I need the duration to be a device because I need to change it sometimes and I don't want my family to go over the code.
Any idea?
Thanks,
Andrea
elmortero
Posts: 248
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Clock/timer device

Post by elmortero »

Maybe you could use to virtual thermostat devices.
There you can use the up/down arrows to set the value and read them from your script.
Andrex
Posts: 92
Joined: Thursday 18 February 2016 9:11
Target OS: Linux
Domoticz version:
Contact:

Re: Clock/timer device

Post by Andrex »

elmortero wrote: Wednesday 08 November 2017 13:54 Maybe you could use to virtual thermostat devices.
There you can use the up/down arrows to set the value and read them from your script.
Good one!
I'll try that.
Thanks for the idea!
Andrea
Last edited by Andrex on Wednesday 08 November 2017 19:11, edited 2 times in total.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Clock/timer device

Post by emme »

you can use dzVents with some variables or text devices in which put the timers (so you won't modify the scripts) and us the .switchOff().afterMin() functions...

so.. le'ts imagine you have your zone like this:

Zone Valve Names:
Garden_Zone_1 ON/OFF
Garden_Zone_2 ON/OFF
etc etc
in each switch you have a timer event that witch it on

you also have a integer variable with the same name as the valve switch name containing the amount in mins of the timer

so.. the script would be:

Code: Select all

local gardenValveNames = {
      'Garden_Zone_1',
      'Garden_Zone_2'
    }

return {
	on = {
		devices = { gardenValveNames }
	},
	execute = function(dz, gardenValve)
	   if gardenValve.state() == 'On'	then
	       gardenValve.switchOff().afterMin(dz.variables(gardenValve.name))
	   end
	end
}
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest