CREATE A CONNECTION TO YOUR BACNET SERVER
Access to MQTT Broker
To do this step, refer to the MQTT documentation
Creating a BACnet Adapter Node with Node-Red
Now that you have access to your MQTT broker, let's create the Node-RED flow to connect your MQTT broker to your BACnet server. Essentially, all messages are exchanged via your MQTT broker, and we’ll use Node-RED to handle these messages and interact with the BACnet server.
Step 1: Create an MQTT Input Node
- Drag an "mqtt in" node from the palette onto your Node-RED workspace.
- Double-click the node to configure it.
- Fill in the connection details for your MQTT broker (click on the pen next to the server input):
- Server: Enter the broker address, e.g.,
mqtt-eco.thingpark.com
depends on which platform you logged in but you can find the hosts above. - Port: Use the associated server port, e.g.,
8883
- Use TLS: Check this option and configure the TLS settings if necessary.
- Protocol: Choose
MQTT V3.1.1
. - Client ID: Leave this field empty to auto-generate a unique ID.
- Keep Alive: Set it to
60
. - Session: Check the option to "Use a clean session" for a fresh connection each time.
- Server: Enter the broker address, e.g.,
Refer to the screenshot below for a visual guide:
- In the "Security" tab, enter your MQTT broker credentials. As mentioned above, you can choose any username, but make sure to enter your apiKey as the password.
- Finally, select your server and specify the topic you want to subscribe to in the "Topic" field:
- Click Done to save the configuration.
Step 2: Test the MQTT Connection
- Deploy your flow in Node-RED.
- Check the debug console to ensure that the "mqtt in" node is successfully connected to your broker. You should also see a green square under the "mqtt in" node, indicating that the connection is active. Once connected, you should start receiving messages from the broker.
Step 3: Add Actility BACnet adapter node
-
Download the adapter.tgz folder by clicking here
-
Import it in your palette, click on "Manage palette", go to install tab and click on the import icon to drop your .tgz folder.
-
Then you should see on your palette that you have the "bacnet-adapter" node available. Drag the node from the palette onto your Node-RED workspace.
- Connect the output of the "mqtt in" node to the input of the "bacnet-adapter" node to link them together. This connection allows messages received from the MQTT broker to be processed by the BACnet adapter. Basically the bacnet-adapter is already set up but you can still configure it.
Specificities of bacnet Adapter
Double-click on your bacnet adapter to see the settings.It's divided in two tabs : Server properties and Object mapping.
Server properties
- Name: Specifies the name of the BACnet adapter in your node-red flow.
- Port (hex): Defines the hexadecimal port number used for BACnet communication. The default is
BAC0
. - Broadcast: Indicates the broadcast IP address used for sending messages to all devices in a BACnet/IP network. In this example, it is set to
255.255.255.255
, which is a global broadcast address. For more efficient communication, this can be set to a specific subnet's broadcast address (e.g.,192.168.1.255
for a/24
subnet). - Device ID: A unique identifier for the BACnet device. Here, it is set to
817001
. - Device Name: Descriptive name for the BACnet device, such as
BACnet Adapter
. - Vendor ID: Identifies the vendor of the BACnet device.
0
is used when no specific vendor ID is assigned. - Device ID: A unique identifier for the BACnet device. Here, it is set to
817001
. - Device Name: Descriptive name for the BACnet device, such as
BACnet Adapter
. - Vendor ID: Identifies the vendor of the BACnet device.
0
is used when no specific vendor ID is assigned. - Vendor Name: Field reserved for the vendor's name, left empty in this example.
Object Mapping
-
Object Name: Dropdown menu to select the name of the object to map. For example, it can be set to
Device Name
to link BACnet objects to specific device identifiers. The second option isDevice EUI
-
LoRaWAN Metadata: A set of optional checkboxes to include metadata from LoRaWAN in the object mapping:
- RSSI: Received Signal Strength Indicator.
- SNR: Signal-to-Noise Ratio.
- FCntUp: Frame counter for uplink messages.
- SpFact: Spreading factor used in LoRaWAN communication.
-
Export BACnet Object List: Checkbox to enable the export of the object list as a CSV file. This feature allows you to review the BACnet object list, even if you don't have a BACnet client. It is particularly useful to verify that all MQTT messages have been successfully converted into BACnet objects by the server.
-
Import Custom Object List: Button to import a custom object mapping configuration from an external CSV file (BACnet Objects).
-
Clear Object List: Button to clear the current Object list.
To deploy your Node-RED workflow, click the Deploy button. At this point, it is a good practice to restart the Raspberry Pi device, as all installation, customization, and programming tasks have been completed. To do so, run the following command:
sudo reboot
The Raspberry Pi will reboot and be ready within a few minutes. Your Node-RED workflow will start automatically, as Node-RED was configured as an autostart process in the previous steps.
Displaying information to know if it worked
YABE (Yet Another BACnet Explorer) is an open-source tool designed to explore, test, and debug BACnet/IP networks.
Why Use YABE?
- Network Discovery: YABE enables you to discover BACnet devices on an IP network.
- Property Read/Write: It allows querying and modifying object properties on BACnet devices.
- Testing and Debugging: YABE helps diagnose issues in a BACnet network by providing detailed insights into device communication and properties.
- User-Friendly: The tool features an intuitive interface, making it accessible even for users new to BACnet.
YABE is a powerful and lightweight solution for both beginners and advanced BACnet users, facilitating effective interaction with BACnet devices.
How to Install YABE
Step 1: Download YABE
YABE is available for free on SourceForge
Step 2: Extract the Files
- The downloaded file is typically a compressed archive (e.g.,
.zip
). - Extract the contents to a folder on your computer.
Step 3: Install Required Dependencies
YABE requires the following:
- .NET Framework 4.0 or higher: Ensure that your system has the correct version installed. You can download the latest .NET Framework from Microsoft's official site.
Step 4: Launch YABE
- Navigate to the extracted folder.
- Run
Yabe.exe
to start the application.
If you are using Linux, follow these steps to install and run YABE:
- Install the
mono-complete
package:sudo apt install mono-complete
- Navigate to the folder where you extracted YABE and to run it use the mono command:
mono ./Yabe.exe
This will launch YABE on your Linux system.
How to Use YABE
Once YABE is installed and ready, follow these simple steps to explore your BACnet devices and objects:
-
Add a Device:
- Open YABE and click on the "+" icon to add a new device.
- This will open a configuration window where you can specify the connection details.
- Open YABE and click on the "+" icon to add a new device.
-
Configure the BACnet Connection:
- Enter the BACnet Port (e.g.,
47808
, which corresponds toBAC0
in hexadecimal) and the server address of your BACnet device. - Note: You can use
0.0.0.0
as the server address. This works because YABE scans all devices within the same IP segment. However, if you have multiple servers, it is recommended to specify the exact IP address of the BACnet server to avoid ambiguity. (you have to be in the same network as your BACnet server to do that, it's UDP protocol so be sure that your firewalls won't block you) - Confirm the settings to establish the connection.
- Enter the BACnet Port (e.g.,
-
View the Device List:
- Once the connection is established, YABE will display a list of detected devices in the format
udp:XXX
(whereXXXX
represents the BACnet port that your entered before). - Double-click on your device from the list to access its associated BACnet objects.
- Once the connection is established, YABE will display a list of detected devices in the format
-
Explore BACnet Objects:
- After selecting your device, YABE will display the list of BACnet objects available on the server.
- On the right-hand side, if you click on one sensor, you will see detailed data associated with each object, such as properties, current values, and additional metadata.
- After selecting your device, YABE will display the list of BACnet objects available on the server.
Limitations
As far as we know, there is no limitations to the BACnet connection