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.
Last edited by leby on Saturday 19 September 2020 7:48, edited 1 time in total.
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 ?
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
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.
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.