You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating System: Windows 11 Pro (10.0.26100 N/A Build 26100)
Description
Hello, I am trying to connect to a BLE peripheral (VTM 20F pulse oximeter) using bleak. My script works on MacOS (15.0 Build 24A335), but on Windows I get a TimeoutError. Note that I am able to connect to other BLE peripherals on my Windows setup, but this particular device is not cooperating. I have included debug output for both Windows (not working) and MacOS (working). Let me know if any other information could be helpful.
What I Did
Minimum workable example:
import asyncio
from bleak import BleakClient, BleakScanner
async def main():
MYPERIPHERAL = "VTM 20F"
print(f"Scanning for {MYPERIPHERAL}...")
device = await BleakScanner.find_device_by_name(MYPERIPHERAL)
if device is None:
print(f"Could not find {MYPERIPHERAL}")
return
print(f"Found device: {device.name} ({device.address})")
async with BleakClient(device, timeout=30) as client:
print(f"Connected to {client}!")
await asyncio.sleep(3)
print("Disconnected!")
if __name__ == "__main__":
asyncio.run(main())
Output on Windows:
Traceback (most recent call last):
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\backends\winrt\client.py", line 487, in connect
self.services = await self.get_services(
^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
)
^
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\backends\winrt\client.py", line 720, in get_services
await FutureLike(self._requester.get_gatt_services_async(*srv_args)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\backends\winrt\client.py", line 1129, in __await__
yield self # This tells Task to wait for completion.
^^^^^^^^^^
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\backends\winrt\client.py", line 1072, in result
raise asyncio.CancelledError
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\mybleakapp\mybleakapp.py", line 30, in <module>
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "C:\Users\myuser\.pyenv\pyenv-win\versions\3.13.0\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "C:\Users\myuser\.pyenv\pyenv-win\versions\3.13.0\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\myuser\.pyenv\pyenv-win\versions\3.13.0\Lib\asyncio\base_events.py", line 721, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "c:\mybleakapp\mybleakapp.py", line 22, in main
async with BleakClient(device) as client:
~~~~~~~~~~~^^^^^^^^
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\__init__.py", line 570, in __aenter__
await self.connect()
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\__init__.py", line 615, in connect
return await self._backend.connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\mybleakapp\.venv\Lib\site-packages\bleak\backends\winrt\client.py", line 443, in connect
async with async_timeout(timeout):
~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\myuser\.pyenv\pyenv-win\versions\3.13.0\Lib\asyncio\timeouts.py", line 116, in __aexit__
raise TimeoutError from exc_val
TimeoutError
Description
Hello, I am trying to connect to a BLE peripheral (VTM 20F pulse oximeter) using bleak. My script works on MacOS (15.0 Build 24A335), but on Windows I get a TimeoutError. Note that I am able to connect to other BLE peripherals on my Windows setup, but this particular device is not cooperating. I have included debug output for both Windows (not working) and MacOS (working). Let me know if any other information could be helpful.
What I Did
Minimum workable example:
Output on Windows:
Logs
Debug log for Windows:
Debug log for MacOS:
The text was updated successfully, but these errors were encountered: