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

[HELP]MQTT Issue while running Thingsboard IOT gateway #441

Closed Supriya2805 closed 3 years ago

Supriya2805 commented 3 years ago

Hello, I have thingsboard 2.4 built from source code on AWS EC2 in Windows 2016.

I am trying to connect to thingsboard server using thingsboard IoT gateway. I have followed all steps given in the below link : https://thingsboard.io/docs/iot-gateway/install/source-installation/

When running tb-gateway with command : python3 ./thingsboard_gateway/tb_gateway.py I am getting below error message

 INFO - [mqtt_connector.py] - mqtt_connector - 153 - Number of accepted serverSideRpc handlers: 2"
 INFO - [mqtt_connector.py] - mqtt_connector - 157 - Number of rejected serverSideRpc handlers: 0"
 INFO - [mqtt_connector.py] - mqtt_connector - 153 - Number of accepted connectRequests handlers: 2"
 INFO - [mqtt_connector.py] - mqtt_connector - 157 - Number of rejected connectRequests handlers: 0"
 INFO - [mqtt_connector.py] - mqtt_connector - 153 - Number of accepted disconnectRequests handlers: 2"
 INFO - [mqtt_connector.py] - mqtt_connector - 157 - Number of rejected disconnectRequests handlers: 0"
 ERROR - [mqtt_connector.py] - mqtt_connector - 130 - 'attributeRequests' section missing from configuration"
 INFO - [mqtt_connector.py] - mqtt_connector - 153 - Number of accepted attributeUpdates handlers: 1"
 INFO - [mqtt_connector.py] - mqtt_connector - 157 - Number of rejected attributeUpdates handlers: 0"
 INFO - [tb_gateway_service.py] - tb_gateway_service - 135 - Gateway started."
 ERROR - [tb_client.py] - tb_client - 132 - [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\thingsboard_gateway-2.5.4-py3.9.egg\thingsboard_gateway\gateway\tb_client.py", line 127, in run
    self.client.connect(keepalive=keep_alive,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\thingsboard_gateway-2.5.4-py3.9.egg\thingsboard_gateway\tb_client\tb_device_mqtt.py", line 167, in connect
    self._client.connect(self.__host, self.__port, keepalive=keepalive)

I have done below changes in the respective files :

mqtt.json

"broker": {
    "name":"Default Local Broker",
    "host":"IP Address",
    "port":1883,
    "clientId": "ThingsBoard_gateway",
    "security": {
      "type": "basic",
      "username": "**********",
      "password": "***********"
    }
  }

tb_gateway.yaml :

host: "IP Address"
  port: 1883
  remoteShell: false
  remoteConfiguration: false
  security:
    accessToken: ********************
  qos: 1
storage:
  type: memory
  read_records_count: 100
  max_records_count: 100000
connectors:
  -
    name: MQTT Broker Connector
    type: mqtt
    configuration: mqtt.json

Appreciate your help. Thanks in advance.

imbeacon commented 3 years ago

Hi @Supriya2805 ,

Thank you for your interest in ThingsBoard IoT gateway. It looks like some specific error for Windows platform, please try to use docker on Windows. Also you may try to update your paho-mqtt library using the following command: pip3 install paho-mqtt --upgrade It may help, but there is no guarantee, because we don't recommend to use the gateway with Windows platform. We don't have this option on our site.