Page 1 of 1

.afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 15:13
by Gravityz
trying something really easy which is driving me mad.

switching a normal light on/off from a dzvents scripts works
however when i want to delay things it does not work
the light does not switch on

if domoticz.devices('Flow').flow ~= 0 then
domoticz.devices('DoucheAlarm').switchOn().afterSec(10)
end

if domoticz.devices('Flow').flow ~= 0 then
domoticz.devices('DoucheAlarm').switchOn().afterMin(1)
end

if i remove the afterSec or afterMin everything works and the light goes on/off instantly
the device is a dummy switch

Re: .afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 17:48
by jake
Is the trigger triggered very frequently? Did it help when you add a checkfirst?

light.switchOff().checkFirst().afterMin(5)

Re: .afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 20:18
by Gravityz
Hi Jake,

no it is not triggered frequently.

i added the checkFirst

DID NOT WORK
light.switchOff().checkFirst().afterMin(5)

DID WORK
light.switchOff().checkFirst().afterSec(5)


it looks like when the delay is high the timing gets unstable or does not work at all

i decided to write a timing section which measures the time which has passed after a routine is triggered by using domoticz.time.dDate

This is much more stable and does not use timing per switch anymore but just 2 data variables

thanks for your help

Re: .afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 21:38
by solarboy
Also worth reading about "cancelQueuedCommands" as I beleive this can confuse dzvents.

Re: .afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 22:27
by Gravityz
thanks,
googled it and what do you know, found a thread started by myself about it
https://domoticz.com/forum/viewtopic.php?t=32845

i am getting old

in the old thread it seemed that the old timers were deleted once a new sequence started
not sure if this is still the case so i think it is best to always use the cancelQueuedCommands

Re: .afterSec or afterMin do not work

Posted: Wednesday 26 October 2022 22:36
by solarboy
Gravityz wrote: Wednesday 26 October 2022 22:27
i am getting old
:lol: yep, me too.