How to make a timer in Domoticz? Topic is solved
Moderator: leecollings
-
tjabas
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
How to make a timer in Domoticz?
Hi!
i have a water flow (water system in our house)sensor connected to a fibaro universal sensor, the water sensor is connected to the 1in on the fibaro sensor, everything so far is working great, when i turn on the water the sensor show in domoticz that the water is flowing.
But now i want to set a timer like this, if the water is flowing more than 30 minutes another switch is going to turn off the water, but if the sensor sensing that the water is flowing just for 29 minutes nothing will happen, and the timer will restart next time the water starts to flow.
how can i do this in Domoticz?
i have a water flow (water system in our house)sensor connected to a fibaro universal sensor, the water sensor is connected to the 1in on the fibaro sensor, everything so far is working great, when i turn on the water the sensor show in domoticz that the water is flowing.
But now i want to set a timer like this, if the water is flowing more than 30 minutes another switch is going to turn off the water, but if the sensor sensing that the water is flowing just for 29 minutes nothing will happen, and the timer will restart next time the water starts to flow.
how can i do this in Domoticz?
- heggink
- Posts: 989
- Joined: Tuesday 08 September 2015 21:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12451
- Location: NL
- Contact:
Re: How to make a timer in Domoticz?
Use dzvents. On timer 1 minute
Define a persistent local variable initialised 0
Check if valve open and add 1 to local variable if open else reset local variable to 0.
Check if local variable equals 30 and close valve if so.
Define a persistent local variable initialised 0
Check if valve open and add 1 to local variable if open else reset local variable to 0.
Check if local variable equals 30 and close valve if so.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: How to make a timer in Domoticz?
a basic dzvents script:
Code: Select all
return {
on = {
timers = {
'every 1 minute'
},
},
execute = function(domoticz, device)
if domoticz.devices('waterFlow').state == 'On' and domoticz.devices('waterFlow').lastUpdate.minutesAgo >= 30 then
domoticz.devices('waterFlow').switchOff()
end
end
}The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
tjabas
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to make a timer in Domoticz?
Thanks for your answer.
I have never used dzevents at all, can i just copy the example you gave me and paste in dzevents, and it would work?
I have never used dzevents at all, can i just copy the example you gave me and paste in dzevents, and it would work?
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: How to make a timer in Domoticz?
probably it will 
just replace the water flow device name
uh... what verstion of domoticz are you running?
just replace the water flow device name
uh... what verstion of domoticz are you running?
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
tjabas
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to make a timer in Domoticz?
thanks :)The latest beta.
- gielie
- Posts: 290
- Joined: Tuesday 12 January 2016 11:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest β
- Location: The Netherlands (Alkmaar)
- Contact:
Re: How to make a timer in Domoticz?
Very nice example, but now i want to do the same with a selector switch.emme wrote: Thursday 15 February 2018 18:04 a basic dzvents script:
Code: Select all
return { on = { timers = { 'every 1 minute' }, }, execute = function(domoticz, device) if domoticz.devices('waterFlow').state == 'On' and domoticz.devices('waterFlow').lastUpdate.minutesAgo >= 30 then domoticz.devices('waterFlow').switchOff() end end }
I have a thermostat selector switch called "Toon auto program" with no, yes and temporary. When the thermostat is set manually to a temp outside the program the switch will go to temporary and i want this to go back to yes after 30 minutes.
How can i achieve this?
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: How to make a timer in Domoticz?
mmmhgielie wrote: Friday 16 February 2018 11:04 Very nice example, but now i want to do the same with a selector switch.
I have a thermostat selector switch called "Toon auto program" with no, yes and temporary. When the thermostat is set manually to a temp outside the program the switch will go to temporary and i want this to go back to yes after 30 minutes.
How can i achieve this?
let me sum:
Actors:
1 setPoint for manual operations
1 selector Switch (Toon auto program) with 3 values: No (lvl. 10), Yes (lvl. 20), Temp. (lvl.30)
Scene:
if setPoint changes the Toon auto program should go to Temp. for 30 mins and then go back to Yes
Note:
i the logic behind No and Yes there is no change to the manual setPoint, correct?
If so, once back to No or Yes, the manual setPoint has no impact in the heating system...
Correct?
then this should be achieved with:
Code: Select all
local manSetPoint = 'Manual SetPoint Name'
local toonDev = 'Toon auto program'
local delay = 30 -- delay in minutes to turn back to yes
return {
on = {
devices = { manSetPoint },
},
execute = function(domoticz, device)
domoticz.devices(toonDev).cancelQueuedCommands()
domoticz.devices(toonDev).switchSelector(30)
domoticz.devices(toonDev).switchSelector(20).afterMin(delay)
end
}this will remove all old changes to the thermostat, and basically reset the timer by whitch the selector moves back
let me know if it works
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
- gielie
- Posts: 290
- Joined: Tuesday 12 January 2016 11:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest β
- Location: The Netherlands (Alkmaar)
- Contact:
Re: How to make a timer in Domoticz?
First thanks for the help, this is what i made of it
I put 2 min in there to test it but the script does nothing, i dont find anything in the log either
Code: Select all
local manSetPoint = 'Temporary'
local toonDev = 'Toon Auto Program'
local delay = 2 -- delay in minutes to turn back to yes
return {
on = {devices = { manSetPoint },
},
execute = function(domoticz, device)
domoticz.devices(toonDev).cancelQueuedCommands()
domoticz.devices(toonDev).switchSelector(30)
domoticz.devices(toonDev).switchSelector(20).afterMin(delay)
end
}- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
Who is online
Users browsing this forum: No registered users and 1 guest