How to create multiple BACnet/IP devices on the same "Application" (same :) with python (for single YABE auto-discovery)

1 week ago 2
ARTICLE AD BOX

I'm developping in python 3.13 on Windows.

I have 2 computers:

On the first one I want to execute a .py file to simulate multiple BACnet devices on my PC ip : 192.168.1.54/24, port = BAC0 (47808)

On the 2nd one, on the same subnet, I want to visualize my devices by connecting to YABE (Yet Another BACnet Explorer) with the following configuration : "BACnet/IP V4 & V6 over Udp" port = BAC0 and Local endpoint = 192.168.1.38

Until now I was able to create 1 device with 2 default variables using BAC0.lite (BAC0==2025.9.15) :

#!/usr/bin/env python3 """ BACnet device with custom objects - Fixed version => Mahé can see my 2 variables on his PC using YABE! """ import asyncio from BAC0 import lite from bacpypes3.local.analog import AnalogValueObject, AnalogInputObject from bacpypes3.primitivedata import Real, ObjectIdentifier from bacpypes3.basetypes import EngineeringUnits async def main(): try: print("🚀 Starting BACnet device with objects...") # Create BACnet device bacnet_device = lite(ip="192.168.1.54/24", deviceId=1234) # Access underlying bacpypes3 application to create objects app = bacnet_device.this_application.app # Create BACnet objects temp_sensor = AnalogValueObject( objectIdentifier=ObjectIdentifier("analogValue,1"), objectName="Room_Temperature", presentValue=Real(22.5), units=EngineeringUnits.degreesCelsius, description="Temperature sensor", ) app.add_object(temp_sensor) pressure_sensor = AnalogInputObject( objectIdentifier=ObjectIdentifier("analogInput,2"), objectName="Room_Pressure", presentValue=Real(1013.25), units=EngineeringUnits.pascals, description="Pressure sensor", ) app.add_object(pressure_sensor) print("✅ BACnet device with objects created!") print(" Device ID: 1234") print(" Address: 192.168.2.110/24") print(" Created objects:") print(f" - {temp_sensor.objectName}: {temp_sensor.presentValue} °C") print(f" - {pressure_sensor.objectName}: {pressure_sensor.presentValue} Pa") print("\n🔍 Scan with YABE to see objects") # Keep running await asyncio.Future() except KeyboardInterrupt: print("\n🛑 Stopped") except Exception as e: print(f"❌ Error: {e}") finally: if 'bacnet_device' in locals(): await bacnet_device.disconnect() if __name__ == "__main__": asyncio.run(main())

During execution :

(xml_3_13) PS C:\Users\POTIEAL\Documents\RetD\m2524238-convertisseur_xml_danfoss> python .\test_bacnet_BAC0_eng.py 🚀 Starting BACnet device with objects... 2026-03-27 17:05:07,682 - INFO | Starting Asynchronous BAC0 version 2025.09.15 (Lite) 2026-03-27 17:05:07,682 - INFO | Using bacpypes3 version 0.0.106 2026-03-27 17:05:07,682 - INFO | Use BAC0.log_level to adjust verbosity of the app. 2026-03-27 17:05:07,682 - INFO | Ex. BAC0.log_level('silence') or BAC0.log_level('error') 2026-03-27 17:05:07,762 - INFO | Using ip : 192.168.1.54/24 on port 47808 | broadcast : 192.168.1.255 2026-03-27 17:05:08,394 - INFO | Using default JSON configuration file 2026-03-27 17:05:08,400 - INFO | Registered as BACnet/IP App | mode normal 2026-03-27 17:05:08,401 - INFO | Device instance (id) : 1234 ✅ BACnet device with objects created! Device ID: 1234 Address: 192.168.2.110/24 Created objects: - Room_Temperature: 22.5 °C - Room_Pressure: 1013.25 Pa 🔍 Scan with YABE to see objects 2026-03-27 17:05:08,402 - INFO | Installing recurring task Ping Registered Devices Task (id:2480079317248) 2026-03-27 17:05:08,405 - INFO | Installing recurring task Cleanup Tasks List (id:2480079430160)

YABE view of my device 1234

But when I tried to create another device :

using BAC0 and trying to set another instance of BAC0.lite I got : BAC0.core.io.IOExceptions.InitializationError: IP Address provided (192.168.49.110) invalid. Check if another software is using port 47808 on this network interface. If so, you can define multiple IP per interface. Or specify another IP using BAC0.lite(ip='IP/mask')

I also tried to work with bacpypes3 directly instead of BAC0 with objects like:

from bacpypes3.vlan import Network as VirtualNetwork, Node as VirtualNode

however I'm overwhelmed as I tried a dozen of variants and got errors like :

File "C:\Users\POTIEAL\Documents\RetD\m2524238-convertisseur_xml_danfoss\venv\xml_3_13\Lib\site-packages\bacpypes3\netservice.py", line 576, in bind raise RuntimeError("already bound: %r" % (net,))

at the execution or

raise ConfigurationError("unbound server") bacpypes3.comm.ConfigurationError: unbound server

at the reception of whois() from the 2nd PC..

How to simply declare distinct devices based on their ID (or name) on the same ip:port to see all BACnet objects with a single connection on my 2nd computer's YABE?

Read Entire Article