Skip to content
ISO 16484-5, Annex J

BACnet/IP

The standard protocol of building automation: HVAC, lighting, access control and energy metering.

Transport
UDP over IPv4
Default port
47808
Library
go-bacnet
CLI
bacnetctl

BACnet is the standard protocol of building automation (ISO 16484-5). Each device holds objects (analog inputs, binary outputs, schedules, trend logs and more), and each object has properties such as its present value, units and status. BACnet/IP (Annex J) carries it over UDP port 47808, with BBMDs and routers joining networks across subnets.

Where you meet it

  • HVAC controllers, chillers, air handlers and VAV boxes
  • Lighting, access control and fire panels
  • Building energy meters and building management systems (BMS)

Quickstart

From the command line

Install bacnetctl with curl -fsSL https://get.otfabric.io/bacnetctl | sh, or on Windows irm https://get.otfabric.io/bacnetctl.ps1 | iex (all install options), then:

Terminal window
# Which devices are on this network?
bacnetctl discover
# Its point list: every object with value, unit, status and description
bacnetctl objects --device 192.168.1.20 --values
# One value
bacnetctl read --device 192.168.1.20 analog-input:1 present-value
# Watch two points change, until Ctrl-C
bacnetctl monitor --device 192.168.1.20 analog-input:1 binary-input:3
# Override a setpoint at operator priority, then hand it back
bacnetctl write --device 192.168.1.20 analog-value:1 present-value 22.5 --priority 8
bacnetctl release --device 192.168.1.20 analog-value:1 --priority 8

Objects are written as type:instance (analog-input:1, or ai:1) and properties by name (present-value, or pv).

No controller at hand? bacnetctl server run serves a simulated device to practise on, from a JSON device file or a built-in example:

Terminal window
# Terminal 1: the example device on loopback, every write printed as it happens
bacnetctl server run --listen 127.0.0.1
# Terminal 2: use it like any device
bacnetctl objects --device 127.0.0.1 --values

From Go

Terminal window
go get github.com/otfabric/go-bacnet@latest

Discover devices and print their names:

main.go
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/otfabric/go-bacnet"
"github.com/otfabric/go-bacnet/client"
)
func main() {
c, err := client.New() // binds UDP port 47808
if err != nil {
log.Fatal(err)
}
defer c.Close()
ctx := context.Background()
devices, err := c.Discover(ctx, client.DiscoveryOptions{Window: 3 * time.Second})
if err != nil {
log.Fatal(err)
}
name := bacnet.PropertyReference{Identifier: bacnet.PropertyObjectName}
for _, d := range devices {
val, err := c.ReadProperty(ctx, d.Target(), d.DeviceID(), name)
if err != nil {
fmt.Printf("device %d at %s: %v\n", d.Instance, d.Address, err)
continue
}
fmt.Printf("device %d at %s: %s\n", d.Instance, d.Address, val.Character.Value)
}
}

Serve a device of your own, with a commandable setpoint:

device.go
dev, err := object.NewDevice(object.DeviceConfig{Instance: 1234, Name: "dev-1234", VendorID: 999})
if err != nil {
log.Fatal(err)
}
av, err := object.NewAnalogValue(object.PointConfig{Instance: 1, Name: "setpoint", Units: 62, Value: 21, Commandable: true})
if err != nil {
log.Fatal(err)
}
if err := dev.Add(av); err != nil {
log.Fatal(err)
}
s, err := server.New(dev) // binds UDP port 47808
if err != nil {
log.Fatal(err)
}
defer s.Close()
_ = s.IAm()
// The application owns its values; COV subscribers are notified.
_ = av.SetPresentValue(bacnet.RealValue(22))

The imports are github.com/otfabric/go-bacnet, github.com/otfabric/go-bacnet/server and github.com/otfabric/go-bacnet/server/object. A complete device that runs until interrupted is in examples/server.

What go-bacnet supports

Roles Client, and server: a BACnet device of your own with its objects, optionally also the BBMD of its subnet
Transport BACnet/IP (Annex J) over IPv4, routed networks, foreign-device registration, segmentation in both directions
Client services Who-Is / I-Am discovery, read and write properties, COV and alarm notifications, file transfer, object management
Server Device, analog, binary and multi-state points, Notification Class, Trend Log, File, Calendar, Schedule, CharacterString, Integer and Positive Integer Value, Structured View; reads and writes, COV, intrinsic reporting and the alarm services, ReadRange, files, object creation and deletion, device management
Dependencies Go standard library only
Go version 1.26 or later

Interoperability

bacnet-interop provides Dockerized devices from BACnet Stack (C), BACpypes3 and legacy BACpypes (Python), BACnet4J (Java), System.IO.BACnet (C#), Worldiety, cB-Sigma and ulbios (Go) and @bacnet-js/client (TypeScript), including BBMD and routed-network scenarios and cB-Sigma’s simulator with fault switches. Since v0.12.0 the BACnet Stack, BACnet4J and BACpypes3 images also run as clients, and v0.14.0 added legacy BACpypes, bacnet-js and ulbios in both roles, with scenario files for testing a BACnet server: discovery, reads and writes, COV, files, alarms, device management, segmentation and the BBMD. Since v0.15.0 it also publishes go-bacnet as an image, as a device and as a client, for others to test against.

OT Fabric projects for BACnet/IP

go-bacnet

BACnet/IP client and server: discovery, properties, COV and alarms, routed networks and foreign-device registration on the client; a device of your own with its objects, intrinsic reporting and an optional BBMD on the server.

go get github.com/otfabric/go-bacnet

bacnetctl

Discover BACnet devices, list point lists, read, write at priority, monitor COV and inspect alarms, or serve a simulated device from a JSON file to test clients against.

bacnet-interop

BACnet/IP reference devices: BACnet Stack, BACpypes3, legacy BACpypes, BACnet4J, System.IO.BACnet, Worldiety, cB-Sigma, ulbios and bacnet-js, with cB-Sigma's simulator for faults. Six of them also run as clients to test a BACnet server, and go-bacnet is published as an image for others to test against.

Who is behind BACnet/IP

The organizations that publish, test, certify or host open-source work for BACnet/IP. Listed for reference, not as partners. Compare membership and fees.