我正在尝试在 Raspberry PI 上使用 thingsboard Gateway,但网关仍然处于非活动状态。
我可以通过 mqtt 使用以下命令将数据从 Raspberry PI 发送到 thingsboard 服务器实例来手动将其设置为活动状态:
mosquitto_pub -d -q 1 -h <my-thingsboard-ip> -p 1883 -t v1/devices/me/telemetry -u "<my-token>" -m "{temperature:25}"
但统计数据应从 Thingsboard 网关发送以将其设置为活动状态,但事实并非如此。
安装时我遵循这个tutoriel。
我也遵循了入门指南,但当我们不使用docker时它不适用。
在树莓派上,状态如下:
● thingsboard-gateway.service - ThingsBoard Gateway
Loaded: loaded (/etc/systemd/system/thingsboard-gateway.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-12-18 17:33:03 GMT; 9s ago
Main PID: 2400 (python3)
Tasks: 8 (limit: 755)
CPU: 2.937s
CGroup: /system.slice/thingsboard-gateway.service
└─2400 /var/lib/thingsboard_gateway/venv/bin/python3 -c "from thingsboard_gateway.tb_gateway import daemon; daemon()"
Dec 18 17:33:12 raspberrypi python3[2400]: self._sock = self._create_socket()
Dec 18 17:33:12 raspberrypi python3[2400]: ^^^^^^^^^^^^^^^^^^^^^
Dec 18 17:33:12 raspberrypi python3[2400]: File "/var/lib/thingsboard_gateway/venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 4612, in _create_socket
Dec 18 17:33:12 raspberrypi python3[2400]: sock = self._ssl_wrap_socket(sock)
Dec 18 17:33:12 raspberrypi python3[2400]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 18 17:33:12 raspberrypi python3[2400]: File "/var/lib/thingsboard_gateway/venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 4671, in _ssl_wrap_socket
Dec 18 17:33:12 raspberrypi python3[2400]: ssl_sock.do_handshake()
Dec 18 17:33:12 raspberrypi python3[2400]: File "/usr/lib/python3.11/ssl.py", line 1379, in do_handshake
Dec 18 17:33:12 raspberrypi python3[2400]: self._sslobj.do_handshake()
Dec 18 17:33:12 raspberrypi python3[2400]: ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:992)
Dec 18 16:16:38 raspberrypi systemd[1]: Started thingsboard-gateway.service - ThingsBoard Gateway.
这里是配置文件。我也尝试不使用“customStatsSendPeriodInSeconds”和“配置”字段:
{
"thingsboard": {
"host": "<ip>",
"port": 1883,
"remoteShell": false,
"remoteConfiguration": true,
"latencyDebugMode": false,
"statistics": {
"enable": true,
"statsSendPeriodInSeconds": 60,
"customStatsSendPeriodInSeconds": 300,
"configuration": "statistics.json",
"commands": []
},
....
我已经按照以下步骤在树莓派上安装了docker:
https://docs.docker.com/engine/install/debian/
因为我使用的是 64 位架构。然后使用 thingboard 提供的配置启动 docker compose(仪表板 -> ThingsBoard IoT 网关 -> 我的网关 -> 启动命令)
如果有人遇到麻烦,我想我错误配置了一些凭证/安全内容,正如我们从 docker 镜像命令中看到的那样: