hbldh / bleak

A cross platform Bluetooth Low Energy Client for Python using asyncio
MIT License
1.6k stars 279 forks source link

Could not start notify on 0011: Unreachable #1473

Open snowuyl opened 6 months ago

snowuyl commented 6 months ago

Description

I run main.py for testing Nordic UART service. But exception occurred with the following log messages.

Logs

D:\workspace_Python\bleak-example>python3 main.py Zephyr Bluetooth device D7:D2:19:5F:4D:5D Paired: True D:\workspace_Python\bleak-example\main.py:108: FutureWarning: is_connected has been changed to a property. Calling it as an async method will be removed in a future version x = await client.is_connected() manual C. Capture M. Measure S. Stop measure R. Reading result Q. Quit

Enter an option: Disconnected callback called! Exception in thread Thread-1 (thread_function): Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\threading.py", line 975, in run self._target(*self._args, self._kwargs) File "D:\workspace_Python\bleak-example\main.py", line 170, in thread_function loop.run_until_complete(run_uart(bt_mac_address, loop)) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "D:\workspace_Python\bleak-example\main.py", line 111, in run_uart await client.start_notify(UART_RX_UUID, notification_handler) File "C:\Users\broth\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\bleak\init__.py", line 834, in start_notify await self._backend.start_notify(characteristic, wrapped_callback, kwargs) File "C:\Users\broth\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\bleak\backends\winrt\client.py", line 973, in start_notify _ensure_success( File "C:\Users\broth\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\bleak\backends\winrt\client.py", line 163, in _ensure_success raise BleakError(f"{fail_msg}: Unreachable") bleak.exc.BleakError: Could not start notify on 0011: Unreachable

snowuyl commented 6 months ago

bleak-example.zip

snowuyl commented 6 months ago

Procedures to reproduce this issues are as follows.

  1. Unzipping bleak-example.zip to D:\workspace_Python folder.
  2. cd D:\workspace_Python\bleak-example
  3. python3 main.py