Page 1 of 1

script time triggering frequency

Posted: Saturday 02 May 2026 16:34
by knasson
hi,
I try to use a script time in the 2026-1 version.
as nothing happens in my script i try to look a log
to check that i use the script provided when you add a new script time.
I observe that the frequency is close to 4 minutes instead of the forecasted 1 minute.
on a raspi 4
log script time.jpg
log script time.jpg (67.93 KiB) Viewed 14603 times
the script:
commandArray = {}

print ("Time based event fired");
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
-- if (deviceName=='myDevice') then
-- if deviceValue == "On" then
-- print("Device is On")
-- elseif deviceValue == "Off" then
-- commandArray['a device name'] = "On"
-- commandArray['Scene:MyScene'] = "Off"
-- end
-- end
end

-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do
-- if (variableName=='myVariable') then
-- if variableValue == 1 then
-- commandArray['a device name'] = "On"
-- commandArray['Group:My Group'] = "Off AFTER 30"
-- end
-- end
end

return commandArray
uname -a
Linux kan 6.12.75+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.75-1+rpt1~bookworm (20 26-03-11) aarch64 GNU/Linux

top command

top - 16:28:13 up 7 days, 9:17, 4 users, load average: 0.31, 0.47, 0.46
Tasks: 184 total, 3 running, 181 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.2 us, 0.5 sy, 0.0 ni, 97.2 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3795.8 total, 906.4 free, 591.3 used, 2388.9 buff/cache
MiB Swap: 512.0 total, 512.0 free, 0.0 used. 3204.5 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
241724 root 20 0 2601100 385972 23620 S 6.3 9.9 16,11 domoticz
2733480 root 20 0 36140 26112 9620 S 2.3 0.7 0:03.91 python3
2735129 root 20 0 11732 5052 2880 R 0.7 0.1 0:00.06 top
90 root 0 -20 0 0 0 I 0.3 0.0 40:23.39 kworker/u21:0-brcmf_wq/mmc1:0001:1
2728275 root 20 0 0 0 0 I 0.3 0.0 0:00.21 kworker/3:1-events_freezable
2728460 root 20 0 0 0 0 R 0.3 0.0 0:01.20 kworker/u17:0-events_unbound

what do you think?
do you use this kind of script in this version?
what i is my mistake?

Re: script time triggering frequency

Posted: Saturday 02 May 2026 17:40
by gizmocuz
I think you should first convert it to dzVents, even better upgrade to the latest beta and use the dzVents wizard in the Events editor to get you started

Re: script time triggering frequency

Posted: Saturday 02 May 2026 19:08
by jvdz
knasson wrote: Saturday 02 May 2026 16:34 hi,
I try to use a script time in the 2026-1 version.
-snip-
what i is my mistake?
The name of the script has to be wrong! what did name the script file?

Re: script time triggering frequency

Posted: Saturday 02 May 2026 21:26
by psubiaco
As "--" is used to specify a comment, you have two loops doing nothing, because you have inside the loop every line is commented.
Remove "--" or add a line like
print(deviceName .. " = " .. deviceValue)
to print name and value of each device.

Re: script time triggering frequency

Posted: Sunday 03 May 2026 8:39
by lost
The loops are useless, as an empty minimal framework, but the message should anyway be printed every minute... I don't know how many devices/user var could make the loops take so much time but script time period would not be the 1st issue to notice IMO!

If I run hereunder script in ~/domoticz/scripts/lua path, named (important is the script_time_XXX.lua):
script_time_test.lua

Code: Select all

commandArray = {}

print(os.date("Test Time Script at : %x - %X"))

return commandArray
I get this kind of output every mn at matching log/script exec time:

Code: Select all

$ grep "Test Time Script" /tmp/domoticz.txt 
2026-05-03 08:33:00.462  Status: LUA: Test Time Script at : 05/03/26 - 08:33:00
2026-05-03 08:34:00.462  Status: LUA: Test Time Script at : 05/03/26 - 08:34:00
2026-05-03 08:35:01.484  Status: LUA: Test Time Script at : 05/03/26 - 08:35:01
2026-05-03 08:36:00.511  Status: LUA: Test Time Script at : 05/03/26 - 08:36:00
2026-05-03 08:37:00.522  Status: LUA: Test Time Script at : 05/03/26 - 08:37:00
=> Can be a few hundred ms to ~1s late vs trigger, but that's OK.

Re: script time triggering frequency

Posted: Sunday 03 May 2026 13:19
by knasson
Once followed the gizmocuz recommandations (update domoticz to beta version ) i found back the minute triggering...there was probably a bug in the plain version.

Re: script time triggering frequency

Posted: Sunday 03 May 2026 18:17
by knasson
gizmocuz wrote: Saturday 02 May 2026 17:40 I think you should first convert it to dzVents, even better upgrade to the latest beta and use the dzVents wizard in the Events editor to get you started
Seem the update to beta+dzVents conversion fixes the concern.Thank you