Error in log (Solved)

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

Moderator: leecollings

Post Reply
leby
Posts: 98
Joined: Monday 28 July 2014 9:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Stockholm
Contact:

Error in log (Solved)

Post 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.
Last edited by leby on Saturday 19 September 2020 7:48, edited 1 time in total.
/lennart
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Error in log

Post 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 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
leby
Posts: 98
Joined: Monday 28 July 2014 9:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Stockholm
Contact:

Re: Error in log

Post 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
/lennart
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Error in log

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
leby
Posts: 98
Joined: Monday 28 July 2014 9:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Stockholm
Contact:

Re: Error in log

Post 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.
/lennart
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Error in log

Post 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.



Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest