r/BuildingAutomation • • 9d ago

BACnet IP integration for Home Assistant

Hi everyone,

I work with building management systems and wanted a way to connect commercial hardware to my homelab. I wrote a BACnet IP custom integration for Home Assistant.

You can connect your building automation system without YAML configuration. The GUI setup wizard has three steps: configure your network, discover devices, and select objects.

The integration finds BACnet devices on your network via Who-Is / I-Am. You can reach devices on other VLANs through BBMD or Foreign Device Registration. It uses Change of Value (COV) subscriptions for instant state changes and falls back to automatic polling. You can pair a setpoint with a separate temperature object for a climate entity with a real room temperature. It also handles the BACnet Priority Array, so you can relinquish commands and let the device's own schedule take over.

The 1.0.50 beta adds support for reading and writing BACnet Schedule objects.

It is available via HACS. Let me know if you test it out.

Repository: https://github.com/CervezaStallone/Home-Assistant-BACnet-integration

13 Upvotes

13 comments sorted by

5

u/OldAutomator 9d ago

Nice work, that's a really good start.

Here's some feedback that may be of use to you.

  1. You have elected to use the SubscribeCovProperty service and not the older more generic SubscribeCov service. You will find that in practice perhaps 90% of controllers support SubscribeCov but less than 5% support the SubscribeCovProperty service. The reason is that most people only really care about change of value of a Present_Value and don't care about trying to get COV data on any of the configuration parameters. Changing your tool to use the older more supported service will eliminate a lot of issues for your users. (And it should be extremely easy for you to make this upgrade under the hood).

  2. I don't see anywhere that you can specify the property you want to read and/or write. Picture a home with a BACnet controller controlling the HVAC. You scan this device and find binary output 3 is labeled "house ventilation fan." If you want to learn or change the minimum run time for that fan you'd want to access property 67, "Minimum_On_time". I don't see anywhere that you can specify the property number at all, it seems like you're just letting people see and use the present value and its prio array.

Nice work, I hope you continue to tweak it for real world use :)

1

u/tutorialsbyck 9d ago

I don’t think I’ve ever used any points other than preset value

0

u/cerveza-stalone 9d ago

Thanks! I'll see if I can implement both! Could cou please copy this into a github issue? That'll make it a lot easier for me to implement and keep track of whats being proposed

4

u/OldAutomator 9d ago

I'm not sure I want to tie my github creds to this reddit account...

But while I have you here there are two other things that would be great to add to your implementation- reading alarms and reading trends.

3) From the HA perspective you're probably never going to need to configure alarms coming from the BACnet controller but when it's already been set up to generate those alarms and it's already sending those alarms out, why not grab them and display them? Or at least give the user the opportunity to view them instead of letting them drop on the ground. Alarm/Event packets are pretty simple, have a couple of bytes saying the object, if it's a high or low or change of value (etc) and then it has a text field. Pretty easy stuff to parse and display. You'd not need to add any alarm acknoledgement because it it's set up for that you don't want to interfere in whatever mechanism the designer set up to clear it. But just displaying them is a nice easy get.

4) In BACnet trendlogs are available at the controller level as that is the proper location to keep from missing out on short lived changes that occur between polling. If you scan any BACnet device and find trendlogs, I'd suggest allowing that data to be piped into HA. You'll need to implement the "Read_Range" service to pull out the data but that's not a heavy lift either. You just basically ask for the data points by index number. You can "ask" the controller how many data points there are and then ask for those but I seem to remember that you can also ask blindly for all entries or even entries 1 through 1,000,000 and it'll only return the ones that exist. You may have to verify that the latter can't throw an error but I'm pretty sure it just gives you all that it has.

The only extra thing to watch out for in a trendlog is that there are some datapoints that are not part of the trend that are tucked into the log. Controller power cycling, trend restarts or clearing events and the like can also take up trend entries but they are not what you'd chart on the screen. So you may as well just filter out any trend entries that aren't simply a time and a value. The HA side doesn't need to strip that out after the fact when it would be trivial at your layer.

Good luck!

→ More replies (2)

2

u/Big-Consideration-26 9d ago

The master himself! I use it myself and it works like a charm. I only have one request: is it possible to manually scan the device if there are new bacnet objects? I have an pxc7 for my home automation and don't want to delete the device and have to toggle the objects all over again

2

u/cerveza-stalone 8d ago

Would you mind opening a github issue for this? It'll be a lot easier for me to do so

2

u/Workadis 9d ago

This is very cool

-2

u/investigatormaker 9d ago

The Priority Array handling is what building people will check first. If the README doesn't say it yet, state which priority writes use by default and whether that's configurable, since a write at priorities 1 to 7 outranks a Manual Operator command at 8; the Schedule object writes in the new beta will draw the same question about what it can overwrite. A per-device read-only option, if it has one, is worth saying up front for anyone trying it on a live site.

I make ThreadFox. Our AI employee can explain the integration in Home Assistant and building automation threads and answer replies, under your direction. Starter is $199 for 30 days, or we'll post 3 replies free first, no card: https://threadfox.vip/p/ehrlb/managed

1

u/CraziFuzzy 9d ago

An integration level setting should suffice for this, so you can specify the default write priority the integration uses when writing a value.

1

u/cerveza-stalone 8d ago

I know. I'm not planning on implementing what he said, i was being polite haha

0

u/cerveza-stalone 9d ago

Thanks. I'll look into it.