Code: Select all
return { on = { devices = { 97 } }, -- MI robot Control
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
if device.levelName == 'Clean' then
domoticz.globalData.previousClean = tostring(dz.time.raw) -- update global variabele previousClean
end
end
}I checked the scripts by changing the 'on device' to an on/off switch, and that worked without problems.
What could be wrong? Is there an alternative, e.g. setting the global variable in some way with the level actions?