local twSecs = 5 -- Number of seconds in time window
local tNow = os.time()
local tLastOn = tLastOnD99 or 0
tLastOnD99 = tNow
return ((tNow - tLastOn) <= twSecs)
I also changed it to
if tLastOnD99 == nil then
tLastOn = 0
I even used the ‘Edit Startup Lua’ for tLastOnD99 = 0
But sometimes after a few luup reloads / restarts the luup engine says there is an error in the scene because of a nil value. With luatest I found out that it’s the tLastOnD99 that causes the scene to fail.
Does anyone know why it doesn’t change to nil value to 0 even though the scene and startup lua script should adjust this?
but tLastOnD99 = os.time() so it should be a valid string right.
Also if I use ‘Edit Startup Lua’ every reload of the luup should make sure that tLastOnD99 = 0
This only happens sometimes when I hit reload luup/ restart the Vera and not always.
Also the logging say ‘error in scene … tried to call a nil value’.