This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

BACnet address mapping
#6
Using bacnet.scandevice() can be more convenient for reading many objects at once.

Code:
require('bacnet')
device, objects = bacnet.scandevice(1)

for _, obj in ipairs(objects) do
  if obj.type == 'analog input' then
    name = obj.description
    value = tonumber(obj['present-value'])

    grp.checkupdate(name, value)
    os.sleep(0.1)
  end
end

This script can be modified to create objects automatically using grp.create(). But if you need different data types you will need some extra logic to guess the data type from the name (description).
Reply


Messages In This Thread
BACnet address mapping - by Osvaldas - 12.12.2023, 10:40
RE: BACnet address mapping - by admin - 12.12.2023, 10:57
RE: BACnet address mapping - by Osvaldas - 20.12.2023, 14:19
RE: BACnet address mapping - by Daniel - 08.05.2024, 13:08
RE: BACnet address mapping - by admin - 08.05.2024, 13:50

Forum Jump: