Library of Functions


Description


Retrieves the status of a property of a device.  Specifically, the ‘value’ and ‘time last modified’.
This is one of a group of functions:
  • fibaro:get
  • fibaro:getValue
  • fibaro:getModificationTime
These functions differ only in their return value.

Usage and Arguments


fibaro:get(deviceID, propertyName)

  • deviceID: the ID of the device being retrieved from
  • propertyName: the name of the property being retrieved

Returned Values


This function returns two values:

  1. A string containing the current value of the property, and
  2. A timestamp of when the property was last modified

Please note that these return values are of type string.  When comparing them with a variable of type number, use tonumber to convert them first.

Examples


-- Get the value and last modification time
-- of the 'brightness' property of device 11
local value, modificationTime = fibaro:get(11, 'brightness')
 
-- In Lua the second return value can be omitted
-- for this also works:
local value2 = fibaro:get(11, 'brightness')
 
-- The obtained value can be used to do other things in the scene
-- For example, turn off a device when the brightness is above 50
if (tonumber(value) > 50) then
  fibaro:call(142, 'turnOff')
end

See Also


fibaro:getValue

fibaro:getModificationTime