Page 1 of 1
Switch delay
Posted: Saturday 22 June 2019 14:44
by StefanWouters
I have a script running in DzVents, de scripts runs every time on changes from de P1 device.
I have a switch with a delay time of 120 seconds, the script runs every 10 seconds. On every (10sec) "run" de script restarts the 120 seconds.
is their a possibility get the state of remaining time or an other option?
domoticz.devices (Addition) .switchOn ().checkFirst().afterMin(2)
Re: Switch delay
Posted: Saturday 22 June 2019 15:00
by waaren
StefanWouters wrote: ↑Saturday 22 June 2019 14:44
I have a script running in DzVents, de scripts runs every time on changes from de P1 device.
I have a switch with a delay time of 120 seconds, the script runs every 10 seconds. On every (10sec) "run" de script restarts the 120 seconds.
Is their a possibility get the state of remaining time or an other option?
I only understand part of your requirement but from what I understand you should look for a solution with either dzVents persistent data or a domoticz uservariable.
If you can elaborate a bit on what you intend to do and share the scripts you already have, I might be able to help.
Re: Switch delay
Posted: Saturday 22 June 2019 16:18
by StefanWouters
I run a script wich is triggerd by f
execute = function(domoticz, triggerItem)
if (triggerItem.isDevice) then
the script wil run every 10 seconds, in the last part of the script (after some calculations) some of the switches needs to be changed
for example 1:
if ((domoticz.data.Huidigverbruik >= 0) and (domoticz.devices (Vrijgave).state == 'On')) then
domoticz.devices (Vrijgave) .switchOff ().checkFirst().afterMin(2)
end
With the time delay i want to preventthat the siwtches change every 10 seconds from on to off
Some switches have a delay of 30 second other have 2 minutes
Because the (example 1) is every 10 seconds true, the 2 minutes delay will restart every 10 seconds....
mamybe their is a way to get the remaining time of is their a state, that de delay time is started.
Re: Switch delay
Posted: Saturday 22 June 2019 18:06
by waaren
StefanWouters wrote: ↑Saturday 22 June 2019 16:18
With the time delay i want to prevent that the switches change every 10 seconds
Again still guessing what you exactly mean because you only share part of your script but it just might work if you code it like.
Code: Select all
if domoticz.data.Huidigverbruik >= 0 and domoticz.devices(Vrijgave).lastUpdate.secondsAgo > 120 then
domoticz.devices(Vrijgave).switchOff().checkFirst()
end
Re: Switch delay
Posted: Saturday 22 June 2019 22:41
by StefanWouters
Problem solved with your solution