28.03.2023, 05:00
Function: There was an error in the data type conversion processing for bacnet objects' binary value ',' binary output ', and' binary input 'by tonumber (object ["present value"]).
Take the object 'binary value' as an example: its object ["present value"] is "active" or "inactive", but the value obtained by tonumber (object ["present value"]) is "nil"
1.My script is as follows:
require('bacnet')
device, objects = bacnet.scandevice(3536)
--log(device, objects)
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, 'binary value', 4104)
read_value1, read_value2 = object["present-value"], tonumber(object["present-value"])
log(object,read_value1, read_value2)
2.log:
Event for Bacnet read test (33/0/8) 28.03.2023 12:54:28
* arg: 1
* table:
["present-value"]
* string: inactive
["id"]
* number: 12
["description"]
* string: .................. #395 (2/0/8)
["priority-array"]
* string: Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,0
["overridden"]
* bool: false
["identifier"]
* number: 4104
["in-alarm"]
* bool: false
["type"]
* string: binary value
["name"]
* string: .................. #395 (2.0.8)
["fault"]
* bool: false
["out-of-service"]
* bool: false
* arg: 2
* string: inactive
* arg: 3
* nil
-------------------------------------------
attach:I am not sure if it is related to my installation of the following package.
https://dl.openrb.com/lm-23-imx6/pkg/gen...0_imx6.ipk
https://dl.openrb.com/lm-23-imx6/pkg/gen...0_imx6.sig
Take the object 'binary value' as an example: its object ["present value"] is "active" or "inactive", but the value obtained by tonumber (object ["present value"]) is "nil"
1.My script is as follows:
require('bacnet')
device, objects = bacnet.scandevice(3536)
--log(device, objects)
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, 'binary value', 4104)
read_value1, read_value2 = object["present-value"], tonumber(object["present-value"])
log(object,read_value1, read_value2)
2.log:
Event for Bacnet read test (33/0/8) 28.03.2023 12:54:28
* arg: 1
* table:
["present-value"]
* string: inactive
["id"]
* number: 12
["description"]
* string: .................. #395 (2/0/8)
["priority-array"]
* string: Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,0
["overridden"]
* bool: false
["identifier"]
* number: 4104
["in-alarm"]
* bool: false
["type"]
* string: binary value
["name"]
* string: .................. #395 (2.0.8)
["fault"]
* bool: false
["out-of-service"]
* bool: false
* arg: 2
* string: inactive
* arg: 3
* nil
-------------------------------------------
attach:I am not sure if it is related to my installation of the following package.
https://dl.openrb.com/lm-23-imx6/pkg/gen...0_imx6.ipk
https://dl.openrb.com/lm-23-imx6/pkg/gen...0_imx6.sig