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

[BUG] BACNET Connector: something broke from Version 3.7.8 to 3.8.0

Open hoffi085 opened this issue 3 weeks ago • 7 comments

Connector name (If bug in the some connector): BACNET Connector

Describe the bug When I use thingsboard gateway 3.7.8, my bacnet connector to multiple devices is working, when using 3.8.0 it isn't. Most of the connected BACNET devices are working in 3.8.0. It is just one which does not deliver any datapoints anymore.

Steps to Reproduce Steps to reproduce the behavior:

  1. using BACNET config in 3.7.8 all BACNET devices work
  2. updating to gateway to 3.8.0
  3. suddenly one device is not connecting and delivering datapoints

Versions (please complete the following information):

  • OS: Debian 12
  • Thingsboard IoT Gateway version 3.7.8 / 3.8.0
  • Python version 3.11.2
{
  "application": {
    "objectName": "BACNET",
    "host": "XX.XX.XX.XX",
    "port": "47808",
    "objectIdentifier": 599,
    "vendorIdentifier": 15,
    "maxApduLengthAccepted": 1476,
    "segmentationSupported": "segmentedBoth",
    "networkNumber": 5,
    "deviceDiscoveryTimeoutInSec": 5
  },
  "devices": [
    {
      "altResponsesAddresses": [],
      "reportStrategy": {
        "type": "ON_CHANGE_OR_REPORT_PERIOD",
        "reportPeriod": 900000
      },
      "host": "XX.XX.XX.XX",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "Schuetzenstraße 48",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "default"
      },
      "pollPeriod": 60000,
      "timeseries": "*",
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    },
    {
      "altResponsesAddresses": [],
      "reportStrategy": {
        "type": "ON_CHANGE_OR_REPORT_PERIOD",
        "reportPeriod": 900000
      },
      "host": "XX.XX.XX.XX",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "Bundesstrasse 23",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "default"
      },
      "pollPeriod": 60000,
      "timeseries": "*",
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    },
    {
      "altResponsesAddresses": [],
      "reportStrategy": {
        "type": "ON_CHANGE_OR_REPORT_PERIOD",
        "reportPeriod": 900000
      },
      "host": "XX.XX.XX.XX",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "Hotel Sailer",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "default"
      },
      "pollPeriod": 60000,
      "timeseries": "*",
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    },
    {
      "altResponsesAddresses": [],
      "reportStrategy": {
        "type": "ON_CHANGE_OR_REPORT_PERIOD",
        "reportPeriod": 900000
      },
      "host": "XX.XX.XX.XX",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "Resselstrasse",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "default"
      },
      "pollPeriod": 60000,
      "timeseries": "*",
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    },
    {
      "altResponsesAddresses": [
        "10.70.0.232"
      ],
      "reportStrategy": {
        "type": "ON_CHANGE_OR_REPORT_PERIOD",
        "reportPeriod": 900000
      },
      "host": "XX.XX.XX.XX",
      "port": 47808,
      "deviceInfo": {
        "deviceNameExpression": "Juffinger",
        "deviceNameExpressionSource": "constant",
        "deviceProfileExpressionSource": "constant",
        "deviceProfileExpression": "Juffinger"
      },
      "pollPeriod": 10000,
      "timeseries": "*",
      "attributes": [],
      "attributeUpdates": [],
      "serverSideRpc": []
    }
  ],
  "name": "BACNET",
  "id": "69ce3587-0a78-453c-98f1-d55768e67986",
  "logLevel": "DEBUG",
  "enableRemoteLogging": false,
  "configVersion": "3.7.7"
}

hoffi085 avatar Dec 09 '25 08:12 hoffi085

Hi @hoffi085, thanks for your interest in ThingsBoard IoT Gateway! Which device from your configuration can't connect? Is it the last one? Are there any errors in the logs?

samson0v avatar Dec 09 '25 09:12 samson0v

Hi, yes it is indeed the last device which is not delivering data. I tried to change the order, but that did not help. There is nothing unusual in the logs, exept some data convertion errors, which belong to the devices which work, like:

Dez 09 10:22:45 thingsboard-iot-gateway python3[3088500]: 2025-12-09 10:22:45.038 - |ERROR| - [bacnet_uplink_converter.py] - bacnet_uplink_converter - __convert_data - 90 - Error converting object with objectId: "trend-log,3000587", and propertyId: "present-value". Error: <bacpypes3.primitivedata.ErrorType object at 0x7f82501e94d0>
Dez 09 10:22:45 thingsboard-iot-gateway python3[3088500]: 2025-12-09 10:22:45.038 - |ERROR| - [bacnet_uplink_converter.py] - bacnet_uplink_converter - __convert_data - 90 - Error converting object with objectId: "trend-log,3000588", and propertyId: "present-value". Error: <bacpypes3.primitivedata.ErrorType object at 0x7f82501e8cd0>
Dez 09 10:22:45 thingsboard-iot-gateway python3[3088500]: 2025-12-09 10:22:45.038 - |ERROR| - [bacnet_uplink_converter.py] - bacnet_uplink_converter - __convert_data - 90 - Error converting object with objectId: "trend-log,3000589", and propertyId: "present-value". Error: <bacpypes3.primitivedata.ErrorType object at 0x7f82501e9050>
Dez 09 10:22:45 thingsboard-iot-gateway python3[3088500]: 2025-12-09 10:22:45.038 - |ERROR| - [bacnet_uplink_converter.py] - bacnet_uplink_converter - __convert_data - 90 - Error converting object with objectId: "trend-log,3000590", and propertyId: "present-value". Error: <bacpypes3.primitivedata.ErrorType object at 0x7f82501e9d50>
Dez 09 10:22:45 thingsboard-iot-gateway python3[3088500]: 2025-12-09 10:22:45.038 - |ERROR| - [bacnet_uplink_converter.py] - bacnet_uplink_converter - __convert_data - 90 - Error converting object with objectId: "trend-log,3000666", and propertyId: "present-value". Error: <bacpypes3.primitivedata.ErrorType object at 0x7f82501ebed0>

hoffi085 avatar Dec 09 '25 09:12 hoffi085

@hoffi085, could you try to use Wireshark to confirm whether the IAm response was sent or not by this device?

samson0v avatar Dec 09 '25 09:12 samson0v

Hi, yes it seems that the 'who-Is' -> 'i-Am' is sent:

14	14.523670	XX.XX.0.232	XX.XX.0.93	BACnet-APDU	50	Unconfirmed-REQ who-Is 
15	14.527180	XX.XX.0.93	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,500 
16	14.528397	XX.XX.0.232	XX.XX.0.66	BACnet-APDU	50	Unconfirmed-REQ who-Is 
17	14.533473	XX.XX.0.66	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,519 
18	14.534911	XX.XX.0.232	XX.XX.0.99	BACnet-APDU	50	Unconfirmed-REQ who-Is 
19	14.538603	XX.XX.0.99	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,502 
20	14.539685	XX.XX.0.232	XX.XX.7.82	BACnet-APDU	50	Unconfirmed-REQ who-Is 
21	14.545854	XX.XX.7.82	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,2200010 
22	14.546907	XX.XX.0.232	XX.XX.7.146	BACnet-APDU	50	Unconfirmed-REQ who-Is 
23	14.568198	XX.XX.7.146	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,500 

hoffi085 avatar Dec 09 '25 09:12 hoffi085

@hoffi085, do you see the log 'Received APDU, from %s, trying to find device...', device_address where device_address is the problem device address (in your case 10.70.0.232)?

samson0v avatar Dec 09 '25 16:12 samson0v

Hi, yes I do see: Dez 10 17:14:58 thingsboard-iot-gateway python3[3257259]: 2025-12-10 17:14:58.810 - |INFO| - [bacnet_connector.py] - bacnet_connector - indication_callback - 306 - Received APDU, from XX.XX.7.146, trying to find device...

hoffi085 avatar Dec 10 '25 16:12 hoffi085

What I found out is, when I remove the device XX.XX.0.93 from the configuration, device XX.XX.7.146 works. Maybe this has to do with the same Object-ID? Both devices have ID 500:

14	14.523670	XX.XX.0.232	XX.XX.0.93	BACnet-APDU	50	Unconfirmed-REQ who-Is 
15	14.527180	XX.XX.0.93	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,500 
22	14.546907	XX.XX.0.232	XX.XX.7.146	BACnet-APDU	50	Unconfirmed-REQ who-Is 
23	14.568198	XX.XX.7.146	XX.XX.0.232	BACnet-APDU	62	Unconfirmed-REQ i-Am device,500 

hoffi085 avatar Dec 10 '25 16:12 hoffi085

@hoffi085 ok, I will try to reproduce this scenario and let you know about the result. Let's stay in touch.

samson0v avatar Dec 12 '25 09:12 samson0v