Skip to main content

BACnet Data Source

The BACnet data source connects Mango to building automation and control devices using the BACnet protocol. Mango supports two BACnet network types: BACnet I/P (over Ethernet/IP networks) and BACnet MS/TP (over RS232/RS485 serial networks). Both variants use a combination of polling and COV (Change Of Value) subscriptions for efficient data collection -- the data source automatically determines which method to use based on the capabilities of each remote device.

BACnet is the dominant protocol in building automation, used for HVAC controllers, lighting systems, fire alarm panels, access control, and energy management. It is defined by the ASHRAE 135 standard and is an ISO global standard (ISO 16484-5).

Overview

PropertyValue
ModulemangoAutomation-BACnet
ProtocolBACnet I/P and MS/TP
DirectionBidirectional
Typical UseBuilding automation system integration

Prerequisites

  • BACnet I/P: Network access to the BACnet devices. Devices can be on a local network, intranet, or accessible over the internet.
  • BACnet MS/TP: A serial connection (RS232 or RS485 adapter) to the MS/TP network.
  • A local device must be configured in Mango's system settings before creating a BACnet data source. The local device represents Mango on the BACnet network.
  • Knowledge of the remote device's instance number, the object types and object instance numbers you want to read.

Local Device Configuration

BACnet data sources and publishers require local device instances to operate. Local devices are shared among data sources and publishers, and are configured in Mango's system settings. Changes to a local device require all data sources and publishers using that device to be stopped and restarted.

Common Settings

SettingDescription
Device IDThe identifier that Mango presents to other BACnet devices in its IAm message. Must be unique on the network.
Network TypeI/P or MS/TP. Cannot be changed after the local device is saved.
Local network numberThe ID of the local network. Typically set to 0.
Strict device comparisonsWhen checked, devices are compared using both address and instance number. When unchecked, only the address is used. Leave unchecked if your network reuses instance numbers (not recommended, but it occurs).
TimeoutBACnet messaging timeout in milliseconds.
Segment timeoutTimeout for segmented message transfers.
Segment windowNumber of segments sent before waiting for acknowledgment.
RetriesNumber of retry attempts for failed BACnet messages.

I/P Network Settings

SettingDescription
Broadcast addressIP address for broadcast messages. Your network administrator can provide this.
SubnetLength of the network segment of the IP address.
PortPort number on which the local device listens for incoming BACnet messages (default: 47808, which is 0xBAC0).
BBMD address(Optional) If set, the local device registers as a foreign device with this BACnet Broadcast Management Device, enabling communication across subnets.
BBMD portPort of the BBMD.
BBMD registration intervalHow often (in seconds) the foreign device registration is renewed.

Example: BACnet I/P Local Device Configuration

{
"deviceId": 100,
"networkType": "IP",
"localNetworkNumber": 0,
"strictDeviceComparisons": false,
"timeout": 6000,
"segmentTimeout": 5000,
"retries": 2,
"broadcastAddress": "192.168.1.255",
"subnet": 24,
"port": 47808
}

Example: BBMD Configuration for Cross-Subnet Communication

If devices are on a remote subnet, create a second local device that registers with a BBMD:

{
"deviceId": 101,
"networkType": "IP",
"port": 47809,
"broadcastAddress": "192.168.1.255",
"subnet": 24,
"bbmdAddress": "10.0.1.50",
"bbmdPort": 47808,
"bbmdRegistrationInterval": 60
}

This second local device uses a different port (47809) and registers with the BBMD at 10.0.1.50. Data sources using this local device can discover and communicate with BACnet devices on the remote 10.0.x.x subnet.

If you have BACnet devices on both a local network and a remote network accessible through a BBMD, create two local devices on different local ports -- one for local communication and one for the BBMD connection.

MS/TP Network Settings

SettingDescription
Comm port IDThe serial port identifier (e.g., COM3, /dev/ttyUSB0).
Baud rateSerial communication speed. Must match the MS/TP network.
This station IDThe MS/TP station ID for Mango. Must be unique on the network (0-254).
Frame error retry countNumber of retries for failed MS/TP frame sends (distinct from the transport-level retry count).
Max masterLimits token passing to iterate up to masters with this station ID.
Max info framesNumber of messages the device can send while holding the token.
Usage timeoutTime the device waits between polls for the master frame. Lower values reduce poll intervals.

Configuration

Data Source Settings

SettingDescription
NameA descriptive name for the data source.
Local deviceSelect the local device to use for this data source (configured in system settings).
Update periodHow often to poll devices that do not support COV subscriptions.
COV lease timeNumber of minutes to request for COV subscription leases. Mango automatically renews subscriptions at half the lease time (e.g., a 60-minute lease renews after 30 minutes).

How Polling and COV Work Together

When a data source starts, Mango queries each remote device to determine its supported services. For objects that support COV subscriptions, Mango subscribes to change notifications and does not include those objects in the poll cycle. For objects that do not support COV, Mango falls back to polling at the configured update period.

Devices are polled individually. If a device supports the ReadPropertyMultiple service, Mango sends batch requests containing up to 200 properties each. Otherwise, individual ReadProperty requests are sent for each object.

BACnet Device Discovery

Devices on BACnet networks can be discovered automatically by broadcasting WhoIs messages. When you click "Send WhoIs" in the data source editor, Mango broadcasts a single WhoIs message and then listens for IAm responses. As devices respond, their information (device instance number, vendor, model, MAC address) appears in the discovery table.

WhoIs discovery results showing detected BACnet devices

Example: WhoIs Discovery Results

A typical WhoIs broadcast returns results like this:

Device Instance   Vendor                Model              MAC Address
---------------------------------------------------------------------------
100 Tridium JACE 8000 192.168.1.10:47808
200 Johnson Controls FEC-2611 192.168.1.20:47808
300 Schneider Electric SmartX IP-FC 192.168.1.30:47808
450 Honeywell Spyder 192.168.1.45:47808

Use the Device Instance number when configuring data points. The vendor and model help you identify which device documentation to reference for object types and instance numbers.

After discovery is complete, you can download a spreadsheet of all discovered devices by navigating to:

http://your-mango-host/bacnet/data/all-discovered.xlsx

Data Point Configuration

SettingDescription
Network numberThe BACnet network number where the device resides. A value of 0 indicates the local network.
MACThe device identifier within the network.
Link serviceThe MAC of the device that acts as a router to other networks. Leave empty if the device is on the local network.
Device instance numberThe BACnet inter-network unique identifier of the remote device.
Object typeThe BACnet object type to read (e.g., Analog Input, Binary Output, Multistate Value).
Object instance numberThe unique identifier of the specific object within the device.
Use COV subscriptionWhether to attempt COV subscription for this point. Not all devices or objects support COV, and some devices limit concurrent subscriptions.
SettableWhether to allow writing values to this object. Only "output" object types are settable.
Write priorityThe BACnet priority level (1-16) to use when writing values. Priority 8 is "Manual Operator" and is commonly used.
Data typeThe Mango data type for this point. BACnet values are automatically converted.
Multiplier / AdditiveLinear transformation for numeric values: displayed = (raw * multiplier) + additive. The reverse is applied on writes.

Example: HVAC Controller Data Points

A Johnson Controls FEC-2611 controller might be configured with these data points:

[
{
"name": "Zone Temperature",
"deviceInstanceNumber": 200,
"objectType": "ANALOG_INPUT",
"objectInstanceNumber": 1,
"useCov": true,
"settable": false,
"dataType": "NUMERIC"
},
{
"name": "Cooling Setpoint",
"deviceInstanceNumber": 200,
"objectType": "ANALOG_VALUE",
"objectInstanceNumber": 10,
"useCov": true,
"settable": true,
"writePriority": 8,
"dataType": "NUMERIC"
},
{
"name": "Operating Mode",
"deviceInstanceNumber": 200,
"objectType": "MULTISTATE_VALUE",
"objectInstanceNumber": 1,
"useCov": false,
"settable": true,
"writePriority": 8,
"dataType": "MULTISTATE"
}
]

BACnet Data Type Mapping

BACnet defines many data types that map to Mango's four data types. The following table shows which BACnet types can be used with each Mango type:

BACnet Data TypeAlphanumericBinaryMultistateNumeric
Booleanyesyesyesyes
Realyesyesyesyes
Doubleyesyes--yes
Signed Integeryesyesyesyes
Unsigned Integeryesyesyesyes
Enumeratedyesyesyesyes
Character Stringyes------
Bit Stringyesyesyesyes
Dateyes----yes
Timeyesyesyesyes
BinaryPVyesyesyesyes

For binary Mango data types, the conversion rule is: 0 = false, all other values = true. For numeric and multistate types, the integer value of the BACnet data is stored directly. Date values in numeric mode are stored as milliseconds since epoch.

Common Patterns

HVAC Zone Monitoring

A typical HVAC controller exposes objects like:

  • Analog Input (AI) objects for temperature sensors, humidity sensors, and CO2 levels
  • Analog Output (AO) objects for damper positions and valve commands
  • Binary Input (BI) objects for occupancy sensors and filter status
  • Binary Output (BO) objects for fan on/off commands
  • Multistate Value (MV) objects for operating modes (Heating, Cooling, Auto, Off)

Create data points for each object using the device instance number from WhoIs discovery and the object types and instance numbers from the device documentation or the device's object list.

Multistate Value Mapping and Write Priority

Multistate Value (MV) objects use integer states that map to operating modes:

Multistate Value (MV-1) Operating Mode:
State 1 = Off
State 2 = Heating
State 3 = Cooling
State 4 = Auto
State 5 = Emergency Heat

Write Priority Array (16 levels, lower number = higher priority):
Priority 1: Life Safety (fire system override)
Priority 5: Critical Equipment Control
Priority 8: Manual Operator (typical for SCADA/BMS writes)
Priority 10: Scheduling
Priority 16: Default / Available (lowest priority)

Writing a setpoint at priority 8 means the value holds unless overridden by a higher-priority source (priority 1-7). For example, a fire safety system at priority 1 will always override a SCADA command at priority 8.

Multi-Building Networks with BBMD

When monitoring BACnet devices across multiple subnets, configure a BBMD-enabled local device. The BBMD registration allows Mango to discover and communicate with devices on remote subnets as if they were local. Use the network number and link service fields in data point configuration to route through the appropriate network path.

Writing Setpoints

To change a thermostat setpoint, create a data point targeting the Analog Value (AV) object for the setpoint, mark it as settable, and choose an appropriate write priority. BACnet uses a 16-level priority array; priority 8 (Manual Operator) is typical for supervisory commands from a SCADA system. Be aware that a higher-priority source (lower number) will override your written value.

Troubleshooting

No Devices Found in WhoIs Discovery

  1. Verify the local device port -- the default BACnet port is 47808 (0xBAC0). If another application is using this port, the local device will fail to start.
  2. Check the broadcast address -- an incorrect broadcast address will prevent WhoIs messages from reaching devices.
  3. Check for firewalls -- BACnet I/P uses UDP; ensure UDP port 47808 is allowed in both directions.
  4. Try specifying the port in the discovery dialog -- some devices listen on non-standard ports.

COV Subscriptions Not Working

  1. Not all objects support COV -- the device may not implement COV for the object type you are monitoring. Mango will automatically fall back to polling.
  2. Subscription limits -- many devices limit the number of concurrent COV subscriptions (often 10-50). If the limit is reached, additional subscriptions will fail silently and those points will be polled instead.
  3. Lease renewal failures -- if the lease time is too short, network delays might cause subscriptions to expire before renewal. Increase the COV lease time.

Communication Timeouts

  1. MS/TP: Check baud rate and station ID -- these must match the network configuration exactly.
  2. MS/TP: Verify wiring -- RS485 requires proper termination and correct A/B polarity.
  3. I/P: Check network routing -- if the device is on a different subnet, you may need a BBMD configuration.
  4. Increase timeout values -- some devices, especially older controllers, are slow to respond.

Wrong or Missing Values

  1. Check the object type and instance number -- use the device documentation or WhoIs discovery to verify.
  2. Verify the data type -- a mismatch between BACnet and Mango data types can cause incorrect conversions.
  3. Check the write priority -- when writing values, a higher-priority entry in the device's priority array may be overriding your value.