16.07.2021, 16:07
Reading object by object won't help much I think. There is option to read whole device at once and then you will need to extract each objects from the list. Make sure that all is a single resident script.
Read whole device like this:
To read single present value form this objects list do this:
Test this and see if it works better.
Read whole device like this:
Code:
require('bacnet')
device, objects = bacnet.scandevice(ID)
Code:
function findobject(objects, objtype, objid)
for _, object in ipairs(objects) do
if object.identifier == objid and object.type == objtype then
return object
end
end
end
object = findobject(objects, 'analog value', Object-ID)
log(tonumber(object["present-value"]))
------------------------------
Ctrl+F5
Ctrl+F5