before 2020.1 i was able to calculate seconds between two updates of a dummy switch.
the code is like that
Code: Select all
return {
on = {
devices = {'update'},
},
data = {},
logging = {
level = domoticz.LOG_DEBUG,
marker = "update: "
},
execute = function(dz, device, tginfo)
local update=dz.devices('update')
dz.log(update.lastUpdate.secondsAgo)
end
}
Now log tell me 0 seconds...
Code: Select all
2020-05-29 16:48:07.010 Status: dzVents: Info: Handling events for: "update", value: "Off"
2020-05-29 16:48:07.010 Status: dzVents: Info: update: : ------ Start internal script: test: Device: "update (Dummy)", Index: 187
2020-05-29 16:48:07.011 Status: dzVents: Info: update: : 0
2020-05-29 16:48:07.012 Status: dzVents: Info: update: : ------ Finished test
Thanx in advance