树莓派安装Thingsboard-gateway遇到的问题
1、下载安装包
wget https://github.com/thingsboard/thingsboard-gateway/releases/latest/download/python3-thingsboard-gateway.deb
2、使用apt安装网关
以软件包形式安装ThingsBoard网关并以守护程序身份运行,请使用以下命令:
sudo apt install ./python3-thingsboard-gateway.deb -y
deb软件包将自动安装必要的库,以使IOT网关正常工作:
-
系统库:libffi-dev,libglib2.0-dev,libxml2-dev,libxslt-dev,libssl-dev,zlib1g-dev,python3-dev,python3-pip。
-
Python模块:importlib,importlib-metadata,jsonschema,pymodbus,lxml,jsonpath-rw,paho-mqtt,pyserial,PyYAML,simplejson,pysistent。
3、检查网关状态
systemctl status thingsboard-gateway
出现如下信息则表示没有配置网关和ThingsBoard连接:
-
5月 02 17:09:12 raspberrypi python3[15068]: ""2022-05-02 17:09:12" - |ERROR| - [mqtt_connector.py] - mqtt_connector - load_handlers - 159 - attributeRequests handler is missing some mandatory keys => rejected: {"retain": false, "topicFilt
-
5月 02 17:09:12 raspberrypi python3[15068]: ""2022-05-02 17:09:12" - |INFO| - [mqtt_connector.py] - mqtt_connector - load_handlers - 167 - Number of accepted attributeRequests handlers: 0"
**在这一步我出现了与安装步骤不同的问题:
-
root@raspberrypi:/etc/thingsboard-gateway/config# systemctl status thingsboard-gateway
-
● thingsboard-gateway.service - ThingsBoard Gateway
-
Loaded: loaded (/etc/systemd/system/thingsboard-gateway.service; enabled; vendor preset: enabled)
-
Active: failed (Result: exit-code) since Mon 2022-05-02 16:54:19 CST; 1min 12s ago
-
Process: 13379 ExecStart=/usr/bin/python3 -c from thingsboard_gateway.tb_gateway import daemon; daemon() (code=exi
-
Main PID: 13379 (code=exited, status=1/FAILURE)
-
-
5月 02 16:54:19 raspberrypi systemd[1]: thingsboard-gateway.service: Service RestartSec=100ms expired, scheduling re
-
5月 02 16:54:19 raspberrypi systemd[1]: thingsboard-gateway.service: Scheduled restart job, restart counter is at 5.
-
5月 02 16:54:19 raspberrypi systemd[1]: Stopped ThingsBoard Gateway.
-
5月 02 16:54:19 raspberrypi systemd[1]: thingsboard-gateway.service: Start request repeated too quickly.
-
5月 02 16:54:19 raspberrypi systemd[1]: thingsboard-gateway.service: Failed with result 'exit-code'.
-
5月 02 16:54:19 raspberrypi systemd[1]: Failed to start ThingsBoard Gateway.
-
lines 1-12/12 (END)...skipping...
thingsboard-gateway重启后,状态总是失败,解决办法如下:
1、查看thingsboard-gateway日志
journalctl -u thingsboard-gateway.service
journalctl 是查看日志命令,-u则是指定单元。上述命令查看thingsboard-gateway单元日志
日志中发现
-
5月 02 16:17:24 raspberrypi python3[1675]: Traceback (most recent call last):
-
5月 02 16:17:24 raspberrypi python3[1675]: File "<string>", line 1, in <module>
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: from thingsboard_gateway.gateway.tb_gateway_service import TBGatew
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: from thingsboard_gateway.gateway.grpc_service.grpc_connector impor
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: from thingsboard_gateway.gateway.grpc_service.tb_grpc_manager impo
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: from thingsboard_gateway.gateway.grpc_service.grpc_downlink_conver
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: from thingsboard_gateway.gateway.proto.messages_pb2 import *
-
5月 02 16:17:24 raspberrypi python3[1675]: File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-3.0
-
5月 02 16:17:24 raspberrypi python3[1675]: create_key=_descriptor._internal_create_key,
-
5月 02 16:17:24 raspberrypi python3[1675]: AttributeError: module '谷歌.protobuf.descriptor' has no attribute '
到最后一步报错,网上查询解决办法,是要将protoc和porobuf版本一致,但是用protoc --version无法查看版本。
使用以下命令:
pip install --upgrade protobuf
更新protobuf后,重启thingsboard-gateway
thingsboard-gateway正常
启动如下:
-
root@raspberrypi:/etc/thingsboard-gateway/config# systemctl status thingsboard-gateway
-
● thingsboard-gateway.service - ThingsBoard Gateway
-
Loaded: loaded (/etc/systemd/system/thingsboard-gateway.service; enabled; vendor preset: enabled)
-
Active: active (running) since Mon 2022-05-02 17:08:38 CST; 8s ago
-
Main PID: 15068 (python3)
-
Tasks: 8 (limit: 4915)
-
CGroup: /system.slice/thingsboard-gateway.service
-
├─15068 /usr/bin/python3 -c from thingsboard_gateway.tb_gateway import daemon; daemon()
-
└─15080 /usr/bin/python3 -m pip install pymodbus>=2.3.0 --user
因为我使用CH340,USB转串口工具,后面tb-gateway还会有另外一个报错,后面的文章再说
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhfjajhi
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
怎样阻止微信小程序自动打开
PHP中文网 06-13