BACnet Support

How can you implement BACnet with NodeRed?

How did you implement BACnet into NodeRed in Home Assistant?

What we did was use a iq vision machine (Trend) and then added the MQTT module to that. The box then sends all the topics for the various protocols it handles (MODBUS, Bacnet etc)

I’m tired of the restrictions placed on BACnet by the major TC vendors supplying building automation technology. The way some BAS contractors have implemented building BAS systems they purposefully hide BACnet from outside third parties. It’s also important to note that not all BAS vendors use BACnet too. However, my experience is that those that do use BACnet at their frontend products (JACE) are required to purchase a license that opens access to BACnet data. (Yes, I know building automation is not the usual place to discuss this topic.)

So I’m thinking of screen scraping existing BAS web content for real-time data. (I realize this effort might not be of much interest to those working with a few BACnet devices.)

Any interest?

I’ve been searching for reliable BACNet integration for Home Assistant for a while. My goal was to subscribe for COV and being able to write into other BACNet points such as setpoints or enable. I’ve got Siemens PXC controller which is pure BACNet.
My solution for the time being is by using two Node-Red modules:
node-bacnet-contrib-extended (node) - Node-RED (Reading points with COV Subscription, but this is quite limited and can’t do many points unfortunately)
node-red-contrib-bacnet (node) - Node-RED (Writing to points using BACNet command. Again, limited to few connections)

I am sending the data to Home Assistant over Node-Red’s integration.

The ideal solution would be a BACNet-MQTT gateway, but they are quite expensive. Although, I’ve found an interesting piece of software that can transfer the Raspberry Pi into a gateway. I’m talking about:

My biggest issue with it is that I don’t know how to set it up. Was wondering if any of you has used it in the past and could give me some hints on creating BACNet and MQTT device services in it.

Hey,

I wanted to share a little something I made.
It’s a BACnet add-on that can scan and detect devices on the local network. It’s pretty simple, but has a complementary integration that can display points as entities in the frontend.
It supports the most basic BACnet objects like Analog Input, Output, Value, etc.
The add-on is basically a Python script using the old BACpypes library, combined with FastAPI to allow it to be accessed from the outside. The integration will connect through a websocket and send data back and forth.
I didn’t have that many test opportunities yet, so I can’t guarantee it’ll function well.
The add-on repository can be added to your Home Assistant add-on store, and the integration can be installed locally. You’ll just have to add it manually (for now).
Branding of the add-on is because it’s made for Bepacom :grin:

BACnet addon

Just let me know if there’s any problems if you try. I’ll try to help fix it.

8 Likes

My client is going to hit the roof as he just forked out over £2k for a trend MQTT licence!!

This looks good, I will give it a go and let you know how I get on…

This is a great, very reliable and super easy to setup solution. Got it setup with some support on days and works just like a charm!

Guys, you must give it a try!

Great looking integration with all my devices listed out, but the only problem i have is the link to the API Docs just shows 403 forbidden with nginx underneath. Any help would be appreciated.

I just pushed an update that should fix this. The issue was that I didn’t know how to make docs appear through Home Assistant’s ingress. It’d always try to use the wrong IP address and not ingress. I made the add-on pull the ingress address from Home Assistant and now it’s using it internally as well. While testing for me it works.
Hopefully it’s fixed now for everyone!

Thanks very much for pushing the update through. It works well on my end, I’ve just got to work out how to subscribe to points and then make them entities.

Once again very cool and great work.

The add-on will automatically subscribe to your BACnet points. To make them entities, you’ll have to install the custom integration linked in the description of the add-on.

Fantastic work and thanks for the advice.
This should be part of the HA setup.
I managed to find all my 239 entities from 4 devices and create automation strategies from those.
I recommend this to anyone trying to integrate BACnet on their system.

Once again thank for your hard work.

1 Like

I’ve been looking for a way to integrate BACnet points into HA on and off for a while, and just started looking again yesterday and found this.
I didn’t seem to have a issue installing the add-on and the web interface comes up, but I don’t seem to be able to discover any devices.
I’ve also attempted to install the integration, but when I attempt to add it with the default 127.0.0.1 entry (or the IP of my HA installation) when submitting the reply is “Unknown error occured”.

This is the " Bepacom EcoPanel BACnet/IP Interface" debug log when:

  • starting,
  • sending a “whois” followed by “iam”
  • attempting to add the " Bepacom BACnet/IP Interface" integration using 127.0.0.1
  • sending a “whois”
  • attempting to add the " Bepacom BACnet/IP Interface" integration using 192.168.69.62
  • sending a “whois”
  • attempting to add the " Bepacom BACnet/IP Interface" integration using 127.0.0.1

sending a “WhoIs” to the network. one Item I see is that sticks out is that the address listed is 192.168.69.62/24, while this test network is/should be /22. I also saw if I tried to manually configure it with 192.168.69.62/22 the log would indicate the address of 192.168.69.62/22/24 (it shouldn’t affect anything in my case using /24 and not /22 as all devices fall in the /24 range.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-interface: starting
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
[14:26:18] INFO: Running NGINX
[14:26:18] INFO: Generating BACpypes.ini
2023/06/08 14:26:18 [notice] 58#58: using the "epoll" event method
2023/06/08 14:26:18 [notice] 58#58: nginx/1.24.0
2023/06/08 14:26:18 [notice] 58#58: OS: Linux 6.1.29
2023/06/08 14:26:18 [notice] 58#58: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816
2023/06/08 14:26:18 [notice] 58#58: start worker processes
2023/06/08 14:26:18 [notice] 58#58: start worker process 78
Using enp2s1 with 192.168.69.62...
[BACpypes]
objectName: EcoPanel
address: 192.168.69.62/24
objectIdentifier: 420
maxApduLengthAccepted: 1024
segmentationSupported: segmentedBoth
vendorIdentifier: 15
foreignBBMD: -
foreignTTL: 255
maxSegmentsAccepted: 24
loglevel: DEBUG
defaultPriority: 15
s6-rc: info: service init-interface successfully started
s6-rc: info: service interface: starting
s6-rc: info: service interface successfully started
s6-rc: info: service discovery: starting
[14:26:19] INFO: Running interface
Traceback (most recent call last):
  File "/usr/bin/main.py", line 183, in <module>
    main()
  File "/usr/bin/main.py", line 158, in main
    this_application = BACnetIOHandler(this_device, args.ini.address)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/BACnetIOHandler.py", line 171, in __init__
    BIPSimpleApplication.__init__(self, *args)
  File "/usr/local/lib/python3.11/site-packages/bacpypes/app.py", line 535, in __init__
    self.mux = UDPMultiplexer(self.localAddress)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bacpypes/bvllservice.py", line 102, in __init__
    self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True)
DEBUG:      Using selector: EpollSelector
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bacpypes/udp.py", line 155, in __init__
    self.bind(address)
  File "/usr/local/lib/python3.11/asyncore.py", line 331, in bind
    return self.socket.bind(addr)
           ^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 99] Address not available
INFO:     Started server process [144]
INFO:     Waiting for application startup.
[14:26:24] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface'
[14:26:24] INFO: Successfully send discovery information to Home Assistant.
s6-rc: info: service discovery successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:7813 (Press CTRL+C to quit)
INFO:     172.30.32.2:0 - "GET /apiv1/command/whois HTTP/1.0" 200 OK
INFO:     172.30.32.2:0 - "GET /apiv1/command/iam HTTP/1.0" 200 OK
INFO:     None:0 - "GET /apiv1/json HTTP/1.0" 200 OK
2023/06/08 14:26:58 [error] 78#78: *6 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "192.168.69.62"
2023/06/08 14:26:58 [error] 78#78: *7 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.232.1"
2023/06/08 14:26:58 [error] 78#78: *8 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.32.1"
INFO:     None:0 - "GET /apiv1/json HTTP/1.0" 200 OK
2023/06/08 14:27:01 [info] 78#78: *1 client 172.30.32.2 closed keepalive connection
INFO:     172.30.32.2:0 - "GET /apiv1/command/whois HTTP/1.0" 200 OK
2023/06/08 14:27:19 [info] 78#78: *4 client 127.0.0.1 closed keepalive connection
INFO:     None:0 - "GET /apiv1/json HTTP/1.0" 200 OK
2023/06/08 14:27:19 [info] 78#78: *6 client 192.168.69.62 closed keepalive connection
2023/06/08 14:27:19 [error] 78#78: *14 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "192.168.69.62"
2023/06/08 14:27:19 [info] 78#78: *7 client 192.168.69.62 closed keepalive connection
2023/06/08 14:27:19 [error] 78#78: *15 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.232.1"
2023/06/08 14:27:19 [info] 78#78: *8 client 192.168.69.62 closed keepalive connection
2023/06/08 14:27:19 [error] 78#78: *16 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.32.1"
2023/06/08 14:27:33 [info] 78#78: *10 client 172.30.32.2 closed keepalive connection
2023/06/08 14:27:41 [info] 78#78: *12 client 127.0.0.1 closed keepalive connection
2023/06/08 14:27:41 [info] 78#78: *14 client 192.168.69.62 closed keepalive connection
2023/06/08 14:27:41 [info] 78#78: *15 client 192.168.69.62 closed keepalive connection
2023/06/08 14:27:41 [info] 78#78: *16 client 192.168.69.62 closed keepalive connection
INFO:     172.30.32.2:0 - "GET /apiv1/command/whois HTTP/1.0" 200 OK
INFO:     None:0 - "GET /apiv1/json HTTP/1.0" 200 OK
2023/06/08 14:27:55 [error] 78#78: *21 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "192.168.69.62"
2023/06/08 14:27:55 [error] 78#78: *22 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.232.1"
2023/06/08 14:27:55 [error] 78#78: *23 access forbidden by rule, client: 192.168.69.62, server: , request: "GET /apiv1/json HTTP/1.1", host: "172.30.32.1"
INFO:     None:0 - "GET /apiv1/json HTTP/1.0" 200 OK

HA has cnanged so many times but I’m pretty sure I’m running HA OS, its running as a standalone VM on a ESXi host:

Home Assistant 2023.6.0
Supervisor 2023.06.1
Operating System 10.2
Frontend 20230607.0 - latest

I’ve scanned/watched for messages from it (wireshark & BACnet discovery tools) and haven’t seen any traffic yet so I think its likely a config issue on my side, just not sure where to start. Discovery searches from tools detect the hardware devices on the network, and they detect the discovery tools, HA unfortunately is still sitting in the dark.

Any ideas where to start looking?
Thanks in advance.

+1 on this, BACnet wide use in BMS, but it rare in consumer product. But HA should support it.

Can you tell me the name and model of you BACnet controller?

Hi we are using many different types of BACNet devices, but the main ones are:

IQ4E Controller by Trend Control Systems Ltd (part of Honeywell)
SIP+ Controller by Synapsys Solutions Ltd
iSMA-B-MIX18-IP by Global Control 5 S.A.
Various Tridium JACE models running Niagara BACNet Drivers

Hope it helps you.

1 Like

By default the detected IP will be suffixed by /24, if your IP is /22 then you’ll have to add this manually. This has to do with the broadcast address of the network. With /24 while your network is /22 you probably won’t detect anything. Once you see devices appear on the add-on, the integration should work as well. Before anything other than /24 wouldn’t work, but it should now. Please try it again and let me know if this works.

+1 for BacNet integration being more mainstream in HA too

Just came across this video from 8 days ago talking about MKs new connected sockets. Currently very expensive but looks like a big development in the commercial works that could benefit the household one…

1 Like

Hey, I did manage to impelent BACnet with node-red.

First I used to do it with nodes that needed a per-node configuration, in my last effort I managed to do so with one node that handles all of the write actions with payload input on the node itself. I found a old nmp project that needed some modification and created an set of custom nodes that work and take a non complicated JSON object to send the data to the device (which you also define in the JSON).

The set of nodes is a bit messy under the hood, but if there’s still demand for a simple yet flexible BACnet integration I’m willing to clean up the code and make it even simpler.

If you’re interested please send me a message through the forum or github (CervezaStallone (Brian Rodriguez) · GitHub)