本帖最后由 令狐鸣 于 2019-9-25 22:43 编辑
大佬求助啊~
首先感谢一下,这个方法太好了,树莓派刚好换成虚拟机服务器一直用蓝牙usb距离不够,家里蓝牙设备失联好久.
用闲置的树莓派按步骤一切正常,ha完美读取蓝牙设备.
但是有个问题,不知道我的什么原因,不稳定,运行一段时间就报错停止,再打不开,必须重启树莓派才能.抽风时间不定.研究了下日志基本相同,求给看看可能是什么问题.
日志:
首先会报这些
Fatal error while executing worker command: BTLEManagementError
Traceback (most recent call last):
File "gateway.py", line 91, in <module>
raise e
File "gateway.py", line 73, in <module>
mqtt.publish(_WORKERS_QUEUE.get(timeout=10).execute())
File "/opt/bt-mqtt-gateway/workers_manager.py", line 55, in execute
messages = self._callback(*self._args)
然后是不同设备,每次不一样,感觉是刚好碰上那个就是哪个
File "/opt/bt-mqtt-gateway/workers/miscale.py", line 22, in status_update
topic=self.format_topic("weight/kg"), payload=self._get_weight()
File "/opt/bt-mqtt-gateway/workers/miscale.py", line 31, in _get_weight
scanner.scan(self.SCAN_TIMEOUT, passive=True)
##########################
File "/opt/bt-mqtt-gateway/workers/btrssi.py", line 77, in status_update
devices = scanner.scan(5.0)
之后基本又相同btle.py问题
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 854, in scan
self.stop()
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 803, in stop
self._mgmtCmd(self._cmd()+"end")
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 312, in _mgmtCmd
raise BTLEManagementError("Failed to execute management command '%s'" % (cmd), rsp)
bluepy.btle.BTLEManagementError: Failed to execute management command 'pasvend'
python也不太懂,这个方法真是看到了希望.希望可以完美运用.
不知道是不是python或者Bluez版本问题.
用的3.7和5.5
|