Open fromnowhereuser opened 2 years ago
Hi, so I assume you want to read a specific object property from a device. In the given example above you are reading the Description of Device object
.
Let me elaborate.
The read property function has the following structure:
client.readProperty(deviceIPAddress, { type: objectType, instance: objectInstance }, propertyToRead, (err, value) => {
console.log('value:', value);
});
The actual device is also considered as an object of type 8 with instance 44301 which is the default instance. This instance essentially is deviceID ( each device has unique ID ), so you can either use the default one or use the actual device ID. Property id: 28 is the description property of the object.
So basically you use the same structure for any object ( as mentioned above the device is an object as well ). The code for the object you gave as an example that you want to read would look like the following:
const bacnet = require('node-bacnet');
const client = new bacnet();
const deviceIp = '192.168.1.12';
const readObject = {
objectId: {
type: 2,
instance: 13
},
property: 85
}
client.readProperty(deviceIp, readObject.objectId, readObject.property, (err, value) => {
console.log('value: ', value);
});
Hope this helps :))
Node Version:
X.Y.Z
Node BACstack Version:
X.Y.Z
Note: Make sure you have read the FAQs before logging this issue.
Feature Request / Question
Hello all, my questio is quite simple, i wanty to read a property (present value for ex) so, the propertyID: 85 To test, i have downloaded this: http://bacnet.sourceforge.net/ and i run this command to query a property: ./bacrp --mac 192.168.1.12 1012 2 13 present-value or ./bacrp --mac 192.168.1.12 1012 2 13 85
192.168.1.12 is ip of the device i want to query
1012 is the DEVICE instance
2 is the object-type (like analog, etc...)
13 os the OBJECT instance
property 85, for present value according to bacnet protocol.
According to the node-bacstack doc, to read a property, i need to: const bacnet = require('node-bacnet'); const client = new bacnet();
client.readProperty('192.168.1.43', {type: 8, instance: 44301}, 28, (err, value) => { console.log('value: ', value); });
But, i cant put the OBJECT instance somewhere, so... what can i do ? I am quite stuck and i feel i am doing something wrong.. but i can see where