"
", apparently the type of object passed in for the 2nd variable -which I believe to be "customEvent"-, does not seem to expose this function dump(). Either the documentation is wrong, or the customEvent type is missing the dump() function.2020-06-01 20:59:17.847 Error: dzVents: Error: (3.0.5) ...domoticz/scripts/dzVents/generated_scripts/Script #3.lua:19: attempt to call a nil value (field 'dump')
Code: Select all
return {
on = {
devices = {
"myTest"
},
customEvents = {
"myTestEvent*"
}
},
execute = function(domoticz, object, triggerInfo)
if object.isDevice then
domoticz.log('Device ' .. object.name .. ': state ' ..tostring(object.bState).. '.', domoticz.LOG_FORCE)
if object.bState == true then
domoticz.emitEvent('myTestEvent', { idx = object.idx, bState = object.bState, lastUpdate = object.lastUpdate } ).afterSec(15)
-- domoticz.emitEvent( "myTestEvent" ).afterSec(30)
end
elseif object.isCustomEvent then
object.dump()
domoticz.log('CustomEvent, ' .. type(object.data) .. ', idx = '.. tostring(object.data.idx) .. ', bState = ' ..tostring( object.data.bState) .. '.', domoticz.LOG_ERROR)
if object.data == nil then
domoticz.log('CustomEvent, data is nil.', domoticz.LOG_ERROR)
else
local dev = domoticz.devices(object.data.idx)
if dev == nil then
domoticz.log('CustomEvent, device ' .. tostring(domoticz.data.idx) .. ' not found.', domoticz.LOG_ERROR)
else
if dev.bState == object.data.bState and dev.lastUpdate == object.data.lastUpdate then
domoticz.log('CustomEvent, device ' .. dev.name .. ' is still on.', domoticz.LOG_FORCE)
else
domoticz.log('CustomEvent, device ' .. dev.name .. ' is off.', domoticz.LOG_FORCE)
end
end
end
else
domoticz.log( "unexpected trigger type.", domoticz.LOG_FORCE)
end
end
}
Version: 2020.2 (build 12067)
Build Hash: 0fc3c7b70
Compile Date: 2020-05-17 13:15:45
dzVents Version: 3.0.5
Python Version: 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]