# Bitpool Edge BACnet

## **Getting Started**

This is a standard Node.js module developed specifically to function within the Node-RED ecosystem.

## **How to Use**

Use the following procedure to install this module to your Node-RED instance, or download the pre-themed [Bitpool-Edge Docker](https://wiki.bitpool.com/bitpool-edge/bitpool-edge-installation) image that contains all our favourite nodes pre-installed.

### **Bitpool-Edge Install**

1. Log into your Bitpool-Edge instance and click the `Hamburger` icon, in the top-right corner.
2. Select `Manage Palette` from the drop down menu then click the `Pallete->Install` tabs to install.
3. Using the search bar type `@bitpoolos/edge-bacnet` and install the module once displayed.
4. Finally, use the left most navigation menu to scroll down to the heading `Bitpool BACnet` to reveal available nodes

### **Docker Install** :whale:

This BACnet module and many other Bitpool developed nodes have been pre-installed for your convenience in a Bitpool themed Node-RED application.

Go here for how to [install Bitpool-Edge](https://wiki.bitpool.com/bitpool-edge/bitpool-edge-installation).

### **BACnet Nodes**

The edge-bacnet library of nodes is broken down into 4x functional blocks.

![](https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2F3IcJwdOsNzwf2tTy8Md2%2Fimage.png?alt=media\&token=c9b8152a-3525-4954-be8d-cbb7ffe576ef)

**Gateway**

The main component to the BACnet node collection. This node contains the interface to the node-bacnet package. All Read and Write nodes must link into the gateway. The gateway node also contains all network properties, to be configured by the user.

*Please note*: any property changes to the Gateway node currently requires a Node-RED **restart**.

There are 3 tabs on the gateway node:

*Gateway Tab*

* Network Interface - the desired interface for the BACnet client to bind to. This interface must not have any other BACnet clients bound to it.
* Broadcast Address - the desired subnet for global msgs to be broadcast and received on. This should be as strict as possible. Use 255.255.255.255 if unsure.
* Local Device Port - the port to be used for BACnet comms. Default is 47808
* Device ID - the Device ID the node itself would use if the Server is enabled. Ie: if the server is enabled, and a foreign device were to execute a discovery, that is the ID it would see for this node.
* Device ID range - a filter range for discovering other devices. &#x20;

*Discovery Tab*

* APDU Timeout - BACnet msg timeout option
* Max APDU Size - BACnet max apdu size
* Max Segments - BACnet max segments
* Number of Retries - The amount of retries the node will do if an error is found while fetching a foreign point list.&#x20;
* Global Discover Frequency - the frequency at which the gateway issues global WhoIs BACnet commands. This should be limited to the least amount possible, as over-loading a network can be a serious issue with BACnet commmunications.
* Manual Point Discovery Instance Range - if a BACnet device doesnt have a Object list (BACnet objectType:propertyId - 8:76), the this bacnet client will enter into manual discovery mode, where it iterates through types and instnace ranges. This range can be used to limit this manual scanning
* Log Device Found - toggles logging of found devices to the node-red debug tab.
* Log BACnet Errors to Console - toggles logging of BACnet related errors to the node-red console
* Device List - Import / Export. The Import option allows the user to import a JSON model for the node to use. The Export option exports the currently active model in JSON format.

*Server Tab*

This section provides the ability to simulate a BACnet device and BACnet points using node-red.

Injecting a msg.topic and msg.payload into the gateway node will create a virtual point that can be discovered by other devices via BACnet/IP

This node only supports 2 BACnet object types, Analog Value - to show numeric data, and a Character String - to show string data.

* Enabled - toggles whether or not the local BACnet server is started or not.
* Reinitialize Server - a button that completely clears the server and associated points

**Read**

The node that handles point and property selection for reading operations. The node is split up into 3 tabs:

1\. Device List - used to select points / devices to add to the read list,       &#x20;

2\. Read List - list of selected points / devices.       &#x20;

3\. Properties - the point properties to be read from the points in the read list.

**Write**

Much like the read node, this node handles point and property selection for writing operations. The node is split up into 3 tabs:

1\. Device List - used to select points / devices to add to the write list.    &#x20;

&#x20;2\. Write List - list of selected points / devices.       &#x20;

3\. Properties - the operation property's for the write command. Configuring the receiving BACnet device and setting            these properties are critical for a sucessfull write operation.

**Inject**

An extension of the Node-RED Inject node. It contains all of the standard inject node functionality, with 2 added buttons for a improved user experience. The buttons add a command to the msg object, which can instruct the Read, Write, or Gateway nodes, to either:

1\. Poll - invokes a Read or Write operation. A inject node with the Poll option must link into a Read or Write node.       &#x20;

2\. Discover - invokes a BACnet global WhoIs broadcast on the specified broadcast address. A inject node with the Discover option must link into a Gateway node.

### **Examples**

**Video walk-through**&#x20;

{% embed url="<https://youtu.be/4K7mVxfvfbc>" %}

Here are some examples and scenarios that could potentially be used with the edge-bacnet node.

**Read and Write**

*A flow with all of the BACnet read and write provided features*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FVU44eJtNBOwuIErhBQwd%2Fimage.png?alt=media&#x26;token=dd609535-521e-4842-a74b-5027ff06bd8c" alt=""><figcaption></figcaption></figure>

*Inject node used for Polling*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FgmIZqBoAjkh0oIoRXlby%2Fimage.png?alt=media&#x26;token=71f95e53-2cac-4aa3-8f80-19740aaa843e" alt=""><figcaption></figcaption></figure>

*Inject node used for Discovery*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FKWhhNlXkTxYXq2ateDVc%2Fimage.png?alt=media&#x26;token=5357219f-248f-4a9f-8c65-13323d44c8e3" alt=""><figcaption></figcaption></figure>

*Read node action buttons*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FLOXlvquLDcLQkkxYTHkl%2Fimage.png?alt=media&#x26;token=29c6e1bf-7d70-4125-9166-5cdd831cefab" alt=""><figcaption></figcaption></figure>

Add All Devices - this action adds all of the devices listed on the Device List tab to the Read List

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FUdiSnWpGuZjFUC8iCKAK%2Fimage.png?alt=media&#x26;token=cc3d9a37-2f4c-4dac-b6dc-c37d8ab562b6" alt=""><figcaption></figcaption></figure>

Refresh Device List - this action refreshes the list

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2F88csvKEeHnb8yeYgNEzB%2Fimage.png?alt=media&#x26;token=176c6631-ba4f-460f-a4a3-f9552de791a6" alt=""><figcaption></figcaption></figure>

Clear Data model: - this action deletes and resets the bacnet data model. The user must wait for the node to construct the site model after selecting this button.

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FtHLJzwsZIYySU4N5V4sb%2Fimage.png?alt=media&#x26;token=42eb4d70-6261-4b9c-8827-1c00709830a2" alt=""><figcaption></figcaption></figure>

*Example Gateway configurations*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FO9209SvAHQqSYra75uGk%2Fimage.png?alt=media&#x26;token=70cf5e8a-9f08-474a-92c5-defac0dba087" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FPULoumZrZ7bJdFLOZxpT%2Fedge-bacnet-discoverytab.JPG?alt=media&#x26;token=1b1c10bf-01b6-4966-8f01-f0bcca88c6cb" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FiUjmnaAXnRw6J0ZKLmH8%2Fedge-bacnet-servertab.JPG?alt=media&#x26;token=57b8770c-979f-4299-b473-7aadae1789ab" alt=""><figcaption></figcaption></figure>

**BACnet Server**

*MQTT to BACnet*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2F0zOBTzAm5qgL5IsKaOSj%2Fimage.png?alt=media&#x26;token=18b2c0a3-f598-413b-a64c-f430cae5eed5" alt=""><figcaption></figcaption></figure>

*Function generated data*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FqNDQzYheUcl4Cem9uN8n%2Fimage.png?alt=media&#x26;token=3dbf2606-b9e9-4665-a2fa-cd2b5e166bfa" alt=""><figcaption></figcaption></figure>

*Contents of previous function*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FDwKy8AWq9kkNJnMdtOOO%2Fimage.png?alt=media&#x26;token=15a11056-5e84-4e08-a48f-4217d5cc6311" alt=""><figcaption></figcaption></figure>

*Yabe view of function generated BACnet data*

<figure><img src="https://3902784585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28eeWKJBGNSvwO7hWa0f%2Fuploads%2FQdQUsOA4nT6ww3LcVsuI%2Fimage.png?alt=media&#x26;token=8f83ac87-e4e3-4d89-b42c-4bc192e5558f" alt=""><figcaption></figcaption></figure>

### **Further Information**

Now that your Bitpool-Edge is up and running, we have included simple examples flows to demonstrate how to create a basic solution.

1. Log into your Bitpool-Edge instance and click the `Hamburger` icon, in the top-right corner.
2. Select `Manage Palette` from the drop down menu then click the `Import->Examples` tabs to see this node.
3. Navigate the ‘Examples flows’ tree and select `@bitpoolos/edge-bacnet` to reveal the preconfigured examples.
4. Click the example you would like to test the click the `Import` button.
5. Place the example nodes on a flow and review the configuration of each node. You will need to make suitable changes for your system.
6. Finally, click `Deploy` to test.

> Additionally, there is basic helper documentation on each node. Just select a target node and click the `Help` tab found at the top right corner of Bitpool-Edge.
>
> **Hint** *- the icon looks like a book!*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.bitpool.com/bitpool-edge/connectors/bitpool-edge-bacnet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
