.afterSec or afterMin do not work

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

Moderator: leecollings

Post Reply
Gravityz
Posts: 652
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Netherlands
Contact:

.afterSec or afterMin do not work

Post 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
jake
Posts: 751
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: .afterSec or afterMin do not work

Post by jake »

Is the trigger triggered very frequently? Did it help when you add a checkfirst?

light.switchOff().checkFirst().afterMin(5)
Gravityz
Posts: 652
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: .afterSec or afterMin do not work

Post 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
solarboy
Posts: 357
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: .afterSec or afterMin do not work

Post by solarboy »

Also worth reading about "cancelQueuedCommands" as I beleive this can confuse dzvents.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
Gravityz
Posts: 652
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: .afterSec or afterMin do not work

Post 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
solarboy
Posts: 357
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: .afterSec or afterMin do not work

Post by solarboy »

Gravityz wrote: Wednesday 26 October 2022 22:27
i am getting old
:lol: yep, me too.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest