fibaro:getGlobal
fibaro:getGlobalValue
fibaro:getGlobalModificationTime
fibaro:getGlobalModificationTime(varName)
A timestamp of when the global variable was last modified.
Please note that this return value is of type string. When comparing it with a variable of type number, use tonumber
to convert it first.
-- Get the last modification time of the 'counter' global variable
local
lastModified =
fibaro:getGlobalModificationTime
(
'counter'
)
-- If it's been at least 10 seconds since the value was last modified
if
((
os.time
() - lastModified) >= 10)
then
fibaro:debug
(
'It has been 10 seconds or more'
)
else
fibaro:debug
(
'It has been less than 10 seconds'
)
end
fibaro:getGlobal
fibaro:getGlobalValue