0

我正在尝试使用 thingsboard IoT 网关连接到 thingsboard 服务器。我已遵循以下链接中给出的所有步骤:https ://thingsboard.io/docs/iot-gateway/install/source-installation/

使用命令运行 tb-gateway 时:python3 ./thingsboard_gateway/tb_gateway.py 我收到以下错误消息:

 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)

我在各个文件中做了以下更改:

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

感谢你的帮助。提前致谢。

4

1 回答 1

0

你有服务器吗?我来解释一下我的方法。例如我有一个 TCP 服务器。但是我不能直接连接我的 TCP 服务器作为 thingsboard 的客户端。但是每个人都可以作为 mqtt 客户端连接到 thingsboard。只有一个角色,您需要在 thingsboard 中知道您的设备访问令牌。mqtt://demo.thingsboard.io, { username: "ACCESS_TOKEN" }如果您知道访问令牌,则可以使用url 和主题作为客户端连接到 thingsboard v1/devices/me/telemetry。使用 node.js 运行的示例 js 代码。var client = mqtt.connect('mqtt://demo.thingsboard.io' + { username: "AccessToken" });并发布client.publish('v1/devices/me/telemetry', JSON.stringify(data));

于 2020-12-26T18:20:00.483 回答