0

Windows 10 设置:

  1. Thingsboard 服务器在 Windows 上作为本地服务运行

    Thingsboard.yml mqtt 参数

     MQTT server parameters
        mqtt:
          bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}"
          bind_port: "${MQTT_BIND_PORT:1883}"
          adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}"
          timeout: "${MQTT_TIMEOUT:10000}"
    
  2. Thingsboard 网关服务在 Windows 上作为本地服务运行

> tb-gateway.yml mqtt parameters
>     mqtt:
>       enabled: true
>       configuration: mqtt-config.json

mqtt的配置文件是默认设置的,如下。

mqtt-config.json mqtt parameters
 "brokers": [
    {
      "host": "localhost",
      "port": 1883,
      "ssl": false,
      "retryInterval": 3000,
      "credentials": {
        "type": "anonymous"
      },

这些是在我的笔记本电脑上运行的仅有的两个服务,我根据文档发布了如下 mqtt 消息:

mosquitto_pub -h localhost -p 1883 -u "XXXXXXXX" -t "sensors" -m '{"serialNumber":"TB-GW-SN-001","model":"TB-GW-T1000","temperature":35.2}'

我在两个日志中都看到了错误。

thingsboard.log

2018-01-10 20:14:56,174 [nioEventLoopGroup-6-11] INFO  o.t.s.t.mqtt.MqttTransportHandler - [mqtt815] Processing connect msg for client: efd91958-ba8f-480a-9a56-ad9d5588c8c7!
2018-01-10 20:14:56,177 [nioEventLoopGroup-6-12] INFO  o.t.s.t.mqtt.MqttTransportHandler - [127.0.0.1:51192] Invalid message received
2018-01-10 20:14:59,183 [nioEventLoopGroup-6-1] INFO  o.t.s.t.mqtt.MqttTransportHandler - [mqtt817] Processing connect msg for client: efd91958-ba8f-480a-9a56-ad9d5588c8c7!
2018-01-10 20:14:59,188 [nioEventLoopGroup-6-2] INFO  o.t.s.t.mqtt.MqttTransportHandler - [127.0.0.1:51194] Invalid message received
2018-01-10 20:15:02,193 [nioEventLoopGroup-6-3] INFO  o.t.s.t.mqtt.MqttTransportHandler - [mqtt819] Processing connect msg for client: efd91958-ba8f-480a-9a56-ad9d5588c8c7!
2018-01-10 20:15:02,197 [nioEventLoopGroup-6-4] INFO  o.t.s.t.mqtt.MqttTransportHandler - [127.0.0.1:51196] Invalid message received

thingsboard 网关中的错误很奇怪。

tb-gateway.log

2018-01-10 20:14:59,191 [main] WARN  o.t.g.e.m.client.MqttBrokerMonitor - [localhost:1883] MQTT broker connection failed!
org.eclipse.paho.client.mqttv3.MqttException: Connection lost
    at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:164)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: null
    at java.io.DataInputStream.readByte(Unknown Source)
    at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
    at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116)
    ... 1 common frames omitted
2018-01-10 20:15:02,198 [main] WARN  o.t.g.e.m.client.MqttBrokerMonitor - [localhost:1883] MQTT broker connection failed!
org.eclipse.paho.client.mqttv3.MqttException: Connection lost
    at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:164)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: null
    at java.io.DataInputStream.readByte(Unknown Source)
    at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
    at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116)
    ... 1 common frames omitted

我究竟做错了什么?我在本地安装了 mosquitto,因此使用 mosquitto_pub 工具发布消息。

任何线索,伙计们?

4

1 回答 1

0

一切都很好。

正如https://stackoverflow.com/users/3203737/andrew指出的那样,我没有运行 mosquitto 并且端口是相同的。我清理了乱七八糟的东西,设备在仪表板中使用 TB-gateway 完美注册。

于 2018-01-11T07:56:15.857 回答