【问题标题】:MQTT Issue while running Thingsboard IOT gateway运行 Thingsboard IOT 网关时出现 MQTT 问题
【发布时间】:2021-03-23 15:25:18
【问题描述】:

我正在尝试使用 thingsboard 物联网网关连接到 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

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

【问题讨论】:

    标签: arduino mqtt thingsboard thingsboard-gateway


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-25
      • 1970-01-01
      • 2021-03-24
      • 1970-01-01
      • 1970-01-01
      • 2016-03-30
      • 2021-06-14
      相关资源
      最近更新 更多