python - 连接时无法找到暗淡的设备,但在扫描时
问题描述
您好,我需要一点帮助,我正在运行带有 Logilink BT Stick 的 raspberry 4 (Ubuntu)。
BlueZ 是版本:5.56-0ubuntu4.2
我的目标是在https://github.com/atc1441/ATC_MiThermometer之后闪现的小米温度计
与 gatttool 的连接和接收更新工作没有问题,设备距离 pi 2m。
我已经使用了这里列出的两个代码: https ://github.com/hbldh/bleak
第一个列出的代码有效并向我展示了 mac,但第二个每次都死了。
与 gatttool 的连接和接收更新工作没有问题,设备距离馅饼 2m。
我使用了这里列出的代码: https ://github.com/hbldh/bleak
第一个列出的代码有效并向我展示了 mac,但第二个每次都死了。
python3 i.py
Traceback (most recent call last):
File "/var/www/bt2/i.py", line 13, in <module>
loop.run_until_complete(test())
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/var/www/bt2/i.py", line 8, in test
await client.connect(timeout=500.0)
File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/client.py", line 236, in connect
raise BleakError(
bleak.exc.BleakError: Device with address A4:C1:38:82:8A:50 could not be found. Try increasing `timeout` value or moving the device closer
解决方案
推荐阅读
- python-3.x - 使用 slurm 运行 python3 多处理作业会产生很多 core.###### 文件。这些是什么?
- javascript - 向查找中的目标集合添加别名
- bash - Bash 脚本错误“:未找到”和语法错误:意外“(”
- android - 低功耗蓝牙(ESP32 和 Android 智能手机之间):数据传输很慢
- android - 是否可以在 Android 中更改 SettingsClient 的本地化?
- python - 如何使用 ruamel.yaml 自动转储嵌套字典中的修改值?
- javascript - 从 AJAX 调用创建可共享 URL
- python - 代码工作正常,但有问题
- python - 如何使用 python 自动从外部连接的设备传输文件?
- python - 枢轴/转置数据帧