thingsboard-gateway icon indicating copy to clipboard operation
thingsboard-gateway copied to clipboard

[BUG] BACnet connector won't work with multiple devices in the same IP + Port

Open elgutierrez opened this issue 6 months ago • 0 comments

Describe the bug I'm testing the latest gateway version (3.7.5) with BACnet connectors and I'm facing the following issue:

On my local network, I have one BACnet controller that centralizes all devices, and map them into multiple ObjectIDs. So, I have just one IP:PORT for all devices (let's say 10), accessible via different ObjectIDs.

Here's the cofiguration:

{
  "application": {
    "objectName": "TB_gateway",
    "host": "0.0.0.0",
    "port": "47808",
    "objectIdentifier": 599,
    "maxApduLengthAccepted": 1476,
    "segmentationSupported": "segmentedBoth",
    "vendorIdentifier": 15
  },
  "devices": [
    {
      "altResponsesAddresses": [],
      "host": "192.168.15.210",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "SPM_F0_TS1",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "Temperature Sensor"
      },
      "pollPeriod": 10000,
      "timeseries": [
        {
          "key": "temperature",
          "objectType": "analogValue",
          "objectId": 112,
          "propertyId": "presentValue"
        }
      ],
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    },
    {
      "altResponsesAddresses": [],
      "host": "192.168.15.210",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "SPM_F0_EM1",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "Energy Meter"
      },
      "pollPeriod": 10000,
      "timeseries": [
        {
          "key": "kWh",
          "objectType": "analogValue",
          "objectId": 114,
          "propertyId": "presentValue"
        }
      ],
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    }
  ],
  "name": "bacnet",
  "id": "XXX"
}

As you can see, both devices should connect to 192.168.15.210:47808, fetch the data from different objectIDs and report to different devices. For example, the expected result is:

Device 1:

  • Name: SPM_F0_TS1
  • Profile: Temperature Sensor
  • IP: 192.168.15.210:47808
  • Timeseries: temperature from objectId = 112

Device 2:

  • Name: SPM_F0_EM1
  • Profile: Energy Meter
  • IP: 192.168.15.210:47808
  • Timeseries: kWh from objectId = 114

This setup works fine for previous versions (around 3.6.X), but with this new bacnet connector format, it only reports the data for the first device and stops there, not reporting the second one.

Here's what we get in the logs:

2025-06-05 18:39:59 - |DEBUG| - [application.py] - application - indication - 62 - (indication) Received APDU: <bacpypes3.apdu.IAmRequest(UnconfirmedRequestPDU) instance at 0x7fff5c2c8510>
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - __discover_devices - 210 - WhoIs request sent to device 192.168.15.210:47808
2025-06-05 18:39:59 - |DEBUG| - [application.py] - application - indication - 62 - (indication) Received APDU: <bacpypes3.apdu.IAmRequest(UnconfirmedRequestPDU) instance at 0x7fff5c2c87d0>
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - __discover_devices - 210 - WhoIs request sent to device 192.168.15.210:47808
2025-06-05 18:39:59 - |INFO| - [bacnet_connector.py] - bacnet_connector - indication_callback - 136 - Received APDU, from 192.168.15.210, trying to find device...
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - indication_callback - 138 - Found device Device(name=SPM_F0_TS1, address=192.168.15.210) for APDU 192.168.15.210
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - indication_callback - 170 - Device Device(name=SPM_F0_TS1, address=192.168.15.210) already added
2025-06-05 18:39:59 - |INFO| - [bacnet_connector.py] - bacnet_connector - indication_callback - 136 - Received APDU, from 192.168.15.210, trying to find device...
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - indication_callback - 138 - Found device Device(name=SPM_F0_TS1, address=192.168.15.210) for APDU 192.168.15.210
2025-06-05 18:39:59 - |DEBUG| - [bacnet_connector.py] - bacnet_connector - indication_callback - 170 - Device Device(name=SPM_F0_TS1, address=192.168.15.210) already added

So, my conclusion is that this version requires that we have one IP+PORT per device, which is different from what we used to have on last versions. I can't change my clients infrastructure so they have multiple IP + PORTS exposed on their local network. Also, I've seen recommendations to use device name expressions for that but it's simply not doable with our device naming conventions.

That's a strict requirement for our existing setup and unfortunately those breaking changes prevent us to upgrade our Gateways to the latest versions... we're stuck on older versions for a while.

Connector name: BACNET

Version

  • Thingsboard IoT Gateway version: 3.7.5

elgutierrez avatar Jun 05 '25 19:06 elgutierrez