Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bacstack

fh1ch811MIT0.0.1-beta.14

A BACnet protocol stack written in pure JavaScript.

bacnet, bacstack, building, automation

readme

Node BACstack

A BACnet protocol stack written in pure JavaScript. BACnet is a protocol to interact with building automation devices defined by ASHRAE.

Usage

Add Node BACstack to your project by using:

npm install --save bacstack

The API documentation is available under fh1ch.github.io/node-bacstack.

Features

The BACnet standard defines a wide variety of services as part of it's specification. While Node BACstack tries to be as complete as possible, following services are already supported at this point in time:

Service Execute Handle
Who Is yes yes
I Am yes¹ yes
Who Has yes¹ yes¹
I Have yes¹ yes¹
Time Sync yes yes
UTC Time Sync yes yes
Read Property yes yes¹
Read Property Multiple yes yes¹
Read Range yes yes¹
Write Property yes yes¹
Write Property Multiple yes yes¹
Add List Element yes¹ yes¹
Remove List Element yes¹ yes¹
Create Object yes¹ yes¹
Delete Object yes yes¹
Subscribe COV yes yes¹
Subscribe Property yes yes¹
Atomic Read File yes yes¹
Atomic Write File yes yes¹
Reinitialize Device yes yes¹
Device Communication Control yes yes¹
Get Alarm Summary² yes yes¹
Get Event Information yes yes¹
Get Enrollment Summary² yes yes¹
Acknowledge Alarm yes¹ yes¹
Confirmed Event Notification yes¹ yes¹
Unconfirmed Event Notification yes¹ yes¹
Unconfirmed Private Transfer yes yes¹
Confirmed Private Transfer yes yes¹

¹ Support implemented as Beta (untested, undocumented, breaking interface) ² Deprecated BACnet function, available for backwards compatibility

Example

const bacnet = require('bacstack');

// Initialize BACStack
const client = new bacnet({apduTimeout: 6000});

// Discover Devices
client.on('iAm', (device) => {
  console.log('address: ', device.address);
  console.log('deviceId: ', device.deviceId);
  console.log('maxApdu: ', device.maxApdu);
  console.log('segmentation: ', device.segmentation);
  console.log('vendorId: ', device.vendorId);
});
client.whoIs();

// Read Device Object
const requestArray = [{
  objectId: {type: 8, instance: 4194303},
  properties: [{id: 8}]
}];
client.readPropertyMultiple('192.168.1.43', requestArray, (err, value) => {
  console.log('value: ', value);
});

Contributing

Implementing and maintaining a protocol stack is a lot of work, therefore any help is appreciated, from creating issues, to contributing documentation, fixing issues and adding new features.

Please follow the Contribution Guide when submitting any changes.

License

The MIT License

Copyright (c) 2017-2021 Fabio Huser fabio@fh1.ch

Note: This is not an official product of the BACnet Advocacy Group. BACnet® is a registered trademark of American Society of Heating, Refrigerating and Air-Conditioning Engineers (ASHRAE).

changelog

0.0.1-beta.14 (2021-06-30)

Features

  • client: implement missing un/confirmed event handler (070d407)
  • services: implement EventEnrollmentSummary service (fc40313)

Bug Fixes

  • apdu: rename wrongly named adpu modules and files to apdu (f4ab0e3)
  • asn1: correct encoding of object-types > 512 (3103ad5), closes #122
  • asn1: correct error object structure (e3647da)
  • client: correct deviceCommunicationControl example (955211b)
  • service: correct atomicWriteFile service functionality (8a28088)
  • services: correct readRangeAcknowledge implementation (52c6d02)

BREAKING CHANGES

  • apdu: The adpuTimeout constructor parameter has been renamed to apduTimeout. See docs.

  • apdu: The maxAdpu callback parameter inside the iAm event has been renamed to maxApdu. See docs.

  • enum: The optional input parameter type MaxSegments has been renamed to MaxSegmentsAccepted and has renamed values. See documentation.

  • enum: The optional input parameter type MaxApdu has been renamed to MaxApduLengthAccepted and has renamed values. See documentation.

  • enum: The values of the input parameter type ApplicationTags has changed by dropping it's BACNET_APPLICATION_TAG_* prefix. See documentation.

  • enum: The values of the input parameter type ReinitializedStates has changed by dropping it's BACNET_REINIT_* prefix. See documentation.

0.0.1-beta.13 (2017-12-24)

Features

  • bacnet-client: implement alarming and eventing (fbf120c)

Bug Fixes

  • bacnet-client: use decodeCOVNotify for COV handling (967f154), closes #69
  • bacnet-node-type: correct enum according to BACnet spec (3c271fc)

BREAKING CHANGES

  • bacnet-client: various function parameters changed. Adapt according latest documentation.

  • bacnet-client: isUTC parameter has been omitted and was replaced by the timeSyncUTC function

  • bacnet-enum: Bacnet prefix for all enumerators has been dropped

  • client: objectType and objectInstance parameters for all functions have been replaced by a single obejctId parameter, expecting an object with type and instance attribute.

  • objId renamed to objectId

  • objName renamed to objectName

  • propertyIdentifier renamed to propertyId

  • propertyArrayIndex renamed to index

  • valueList renamed to values

  • objectIdentifier renamed to objectId

  • propertyReferences renamed to properties

  • Recipient.net renamed to recipient.network

  • Recipient.adr renamed to recipient.address

  • subscriptionProcessId renamed to subscriptionProcessIdentifier

  • objectIdentifier renamed to objectId

  • drop of len parameter for properties

0.0.1-beta.12 (2017-12-05)

Bug Fixes

  • bacnet-asn1: correct behaviour for releasing priority / writing of null (d6c893b), closes #65

0.0.1-beta.11 (2017-10-08)

Features

  • bacnet-asn1: implement all BACNET string encodings (14699e2)

0.0.1-beta.10 (2017-09-19)

Features

  • bacnet-client: implement handling of confirmed functions (3e29ab0)
  • bacnet-service: implement decoding functionality for COV and CreateObject (635e419)
  • encoding: add full read/write support for ISO 8859-1 charset (e50b005)
  • implemented more BACNET functions (2721232)

BREAKING CHANGES

  • bacnet-asn1: requires renaming the tag parameter for all write commands to type

  • encoding: rename enum BacnetCharacterStringEncodings value CHARACTER_ISO8859 to CHARACTER_ISO8859_1 which conforms with the BACnet

  • index: the iAm event no longer passes multiple parameters but a single nested object

0.0.1-beta.9 (2017-07-12)

Features

  • bacnet-client: expose BACNET errors and aborts to user (8cda7de)
  • bacnet-client: expose underlying transport errors to user (7d547be)
  • bacnet-client: implement close function for BACstack and underlying UDP socket (4be06bd)
  • bacnet-services: implement missing BACNET service encodings (db6ac7f)
  • bacnet-services: implement writePropertyMultiple service (ea9332c)
  • bacnet-transport: allow reuse of network interface when using bacstack (0fb216c)
  • implement write-property-multiple (5f9f7a0)
  • implement reinitialize-device (1283cc3)
  • implement device-communication-control (04a38a8)
  • implement time-sync (9980a4d)

Bug Fixes

  • ba-enums: make sure the exported enums are not overridden (8369cc8)
  • bacnet-client: correct error message format for BACNET aborts and errors (6533e3f)
  • string-decode: add decoding support for ISO 8859-1 (a224928)

BREAKING CHANGES

  • index: enumerations are no longer accessible via BACStack client instance and have been moved to the module level (require("bacstack").enum;).

  • Tag and Value parameters for writeProperty and writePropertyMultiple have to be adapted to small-case

0.0.1-beta.8 (2017-06-19)

Features

  • bacnet-client: implement additional unsupported services (d82fefe)
  • bacnet-client: rework unconfirmed services to utilize even emitter (b5b8d78)

Bug Fixes

  • bacnet-client: ensure invokeId range of 0-255 (c195331)

0.0.1-beta.7 (2017-06-11)

Bug Fixes

  • bacnet-services: correct all invalid no-array and no-priority checks (ba16839), closes #20

0.0.1-beta.6 (2017-06-04)

Features

  • bacnet-asn1: implement read-access-specification, cov-subscription, calendar decoding functionality (b015f62)
  • bacnet-asn1: implement additional ASN1 base encoding functions (2d6276e)
  • bacnet-services: implemented various new BACNET service encodings (d891305)
  • bacnet-services.spec: implement test coverage for cov-subscription and read-access-specification value types (6665a7c)
  • add JSDoc inline documentation and gh-page publishing (44f88be)

Bug Fixes

  • bacnet-asn1: add guard to prevent endless loops (63d7d8f)
  • bacnet-asn1: correct generic blob decoding context implementation (63eacc6)
  • bacnet-asn1: correct variable initialization for datetime decoding (3bc1591)
  • bacnet-asn1: correct bit-string encoding and decoding (14cda6d)
  • bacnet-asn1: correct octet-string encoding and decoding (aee51a5)
  • bacnet-asn1: correct ASN1 date and time encodings (486153c)
  • bacnet-asn1: align error handling to prevent dead-loop (3feaaba)
  • bacnet-client: correctly handle invalid encoding cases (347b0ed)
  • bacnet-client: remove callback from store if already invoked (16e4483)
  • bacnet-services: correct string and tag comparison (0302fe0)

0.0.1-beta.5 (2017-05-08)

Features

  • bacnet-asn1: add decode support for context encoded properties (a82fb58)
  • bacnet-client: add support for custom transports (8a6a64e)
  • bacnet-transport: use actual max payload size to prevent segmentation issues (2a1a887)

Bug Fixes

  • bacnet-asn1: drop redundant boolean length accumulation (c9622d6)
  • bacnet-asn1: properly handle boolean decoding with length 0 (31b7a28)
  • bacnet-client: start segmentation with correct sequence number 0 (cbc3076)

0.0.1-beta.4 (2017-05-04)

Features

  • bacnet-asn1: expose property value type (b6ca82b)

Bug Fixes

  • bacnet-client: re-enable who-is handler (ae1d710)

BREAKING CHANGES

  • bacnet-asn1: property values changed from single value array ([12]) to array of object [{value: 12, type: 3}]

0.0.1-beta.3 (2017-04-14)

Bug Fixes

  • bacnet-asn1: implement missing stubbed functions (a49b103), closes #3
  • bacnet-client: prevent redundant increment of invoke counter (a59b023), closes #2
  • correct various JSHint linter findings (ee1b2a5)

0.0.1-beta.2 (2017-04-02)

Bug Fixes

  • bacnet-client: add missing callback definition to readProperty function (ba16839)
  • bacnet-client: add missing callback next to writeProperty function (a0cfa37)
  • bacnet-transport: enable broadcast support in UDP socket (b6c49c7)

0.0.1-beta.1 (2017-02-26)

Features

  • asn1: implement octet-string decoding (87348de)
  • client: implement default segmentation handling (58a53e3)
  • add configuration possibility to bacstack (6d3c15b)

0.0.1-beta.0 (2017-02-23)

Features

  • create initial implementation (1c4f139)
  • create initial project structure (4b2c8c0)

Bug Fixes

  • fix various syntax issues (3259856)