fh1ch / node-bacstack

A BACnet protocol stack written in pure JavaScript
MIT License
174 stars 98 forks source link

WriteProperty error #138

Open harshpatel1408 opened 5 years ago

harshpatel1408 commented 5 years ago

Node Version: 8.16.0

Node BACstack Version: 0.0.1-beta.13

Here is my current code

client.writeProperty('192.168.0.28', 13,10308, 85, [
      {tag: bacnet.enum.ApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN, value: 66}], function(err, value) {
  console.log('value: ', value);
  console.log('err: ', err);
});.

client.writeProperty('192.168.0.28', {type: 2, instance: 10210}, 85, [
      {type: bacnet.enum.ApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN, value: 4}], (err, value) => {
      console.log('value: ', value);
      console.log('err: ', err);
    });

I am passing all the value as per documentation but not able to write property.

Output:

value:  { len: 14,
  objectId: { type: 2, instance: 10210 },
  property: { id: 85, index: 4294967295 },
  values: [ { type: 4, value: 66 } ] }
value:  undefined
err:  Error: BacnetAbort - Reason:0
    at processAbort (/home/pardypanda02/Harsh_Patel/thermostat/node_modules/bacstack/lib/client.js:99:30)
    at handlePdu (/home/pardypanda02/Harsh_Patel/thermostat/node_modules/bacstack/lib/client.js:313:9)
    at handleNpdu (/home/pardypanda02/Harsh_Patel/thermostat/node_modules/bacstack/lib/client.js:342:5)
    at self.receiveData (/home/pardypanda02/Harsh_Patel/thermostat/node_modules/bacstack/lib/client.js:353:7)
    at Socket.<anonymous> (/home/pardypanda02/Harsh_Patel/thermostat/node_modules/bacstack/lib/transport.js:13:25)
    at emitTwo (events.js:126:13)
    at Socket.emit (events.js:214:7)
    at UDP.onMessage [as onmessage] (dgram.js:659:8)
address:  192.168.0.28
deviceId:  1
maxAdpu:  undefined
segmentation:  3
vendorId:  0
address:  192.168.0.28
deviceId:  1
maxAdpu:  undefined
segmentation:  3
vendorId:  0
niemilkm commented 4 years ago

I have a similar issue as shown below. Did you figure out your issue? I am using BACNET_APPLICATION_TAG_REAL. Maybe since you were using BOOLEAN it was failing?

client.writeProperty('192.168.200.147', {type: 2, instance: 0}, 85, [
  {type: bacnet.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: 77.0}
], (err, value) => {
  console.log('error: ', err);
  console.log('value: ', value);
});
error:  Error: BacnetAbort - Reason:0
    at processAbort (/Users/internal/bacnet/node/node_modules/bacstack/lib/client.js:99:30)
    at handlePdu (/Users/internal/bacnet/node/node_modules/bacstack/lib/client.js:313:9)
    at handleNpdu (/Users/internal/bacnet/node/node_modules/bacstack/lib/client.js:342:5)
    at self.receiveData (/Users/internal/bacnet/node/node_modules/bacstack/lib/client.js:353:7)
    at Socket.<anonymous> (/Users/internal/bacnet/node/node_modules/bacstack/lib/transport.js:13:25)
    at emitTwo (events.js:126:13)
    at Socket.emit (events.js:214:7)
    at UDP.onMessage [as onmessage] (dgram.js:659:8)
value:  undefined
Apollon77 commented 4 years ago

Please try wit the updated fork at https://github.com/BiancoRoyal/node-bacstack