Page 1 of 1
Error in log (Solved)
Posted: Friday 18 September 2020 17:25
by leby
Hi, my script's is running but I get this error in the log
Code: Select all
Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:823: bad argument #1 to 'find' (string expected, got table)
Any ideas on whats wrong, was not there some month ago... cant find any script with error..
EDIT, I can see it appear on both sunset and sunrise but also a few other times.
Re: Error in log
Posted: Friday 18 September 2020 17:45
by waaren
leby wrote: ↑Friday 18 September 2020 17:25
Hi, my script's is running but I get this error in the log
Code: Select all
Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:823: bad argument #1 to 'find' (string expected, got table)
I am on a different version so not 100% sure what line 823 is in your version. Can you please share line 810-830 of your /home/pi/domoticz/dzVents/runtime/EventHelpers.lua ?
Re: Error in log
Posted: Friday 18 September 2020 18:20
by leby
Code: Select all
local modules
-- only search for named and wildcard triggers,
-- id is done later
for scriptTrigger, scripts in pairs(allEventScripts) do
if (string.find(scriptTrigger, '*')) then -- a wild-card was used
scriptTrigger = ('^' .. scriptTrigger:gsub("[%^$]","."):gsub("*", ".*") .. '$')
local function sMatch(text, match) -- specialized sanitized match function to allow combination of Lua magic chars in wildcards
local sanitizedMatch = match:gsub("([%%%(%)%[%]%+%-%?])", "%%%1") -- escaping all 'magic' chars except *, ., ^ and $
return text:match(sanitizedMatch)
end
if sMatch(target, scriptTrigger) then
if modules == nil then modules = {} end
for i, mod in pairs(scripts) do
table.insert(modules, mod)
end
end
line 823 is this
Code: Select all
if (string.find(scriptTrigger, '*')) then -- a wild-card was used
Re: Error in log
Posted: Friday 18 September 2020 21:21
by waaren
leby wrote: ↑Friday 18 September 2020 17:25
cant find any script with error..
can you replace line 823 in /home/pi/domoticz/dzVents/runtime/EventHelpers.lua with
Code: Select all
if type(scriptTrigger) == 'table' then
utils.log('Script name: ' .. scripts[1].name .. '.lua, has a malformed on-section. The trigger = ' .. _.str(scriptTrigger) , utils.LOG_ERROR)
elseif string.find(scriptTrigger, '*') then -- a wild-card was used
It will not solve the error but will write a line in the log showing which event script triggers the error.
Re: Error in log
Posted: Saturday 19 September 2020 7:47
by leby
Thx @waaren I deleted a number of old inactive scripts last night and today there are no errors! It seems to be solved at least for now.
Re: Error in log
Posted: Saturday 19 September 2020 9:23
by waaren
leby wrote:I deleted a number of old inactive scripts last night and today there are no errors!
Good to read!
Would be great if you could share these old scripts (via PM) It might help to make dzVents more resilient and/or catching the error and send a useful message to the log.