MQTT Issue while running Thingsboard IOT gateway

1.3k views Asked by At

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 - 157 - Number of rejected mapping handlers: 0"
 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.

1

There are 1 answers

0
SefaUn On

Do you have any server ? I gonna explain my method. for example I have a TCP server. But I can not directly connect with my TCP server as a client to thingsboard. But everyone can connect to thingsboard as a mqtt client. Just one role, you need to know your device access token in thingsboard. if you know access token you can connect to thingsboard as a client by using mqtt://demo.thingsboard.io, { username: "ACCESS_TOKEN" } url and v1/devices/me/telemetry topic. example js code that running with node.js. var client = mqtt.connect('mqtt://demo.thingsboard.io' + { username: "AccessToken" }); and to publish client.publish('v1/devices/me/telemetry', JSON.stringify(data));