In the context of the Web of Things (WoT), a Binding Template is a blueprint that gives guidance on how to implement a specific IoT protocol, data format or IoT platform. The Core Binding Templates specification explains the overall mechanism and requirements for any binding to follow. This document gives implementation guidelines regarding BACnet [[BACnet]], a building automation and control networking protocol.

More specifically, this document defines a set of vocabulary terms that can be used inside a Thing Description document, and associated rules which allow to describe WoT operations using BACnet over the network. Additionally, relevant examples are provided to showcase different vocabulary terms and the associated behavior.

This document is a work in progress

BACnet® is a registered trademark of ASHRAE. This document has not been reviewed for publication by ASHRAE, and no endorsement by ASHRAE is implied.

Introduction

BACnet [[BACnet]] is a building automation and control networking protocol for applications such as heating, ventilating, and air conditioning control, lighting control, access control, and fire detection systems.

This document describes how the Web of Things Thing Description [[WOT-THING-DESCRIPTION]] (TD) can be used to represent devices that use BACnet. In particular, the document explain how to create valid TD Forms for the different operations that BACnet can perform.

Forms of a Thing Description instance with BACnet Binding complies with this specification if it follows the normative statements in and .

A JSON Schema [[?JSON-SCHEMA]] to validate Thing Description instances containing BACnet Binding is provided in the GitHub repository.

Binding Scope

It is assumed the reader of this document is familiar with the basic principles and mechanisms of the BACnet standard [[BACnet]].

The following subset of BACnet features is supported by this binding:

This protocol binding is intended to be used to enable web applications to interact with data and control affordances exposed by BACnet devices. It is not intended that this binding be used for device commissioning, onboarding, or device management.

WoT Interaction Affordances are mapped to BACnet Properties. If the BACnet property-identifier is not present in the URI element of the form, the object-identifier is used to interact with the BACnet Object, exposing the present-value Property.

When it is necessary to expose properties other than the present-value property, the property-identifier must be included in the URI element of the form.

Selected BACnet Service parameters are exposed as URI Variables to enable WoT consumers access to BACnet features, for example Command Priority.

URI Scheme

In cases where a URI is needed to refer to data that is accessible using BACnet services, the 'bacnet' URI scheme provides a means to identify a property of an object in the scope of a BACnet device. The 'bacnet' URI scheme does not provide means to identify the BACnet network on which a device resides, or the network access method, physical media, or protocol service to use.

The 'bacnet' URI Scheme used herein is defined in Annex Q.8 of the BACnet Specification [[BACnet]].

URI Syntax

The syntax for the 'bacnet' URI scheme is specified below in Augmented Backus-Naur Form (ABNF) [[RFC5234]]:

bacnet-URI = scheme ":" scheme-specific-part
scheme = "bacnet"
scheme-specific-part = "//" device-identifier "/" object-identifier [ "/" property-identifier [ "/" property-array-index ] ]
device-identifier = number / ".this"
object-identifier = object-type "," object-instance
object-type = number / identifier
object-instance = number
property-identifier = number / identifier
property-array-index = number
number = "0" / non-zero-digit *decimal-digit
non-zero-digit = %x31-39  ; "1" to "9"
decimal-digit = %x30-39  ; "0" to "9"
identifier = lowercase *alphanumeric *( "-" 1*alphanumeric )
alphanumeric = uppercase / lowercase / decimal-digit
uppercase = %x41-5A  ; "A" to "Z"
lowercase = %x61-7A  ; "a" to "z"

device-identifier Component

The device component specifies the device instance number in decimal. A device identifier of .this means "this device" so that it can be used in static files that do not need to be changed when the device identifier changes.

device-identifier = number / ".this"

A Protocol Binding conforming to this specification SHALL use number type for device-identifier.

object-identifier Component

The object-identifier component consist of two sub-components: the object-type and the object-instance number. The object-type is either a decimal number in the range 0 to 210-1 (inclusive) or exactly equal to the identifier text of one of the named items of the BACnetObjectType enumeration defined in Clause 21 of [[BACnet]]. The object-instance number is a decimal number in the range 0 to 222-1 (inclusive).

object-identifier = object-type "," object-instance
object-type = number / identifier
object-instance = number

A Protocol Binding conforming to this specification SHALL use number type for object-type.

property-identifier Component

The property-identifier component is either a decimal number or exactly equal to the identifier text of one of the named items of the BACnetPropertyIdentifier enumeration defined in Clause 21 of [[BACnet]]. If it is omitted, it defaults to present-value except for BACnet File objects, where the absence of the property component refers to the entire content of the file accessed with Stream Access.

property-identifier = number / identifier

A Protocol Binding conforming to this specification SHALL use number type for property-identifier.

property-array-index Component

The components of an array property may be individually accessed (read or written) using an "array index". The index component is a decimal number.

property-array-index = number

An index of 0 (zero) identifies the count of the number of data elements. If the array index is omitted, it means that all the elements of the array are to be accessed. An array index N, greater than zero, identifies the Nth element in the sequence.

Numbers

A decimal number consists of one or more decimal digits. The first digit is not permitted to be zero unless the number consists of a single digit.

number = "0" / non-zero-digit *decimal-digit
non-zero-digit = %x31-39  ; "1" to "9"
decimal-digit = %x30-39  ; "0" to "9"

Identifiers

An identifier conforms to the definition of an identifier in ASN.1 notation (Clause 12.3 of [[X.680]]). It begins with a lowercase letter and is followed by zero or more letters, digits, and hyphens. A hyphen is not permitted to be the last character, nor is it to be followed by another hyphen. The case of letters in an identifier is significant.

identifier = lowercase *alphanumeric *( "-" 1*alphanumeric )
alphanumeric = uppercase / lowercase / decimal-digit
uppercase = %x41-5A  ; "A" to "Z"
lowercase = %x61-7A  ; "a" to "z"
                

BACnet Vocabulary

This section describes the vocabulary used in BACnet. A protocol binding implementation should use the vocabulary defined in this section to describe the different configurations that can be used to exchange data between Web of Things clients, devices, and services.

This vocabulary is fully defined in the BACnet ontology published with this document.

Until the JSON-LD context is published, this document will use the example URI "https://example.org/bacnet"for the context with the prefix "bacv".

URI Variables

Vocabulary term Description Assignment Type
CommandPriority Sets CmdPrio for Writes optional integer
covIncrement Sets minimum change for reporting optional decimal

URI Variables are not included in the 'bacnet' URI Scheme, and are included in the Protocol Binding to communicate PDU option settings for the BACnet driver to use when sending requests.

The following JSON example shows usage of the BACnet vocabulary for URI Variables, specifically CommandPriority and covIncrement. The semantic annotation is optional.

This template could be used to construct the uriVariables element for TD interaction afffordances, to enable the application to communicate URI variables to the BACnet driver, using a consistent format according to the schema constraints below.

These variables may be also used in a form element to provide a constant value for the BACnet driver to use for PDU option values. If the variable is set in the forms element, and the application appends a URI variable to the URI in the request to the BACnet driver, the BACnet driver MUST use the value provided by the application in the URI variable when constructing the BACnet PDU for the request.

{
    "@context": ["https://www.w3.org/2022/wot/td/v1.1",
    {
        "bacv": "https://example.org/bacnet"
    }],
    "uriVariables": {
        "CommandPriority": {
            "@type": "bacv:CommandPriority",
            "type": "integer",
            "minimum": 1,
            "maximum": 16
        },
        "covIncrement": {
            "@type": "bacv:covIncrement",
            "type": "number",
            "minimum": 0
        }
    }  
}
            

Form terms

Vocabulary term Description Range Domain
bacv:usesService Indicates the BACnet service to use string

(one of "ReadProperty", "WriteProperty", "SubscribeCOVproperty")

td:forms
bacv:isISO8601 This data uses ISO8601 format boolean bacv:Sequence
bacv:hasBinaryRepresentation Points to the binary representation of the resource string

(one of "hex", "dotted-decimal", "base64")

bacv:OctetString
bacv:hasMember Member of a Sequence or List bacv:DataType bacv:Sequence, bacv:List
bacv:hasNamedMember Named Member of a Sequence or Choice bacv:NamedMember bacv:Sequence, bacv:Choice
bacv:hasFieldName Name of a Named Member of a Sequence or Choice string bacv:NamedMember
bacv:hasContextTags Context Tage for a Sequence or Choice boolean bacv:Sequence, bacv:Choice
bacv:hasMapEntry An value map entry mapping an Enumerated value to text bacv:ValueMapEntry bacv:ValueMap
bacv:hasLogicalVal Logical Value for a ValueMap integer or string or boolean bacv:ValueMapEntry
bacv:hasProtocolVal Protocol Value for a ValueMap integer bacv:ValueMapEntry
bacv:hasValueMap Value map for an Enumeration bacv:ValueMap bacv:Boolean, bacv:Enumerated, bacv:Unsigned, bacv:BitString

Mappings

This section describes the strategies and default values to use protocol specific concepts within the WoT Interaction model.

Default Operation Mappings

Operation Default Binding Variables and parameters
readproperty "bacv:service": "ReadProperty"
writeproperty "bacv:service": "WriteProperty" CommandPriority
observeproperty "bacv:service": "SubscribeCOVproperty" covIncrement
unobserveproperty "bacv:service": "SubscribeCOVproperty"
observeproperty "bacv:service": "SubscribeCOV" Note: BACnet driver must handle Status Flags
unobserveproperty "bacv:service": "SubscribeCOV"

Data type Mappings

BACnet Type WoT Data Schema
bacv:SequenceOf { "type": "array" }
bacv:Sequence { "type": "object" }
For the special case where a DateTime object is modeled as a Sequence "bacv:isISO8601": true:
{ "type": "string", "pattern": "pattern": "^((([1-9][0-9]*)?[0-9]{4})|\\*)-((1[0-2]|0[1-9])|\\*)-((3[01]|0[1-9]|[12][0-9])|\\*)T((2[0-3]|[01][0-9])|\\*):([0-5][0-9]|\\*):([0-5][0-9]|\\*)(\\.[0-9]+)?(Z|[+-]\\d\\d:\\d\\d)?$",, "$comment": "ISO8601 Date Time Format with optional wildcards" }
bacv:List { "type": "array", "uniqueItems": true }
bacv:Choice { "oneOf": [ { "type": "..." }, { "type": "..." }, { "...": "..." }, ]}
bacv:Date { "type": "string", "pattern": "^((([1-9][0-9]*)?[0-9]{4})|\\*)-((1[0-2]|0[1-9])|\\*)-((3[01]|0[1-9]|[12][0-9])|\\*)$", "$comment": "ISO8601 Date Format with optional wildcards" }
bacv:Time { "type": "string", "pattern": "^((2[0-3]|[01][0-9])|\\*):([0-5][0-9]|\\*):([0-5][0-9]|\\*)(\\.[0-9]+)?(Z|[+-]\\d\\d:\\d\\d)?$", "$comment": "ISO8601 Time Format with optional wildcards" }
bacv:WeekNDay { "type": "string", "pattern": "^((1[0-2]|0[1-9])|O|E|\\*)-(01|08|15|22|29|L7|B7|B14|B21|\\*)-([1-7]|\\*)$", "$comment": "Custom WeekNDay string: first part month 01-12, O for odd, E for even, * for any; second part week of month: beginning on 01st, 08th, the last 7 days, they days before last 7 days, last 14 days.., or any; third part day of week: 1-7 (Mon-Sun) or any" }
bacv:Unsigned { "type": "integer", "minimum": 0 }
bacv:Signed { "type": "integer" }
bacv:Real { "type": "number" }
bacv:Double { "type": "number" }
bacv:Boolean { "type": "boolean" }
bacv:Enumerated { "$comment": "Contains the possible enum members, as strings or integers", "enum": [] }
bacv:String { "type": "string" }
bacv:OctetString { "type": "string", "pattern": "^(([0-9A-F]{2}-?)+|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}={2}))$", "$comment": "Binary data encoded in hex, dotted decimal (e.g. IPv4 address) or base64" }
bacv:BitString { "type": "array", "items": { "$comment": "Contains the possible bit numbers", "enum": [] } "uniqueItems": true }
bacv:Any { "anyOf": [ { "type": "object" }, { "type": "array" }, { "type": "number" }, { "type": "string" }, { "type": "boolean" }, { "type": "null" } ]}
bacv:Null { "type": "null" }
bacv:ObjectIdentifier { "type": "string" "format": "iri-reference", "$comment": "BACnet Object Identifier is to be converted to an IRI, using the href schema of this protocol binding" }

Examples

This section will present a set of examples about how the terms defined in this document can be used to describe and configure a Form.

[[[#example-readproperty]]] shows the property with object type analog-input, object instance 1, and property identifier present-value in the scope of a BACnet device with device instance number 5.

{
    "@context": ["https://www.w3.org/2022/wot/td/v1.1",
    {
        "bacv": "https://example.org/bacnet"
    }],
    ...
    "properties": {
        "analog1": {
            "type": "number",
            "readOnly": true,
            "forms": [{
                "op": [ "readproperty" ],
                "href": "bacnet://5/0,1/85",
                "bacv:service": "ReadProperty"
            }]
        }
    }
}
{
    "@context": ["https://www.w3.org/2022/wot/td/v1.1",
    {
        "bacv": "https://example.org/bacnet"
    }],
    ...
    "properties": {
        "analog1": {
            "type": "number",
            "readOnly": true,
            "uriVariables": {
                "covIncrement": {
                    "@type": "bacv:covIncrement",
                    "type": "number",
                    "minimum": 0
                }
            },
            "forms": [{
                "op": [ "observeproperty" ],
                "href": "bacnet://5/0,1/85",
                "bacv:service": "subscribeCOVproperty"
            }]
        }
    }
}
{
    "@context": ["https://www.w3.org/2022/wot/td/v1.1",
    {
        "bacv": "https://example.org/bacnet"
    }],
    ...
    "properties": {
        "analog1": {
            "type": "number",
            "readOnly": true,
            "forms": [{
                "op": [ "observeproperty" ],
                "href": "bacnet://5/0,1/85",
                "bacv:service": "subscribeCOVproperty",
                "bacv:covIncrement": 0.2
            }]
        }
    }
}
Deploys by Netlify