Skip to content

bacnetctl

bacnetctl is a standalone BACnet/IP command-line client built on go-bacnet. It discovers devices, reads and writes properties, lists objects, watches values with change of value (COV), reads alarms, trend logs and files, shows routers and BBMDs, and decodes captured frames offline. With server run it also serves a simulated BACnet/IP device, on go-bacnet’s server, for developing and testing clients without hardware. Output is text, a table or JSON, with stable exit codes. This page follows bacnetctl v0.7.0, built on go-bacnet v0.8.0. Since v0.6.0 trend also reads Trend Log Multiple objects (one value per logged property) and Event Logs (each record an event notification), and since v0.7.0 it receives the oversized segments legacy BACpypes sends.

Terminal window
curl -fsSL https://get.otfabric.io/bacnetctl | sh

Binaries for Linux (x86-64, ARM64, ARMv7), macOS (Intel, Apple silicon) and Windows (x86-64, ARM64). The installer checks the release's SHA-256 checksum, installs per user without sudo (~/.local/bin, on Windows %LOCALAPPDATA%\OTFabric\bin) and upgrades in place when you run it again. Pin a version with OTF_VERSION; the CI line installs into a fixed directory without touching PATH or shell profiles. All installer options, release archives for offline machines. Check the install with bacnetctl version.

Shell completion covers commands, object types, property names and flag values:

Terminal window
bacnetctl completion bash | sudo tee /etc/bash_completion.d/bacnetctl > /dev/null

There is no connection in BACnet/IP: bacnetctl opens one UDP socket per invocation and addresses a device by where it is. The device instance is not needed.

Flags Addresses
--device host[:port] The device at that IPv4 address or host name; port 47808 when omitted
--device router[:port] --network N --mac HEX The device with MAC HEX on BACnet network N, behind the router at --device. For MS/TP the MAC is the station number in hex (0a for station 10)

The local port depends on the command:

Commands --local-port default Why
read, write, release, objects, describe, device, monitor, alarms, ack, trend, file, time sync, bbmd, reinitialize, comm-control 0 (a free port) A device answers to the address the request came from
discover, whohas, events, router list 47808 Devices answer Who-Is and send event notifications by broadcast to port 47808

Only one program on a host can hold port 47808. If a BACnet workstation or gateway has it, the second group fails with exit code 4. Allow inbound UDP 47808 in the host firewall for discovery. No administrator rights are needed.

Other connection flags: --interface restricts broadcasts to one interface’s subnet; --bbmd host[:port] and --bbmd-ttl register as a foreign device (60 s TTL by default) and send broadcasts through that BBMD; --timeout sets the APDU timeout in milliseconds (3000); --retries sets how often an unanswered read is resent (3). A write is never sent twice.

bacnetctl
├── discover Find devices with Who-Is
├── whohas Find the devices that have an object, by name or identifier
├── read Read properties of objects (ReadProperty, ReadPropertyMultiple)
├── objects List the objects of a device, with values
├── describe Show every property of one object
├── device Show what a device says about itself
├── trend Read the records of a trend log (ReadRange)
├── file
│ ├── get Read a file object into a local file
│ └── put Write a local file into a file object
├── write Write one or more properties (WriteProperty, WritePropertyMultiple)
├── release Relinquish a command priority
├── create Create an object in a device (CreateObject)
├── delete Delete an object from a device (DeleteObject)
├── time
│ └── sync Set the clock of a device, or of every device on the network
├── monitor Print the values of objects as they change (SubscribeCOV, or polling)
├── alarms List the active alarms and events of a device
├── ack Acknowledge an alarm
├── events Listen for event notifications
├── router
│ └── list Find the BACnet routers and the networks behind them
├── bbmd
│ ├── bdt Read the broadcast distribution table of a BBMD
│ └── fdt Read the foreign device table of a BBMD
├── reinitialize Restart a device (ReinitializeDevice)
├── comm-control Silence a device, or let it speak again
├── server
│ ├── run Serve a simulated device (go-bacnet server)
│ └── example Print the built-in example device file
├── decode Decode a captured BACnet/IP datagram (offline)
├── types List the object types bacnetctl knows by name
├── properties List the property identifiers bacnetctl knows by name
├── completion Generate shell completion script (bash|zsh|fish|powershell)
└── version Print version

Objects are written type:instance (analog-input:1, or ai:1) and properties by name (present-value, or pv). bacnetctl types and bacnetctl properties list the names. Every command has --help with examples.

Terminal window
# Which devices are on this network?
bacnetctl discover
bacnetctl discover --low 1000 --high 1999 --names
# One address, another subnet through its BBMD, one BACnet network behind a router
bacnetctl discover --target 10.0.20.15
bacnetctl discover --bbmd 10.0.20.1
bacnetctl discover --network 2001
# Who is at this address, and what does it hold?
bacnetctl device --device 192.168.1.20
bacnetctl objects --device 192.168.1.20 --values
# Values
bacnetctl read --device 192.168.1.20 analog-input:1 present-value
bacnetctl read --device 192.168.1.20 ai:1 pv,units,status-flags av:2 pv,description
bacnetctl read --device 192.168.1.20 analog-value:1 priority-array[8]
bacnetctl describe --device 192.168.1.20 analog-input:1

A single property prints the bare value, ready for a script. With several properties, bacnetctl sends ReadPropertyMultiple split to the device’s APDU size; a property the device refuses is reported in its row and the exit code is 7.

$ bacnetctl objects --device 127.0.0.1:47809 --values
device:1234 at 127.0.0.1:47809: 10 objects
OBJECT NAME VALUE STATUS DESCRIPTION
device:1234 AHU-1 Controller - - Simulated air handling unit controller
analog-input:1 Supply Air Temp 21.5 °C ok AHU-1 supply air temperature
analog-input:2 Return Air Humidity 71.25 %RH in-alarm AHU-1 return air humidity
...

Watching, alarms, trends and the network:

Terminal window
bacnetctl monitor --device 192.168.1.20 analog-input:1 binary-input:3
bacnetctl monitor --device 192.168.1.20 ai:1 --property present-value --increment 0.5 --count 10 --format json
bacnetctl monitor --device 192.168.1.20 ai:1 --poll 2000
bacnetctl alarms --device 192.168.1.20
bacnetctl events --duration 3600 --format json > events.jsonl
bacnetctl trend --device 192.168.1.20 trend-log:1 --all
bacnetctl file get --device 192.168.1.20 file:1 --output config.bin
bacnetctl router list
bacnetctl bbmd bdt --device 10.0.20.1
bacnetctl decode 810a0017 0100 3003 0c 0c00000001 1955 3e 4441ac0000 3f

monitor subscribes with SubscribeCOV, renews while running and cancels on exit; --poll reads periodically for devices without COV. decode takes the hex of a UDP payload and shows BVLC, NPDU, APDU and the service; nothing is sent. file get creates a new --output file with mode 0600, because a file object can hold a device configuration or credentials. When notifications were lost because output could not keep up, the next monitor record carries a gap mark.

Terminal window
# A typed value, at operator priority, then hand it back
bacnetctl write --device 192.168.1.20 analog-value:1 present-value real:21.5 --priority 8
bacnetctl release --device 192.168.1.20 analog-value:1 --priority 8
# Several properties in one WritePropertyMultiple
bacnetctl write --device 127.0.0.1:47809 av:1 pv real:21.5 av:1 object-name "string:Supply SP" bv:1 pv active
Value BACnet type
real:21.5, double:21.5 REAL, Double
unsigned:3, signed:-1 Unsigned, Signed Integer
bool:true BOOLEAN
enum:1, enum:active Enumerated
string:Room 4 CharacterString (UTF-8)
octets:0a1b2c, bits:1011 OctetString, BitString
date:2026-10-10, time:12:00:00 Date, Time
object:analog-input:1 Object identifier
null NULL: relinquishes, with --priority

Without a type prefix, bacnetctl reads the property first and writes with the type it holds now; --type names the type and skips the read. Without --priority a device uses priority 16.

The safety model:

  1. Everything that can be checked is checked before anything is sent. A rejected invocation exits 2 or 3 and has sent nothing.
  2. delete, reinitialize and comm-control refuse to run without --yes-i-am-sure, which has no environment variable.
  3. A request that changes the device is sent exactly once. Without an acknowledgement bacnetctl reports outcome_unknown (exit 5) and does not resend: read the state back before repeating the command.
  4. Passwords for reinitialize and comm-control come from --password or BACNETCTL_PASSWORD and are never printed, not even with --debug. BACnet sends them in clear text.
  5. Values a device cannot hold are refused before sending: a year outside 1900 to 2154 for time sync and ack --event-time, and a file put past the last octet a file object can address (exit 3).

There is no dry-run flag. discover, whohas and router list are read-only but broadcast to every device on the network; limit them with --low/--high, --network or --target on large or fragile networks.

--format text|json|table (or BACNETCTL_FORMAT; the older BACNETCTL_OUTPUT_FORMAT is still accepted) controls the result on stdout only; progress and diagnostics go to stderr. monitor and events stream JSON Lines in JSON mode. A failure in JSON mode is a single {"error": {"kind", "code", "message", "bacnet"}} object on stdout, also for usage errors. The JSON shapes are a stable contract (docs/json-output.md).

Code Meaning
0 Success; also an empty discovery result
2 Usage: unknown command or flag, wrong arguments, missing --yes-i-am-sure. Nothing sent
3 Invalid input. Nothing sent
4 Transport: port in use, name does not resolve, BBMD refused registration
5 Timeout; for a change, outcome_unknown
6 The device refused (Error, Reject, Abort), or a protocol error
7 Partial success: a valid result that holds failures
8 Unsupported: an optional service the device does not provide (unsupported)
10 Output or internal error
130 Interrupted by Ctrl-C or SIGTERM before a result

The codes follow the OT Fabric CLI exit-code table shared by every *ctl tool. server run exits 0 when stopped with Ctrl-C, SIGTERM or --duration, 3 for a device file it cannot serve (invalid_config) or cannot read (input_file_open_failed), and 4 when the port is in use.

Since v0.4.0 property 133 is named enable, as in ANSI/ASHRAE 135 (it was log-enable). This changes the property field of read, describe and monitor output for that property; log-enable is still accepted as input.

--debug adds the client’s diagnostics and the chain of causes on stderr without changing stdout or the exit code.

Every configuration flag has a BACNETCTL_* variable; a flag on the command line wins. Commonly used ones:

Variable Flag Default
BACNETCTL_DEVICE --device none
BACNETCTL_FORMAT (or BACNETCTL_OUTPUT_FORMAT) --format text
BACNETCTL_LOCAL_PORT --local-port 0 (47808 for discovery commands)
BACNETCTL_INTERFACE --interface chosen by the system
BACNETCTL_BBMD, BACNETCTL_BBMD_TTL --bbmd, --bbmd-ttl none, 60
BACNETCTL_TIMEOUT --timeout 3000
BACNETCTL_RETRIES --retries 3
BACNETCTL_NETWORK, BACNETCTL_MAC --network, --mac 0, none
BACNETCTL_PRIORITY --priority 0 (none)
BACNETCTL_PASSWORD --password none

The README lists all of them. --debug and --yes-i-am-sure have none.

server run serves one BACnet device on this computer with the server of go-bacnet: for developing and testing clients (bacnetctl itself, a supervisor, a gateway) without hardware. What it supports is what go-bacnet’s server support table lists; bacnetctl claims nothing beyond it.

Terminal window
# The built-in example device, on every address, UDP port 47808, until Ctrl-C
bacnetctl server run
# A device file on loopback, on a free port, the records as JSON Lines
bacnetctl server run --config device.json --listen 127.0.0.1 --port 0 --format json
# In another terminal: use it like any device
bacnetctl objects --device 127.0.0.1:47808 --values
bacnetctl write --device 127.0.0.1:47808 av:1 pv 22.5 --priority 8
# Also the BBMD of this subnet, with a peer BBMD on another one
bacnetctl server run --listen 192.168.1.10 --bbmd --bdt 10.0.20.1
# Start a device file of your own from the example
bacnetctl server example > device.json

The state is in memory: writes, created and deleted objects and file content last as long as the process, and the device file is never changed. A ReinitializeDevice COLDSTART, WARMSTART or ACTIVATE_CHANGES is acknowledged and printed as a record (allowed); the process does not restart. Since v0.6.0 the backup and restore states are refused with services/service-request-denied and recorded as refused, because the simulated device has no backup procedure. Text messages and private transfers are not served (the confirmed ones get Reject unrecognized-service).

Flag Environment Meaning
--config BACNETCTL_SERVER_CONFIG Device file (JSON); without it the built-in example device
--listen BACNETCTL_SERVER_LISTEN IPv4 address to bind (default: every address)
--port BACNETCTL_SERVER_PORT UDP port (default: port of the device file, or 47808; 0 picks a free port, named in the listening record)
--instance, --name, --vendor-id BACNETCTL_SERVER_INSTANCE, _NAME, _VENDOR_ID Override the identity of the device file (vendor identifier 999 unless given)
--max-apdu BACNETCTL_SERVER_MAX_APDU Largest APDU accepted, 50 to 1476 (default 1476)
--max-segments BACNETCTL_SERVER_MAX_SEGMENTS Segments accepted per message, 2 to 255 (default 64; 0 disables segmentation)
--read-only BACNETCTL_SERVER_READ_ONLY Refuse every write (write-access-denied) and delete (object-deletion-not-permitted)
--password BACNETCTL_SERVER_PASSWORD Password DeviceCommunicationControl and ReinitializeDevice must carry, at most 20 octets; never printed
--bbmd, --bdt, --bbmd-address, --no-foreign-devices BACNETCTL_SERVER_BBMD, _BDT, _BBMD_ADDRESS, _NO_FOREIGN Also be a BBMD on the same address, with peer BBMDs, its own address, and optionally no foreign devices
--duration BACNETCTL_DURATION Stop after this many seconds (0 = until Ctrl-C or SIGTERM)

--interface (BACNETCTL_INTERFACE) picks the interface whose broadcast address the I-Am and I-Have go to.

stdout gets one record when the device listens and one for every request that changes it: write (with value, priority and allowed or refused), create, delete, reinitialize and time-sync. In JSON mode they are JSON Lines, with shapes in docs/json-output.md. The start line and a summary go to stderr.

Device file. A JSON object with device_instance, device_name, an optional port, objects and an optional object_lifecycle. It is a superset of the bacnet-interop device fixtures: device-server-v1 and device-baseline-v2 load as they are. Supported object types are analog, binary and multi-state inputs, outputs and values (analog points optionally with out-of-range alarms); characterstring, integer and positive-integer values; notification classes; trend logs with a seeded log_buffer; and stream or record files. object_lifecycle.creatable_types enables CreateObject for analog and binary points, files and the value types. An unknown field, or one that does not apply to its object type, is refused.

For independent stacks, use the bacnet-interop containers. The in-process device of the test suite (internal/bactest/bacsim) is still there for a source checkout.