thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.75k stars 845 forks source link

[BUG] TBGW 3.4.3 BACnet reads once then stops - connector or logger issue? #1225

Closed HarvUK closed 1 week ago

HarvUK commented 1 year ago

Describe the bug Following the fix from https://github.com/thingsboard/thingsboard-gateway/pull/1224 Restarting docker, then changing the general address say from 0.0.0.0:47808 to 0.0.0.0:47809 means that the connector pulls and uploads one set of data. Then after the specified poll period (in this case 300000 or 5 min), no more data is read. Even changing the port again has no impact.

There is now an error in the tb_logger appearing - see the traceback below, this begins after the poll period has elapsed, so it has to be related.

This data came from the read at 12:32.

image

I don't know if it's because the BACnet connector is stopped after the read, or if it's the logger causing the issue.

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

BACnet connector- just the top bit

{
  "general": {
    "objectName": "TB_gateway1",
    "address": "0.0.0.0:47808",
    "objectIdentifier": 599,
    "maxApduLengthAccepted": 1476,
    "segmentationSupported": "segmentedBoth",
    "vendorIdentifier": 15
  },
  "devices": [
    {
      "deviceName": "DEVICE",
      "deviceType": "default",
      "address": "192.168.21.242:47808",
      "pollPeriod": 300000,
      "timeseries": [
        {
          "key": "Buffer Top Temp",
          "objectId": "analogInput:0",
          "propertyId": "presentValue"
        },

ETC ETC

Error traceback (If available):

2023-11-09 12:32:02 2023-11-09 12:32:02 - |DEBUG| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_connector_configuration_update - 380 - Processing connectors configuration update...
2023-11-09 12:32:02 2023-11-09 12:32:02 - |DEBUG| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - create_configuration_file_backup - 595 - Backup file created for configuration file bacTest.json in //thingsboard_gateway/config/backup/bacTest.json_backup_1699533122
2023-11-09 12:32:03 2023-11-09 12:32:03 - |INFO| - [bacnet_connector.py] - bacnet_connector - close - 126 - BACnet connector has been stopped.
2023-11-09 12:37:15 2023-11-09 12:37:15 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse
2023-11-09 12:37:15 NoneType: None
2023-11-09 12:37:27 2023-11-09 12:37:27 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse
2023-11-09 12:37:27 NoneType: None
2023-11-09 12:37:39 2023-11-09 12:37:39 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse
2023-11-09 12:37:39 NoneType: None
2023-11-09 12:37:51 2023-11-09 12:37:51 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse

Versions (please complete the following information): OS: Windows 11, Docker Desktop 4.24.2 Thingsboard IoT Gateway version [e.g. 2.0] 3.4.2 Python version[e.g. 3.7] 3.11.6

HarvUK commented 12 months ago

Is there any more information or logs I can provide to help with this.

Happy to do a screen share or anything to move this on.

Harv

HarvUK commented 11 months ago

UPDATE, have updated the docker image to 3.4.3, it still gives an error, the connector appears to function a couple of times and then stop.

Full logs below:-

2023-11-23 11:22:36 2023-11-23 11:22:36 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 2, method: getTermInfo 2023-11-23 11:22:42 2023-11-23 11:22:42 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 3, method: sendCommand 2023-11-23 11:22:43 2023-11-23 11:22:43 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 4, method: getCommandStatus 2023-11-23 11:22:50 2023-11-23 11:22:50 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 5, method: sendCommand 2023-11-23 11:22:50 2023-11-23 11:22:50 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 6, method: getCommandStatus 2023-11-23 11:22:52 2023-11-23 11:22:52 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 7, method: sendCommand 2023-11-23 11:22:53 2023-11-23 11:22:53 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 8, method: getCommandStatus 2023-11-23 11:22:57 2023-11-23 11:22:57 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 9, method: sendCommand 2023-11-23 11:22:57 2023-11-23 11:22:57 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - rpc_gateway_processing - 1180 - Received RPC request to the gateway, id: 10, method: getCommandStatus 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [bacnet_connector.py] - bacnet_connector - close - 126 - BACnet connector has been stopped. 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_grpc_configuration_update - 380 - Processed GRPC configuration update successfully 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_storage_configuration_update - 355 - Processed storage configuration update successfully 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 285 - Processing general configuration update 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 287 - --- Checking connection configuration changes... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 297 - --- Connection configuration not changed. 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 299 - --- Checking statistics configuration changes... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 307 - --- Statistics configuration not changed. 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 309 - --- Checking device filtering configuration changes... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 311 - ---- Device filtering configuration changed. Processing... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 318 - --- Checking Remote Shell configuration changes... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 320 - ---- Remote Shell configuration changed. Processing... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 327 - --- Checking other configuration parameters changes... 2023-11-23 11:23:52 2023-11-23 11:23:52 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _handle_general_configuration_update - 330 - --- Saving new general configuration... 2023-11-23 11:25:38 Requirement already satisfied: mmh3 in /usr/local/lib/python3.11/site-packages (4.0.1) 2023-11-23 11:25:39 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv 2023-11-23 11:25:39 Cannot load GRPC connector! 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 195 - Gateway starting... 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 200 - ThingsBoard IoT gateway version: 3.4.3 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_gateway_mqtt.py] - tb_gateway_mqtt - gw_subscribe_to_attribute - 184 - Subscribed to | with id 1 for device * 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_loader.py] - tb_loader - import_module - 68 - Import BACnetConnector from /thingsboard_gateway/connectors/bacnet. 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_loader.py] - tb_loader - import_module - 68 - Import BACnetUplinkConverter from /thingsboard_gateway/connectors/bacnet. 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_loader.py] - tb_loader - import_module - 68 - Import BACnetDownlinkConverter from /thingsboard_gateway/connectors/bacnet. 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - init - 64 - Remote Configurator started 2023-11-23 11:25:39 2023-11-23 11:25:39 - |INFO| - [tb_gateway_remote_configurator.py] - tb_gateway_remote_configurator - _send_default_connectors_config - 122 - Waiting for remote gateway version... 2023-11-23 11:25:40 Traceback (most recent call last): 2023-11-23 11:25:40 File "//./thingsboard_gateway/tb_gateway.py", line 41, in 2023-11-23 11:25:40 main() 2023-11-23 11:25:40 File "//./thingsboard_gateway/tb_gateway.py", line 33, in main 2023-11-23 11:25:40 TBGatewayService(path.dirname(path.abspath(file)) + '/config/tb_gateway.json'.replace('/', path.sep)) 2023-11-23 11:25:40 File "/thingsboard_gateway/gateway/tb_gateway_service.py", line 302, in init 2023-11-23 11:25:40 self.__init_remote_configuration() 2023-11-23 11:25:40 File "/thingsboard_gateway/gateway/tb_gateway_service.py", line 533, in init_remote_configuration 2023-11-23 11:25:40 self.remote_configurator.send_current_configuration() 2023-11-23 11:25:40 File "/thingsboard_gateway/tb_utility/tb_gateway_remote_configurator.py", line 213, in send_current_configuration 2023-11-23 11:25:40 self._gateway.tb_client.client.send_attributes( 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/site-packages/tb_device_mqtt.py", line 473, in send_attributes 2023-11-23 11:25:40 return self.publish_data(attributes, ATTRIBUTES_TOPIC, quality_of_service) 2023-11-23 11:25:40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/site-packages/tb_device_mqtt.py", line 457, in publish_data 2023-11-23 11:25:40 data = dumps(data) 2023-11-23 11:25:40 ^^^^^^^^^^^ 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/json/init.py", line 231, in dumps 2023-11-23 11:25:40 return _default_encoder.encode(obj) 2023-11-23 11:25:40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/json/encoder.py", line 200, in encode 2023-11-23 11:25:40 chunks = self.iterencode(o, _one_shot=True) 2023-11-23 11:25:40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/json/encoder.py", line 258, in iterencode 2023-11-23 11:25:40 return _iterencode(o, 0) 2023-11-23 11:25:40 ^^^^^^^^^^^^^^^^^ 2023-11-23 11:25:40 File "/usr/local/lib/python3.11/json/encoder.py", line 180, in default 2023-11-23 11:25:40 raise TypeError(f'Object of type {o.class.name__} ' 2023-11-23 11:25:40 TypeError: Object of type BACnetUplinkConverter is not JSON serializable 2023-11-23 11:30:51 2023-11-23 11:30:51 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:30:51 NoneType: None 2023-11-23 11:31:03 2023-11-23 11:31:03 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:31:03 NoneType: None 2023-11-23 11:31:15 2023-11-23 11:31:15 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:31:15 NoneType: None 2023-11-23 11:31:27 2023-11-23 11:31:27 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:31:27 NoneType: None 2023-11-23 11:31:39 2023-11-23 11:31:39 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:31:39 NoneType: None 2023-11-23 11:31:51 2023-11-23 11:31:51 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:31:51 NoneType: None 2023-11-23 11:32:03 2023-11-23 11:32:03 - |ERROR| - [tb_logger.py] - tb_logger - exception - 97 - noResponse 2023-11-23 11:32:03 NoneType: None