Function:
Code: Select all
function getMinutes(dTime)
local raw = dTime.rawTime
local a = {}
local i = 0
for v in string.gmatch(raw, "%d+") do
a[i] = tonumber(v)
i = i + 1
end
local min = a[1] + a[0] * 60
return min
end
Log:
2017-09-07 16:16:48.705 Error: dzVents: Error: An error occured when calling event handler BT Occupancy
2017-09-07 16:16:48.705 Error: dzVents: Error: ...domoticz/scripts/dzVents/generated_scripts/Garage dZ.lua:5: bad argument #1 to 'gmatch' (string expected, got nil)
Notice the first line, there is no explanation of what the error is! The second one looks like a normal error.
I suspected that dzVents was sharing or somehow looking at functions by their name and also looking outside the event (there are no helper functions) and into other events somehow, so I re-named one of the functions and its variables and the errors went away. I am running the latest beta version of domoticz on a PI3.
Am I off track?