首页 > 解决方案 > 连接时无法找到暗淡的设备,但在扫描时

问题描述

您好,我需要一点帮助,我正在运行带有 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

标签: pythonbluezraspberry-pi4

解决方案


推荐阅读