BACnet Device Service
The BACnet Device Services integrate the BACnet protocol with Edge Xpert.
Breaking Change in Edge Xpert v2.2
- The attribute values for
instance
,property
andtype
have changed from strings to integers - The attribute value
raw
has changed from string to boolean
Key Features
The BACnet Device Service acts as a BACnet client. There are two BACnet Device Services:
Both versions support the reading and writing data values on a BACnet device. For further information, refer to the official ASHRAE SSPC 135 website.
BACnet ReadPropertyMultiple and WritePropertyMultiple
The BACnet protocol traditionally has the option for reading and writing multiple properties in the same command. Previous versions of the Edge Xpert BACnet device service implemented this as a distinct option in device provisioning. This has now been incorporated into the device service and occurs automatically. This can be disabled with the DisableMultiRead and DisableMultiWrite environment variables. Additionally, the maximum number of reads and writes within a command can now be specified with the MultiReadBatch environment variable.
BACnet Discovery
The BACnet Device Service implements a discovery feature. This allows the automatic onboarding of BACnet devices discovered on the network. This reduces the complexity and allows BACnet devices to be onboarded quickly and easily.
Supported Data Types
When the device receives a request, it returns a value with a BACnet type. The following table lists the BACnet data types and their equivalent EdgeXpert data types for individual BACnet property elements:
Note
If the device returns a type that is not supported, the Device Service logs an appropriate error and the request fails.
BACnet Type | EdgeXpert Type | Read/Write Ability |
---|---|---|
Boolean | Bool | RW |
Enumerated | Uint32 | RW |
Unsigned Int | Uint64 | RW |
Signed Int | Int32 | RW |
Real | Float32 | RW |
Double | Float64 | RW |
Character String | String | RW |
Date | String | R |
Time | String | R |
Octet String | Uint8Array | R |
Bit String | Uint8Array | R |
BACnetObjectIdentifier | String | R |
Null | N/A | RW |
Note
Edge Xpert does not support the Null data type but users are still able to read or write null values to and from the device. See below for more details
BACnet Array types can be read but will only be returned in the Edge Xpert String type where each element is comma-separated. The following BACnet types are supported for the array:
- Boolean
- Enumerated
- Unsigned Int
- Signed Int
- Real
- Double
- Character String
- Null
BACnet Device Profile
The device profile defines what resources are available on a particular device. Ensure that the following profile attributes are defined in the device profile:
Attribute | Type | Required | Description |
---|---|---|---|
type |
Uint32 | Yes |
BACnet object type Object type values are specified in an enumeration: bacenum.h file |
instance |
Uint32 | Yes | BACnet object instance number |
property |
Uint32 | Yes |
BACnet property type Property types are specified in an enumeration: bacenum.h file |
index |
Uint32 | No | The index of the array. Only required for an individual element of a BACnet Array to specify the index. Index 0 holds the size of an array in BACnet. |
raw |
Bool | No |
Read / write the full APDU if true Device resource value type must also be set to Uint8Array if true |
Note
Object types and their corresponding enums are specified in the BACnet stack bacenum.h file.
BACnet Protocol Properties
The available BACnet protocol properties are described in the following table:
Protocol Property | Description | Valid Values |
---|---|---|
DeviceInstance | Specifies the network ID of the BACnet device instance | Unsigned Integer. For example, 1234 |
BACnet Priority Levels
When performing a put request on a BACnet device resource, an additional option can be added to the URL query parameter, Priority
, which indicates the priority level (1 to 16) of the value. Only a select few Object types and properties support these priority levels in BACnet.
An example is provided that demonstrates its usage on the Present Value property of the Analog Output Object. In this example, priority level 2 will be set as the value 33.0.
curl -g --request PUT 'http://<bacnet-service-address>:59882/api/v2/device/name/bacnet-ip-sim/analog_output_0-present-value?options={"Priority":2}' \
--header 'Content-Type: application/json' \
--data-raw '{
"analog_output_0-present-value": 33.0
}'
These priority levels can also be set to null. In the following example, priority level 1 will be set to null. This will mean that when the Present Value property is read, the returned reading will skip priority level 1 as its null and return the value from level 2 which was set as 33.0.
curl -g --request PUT 'http://<bacnet-service-address>:59882/api/v2/device/name/bacnet-ip-sim/analog_output_0-present-value?options={"Priority":1}' \
--header 'Content-Type: application/json' \
--data-raw '{
"analog_output_0-present-value": null
}'
Using the BACnet Device Service
An example of setting up and using devices with the Edge Xpert BACnet Device Service can be found at BACnet/IP Example and BACnet/MSTP Example.