Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth discovery fails with transmit_power_level_in_d_bm is not available on windows 18363 #1094

Closed
LaurentTetreault opened this issue Oct 28, 2022 · 0 comments · Fixed by #1095
Labels
Backend: WinRT Issues or PRs relating to the WinRT backend bug Something isn't working

Comments

@LaurentTetreault
Copy link

  • bleak version: 0.19.0
  • Python version: 3.9
  • Operating System: windows 10 version 1909 18363

Description

I try to run BleakScanner.discover with the code from the readme and it fails saying that transmit_power_level_in_d_bm property is not available. I expected to print in the terminal every bluetooth devices around my computer.

What I Did

I tested the code with bleak version 0.18.0 and it worked.

import asyncio
from bleak import BleakScanner

async def main():
    devices = await BleakScanner.discover()
    for d in devices:
        print(d)

asyncio.run(main())

Traceback (most recent call last):
  File "C:\Users\tetl1201\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\tetl1201\AppData\Local\Programs\Python\Python39\lib\site-packages\bleak\backends\winrt\scanner.py", line 159, in _received_handler
    if args.transmit_power_level_in_d_bm is not None:
AttributeError: property is not available in this version of Windows
Exception in callback BleakScannerWinRT._received_handler(<_bleak_winrt...0025957AACC90>, <_bleak_winrt...0025957AACA70>)
handle: <Handle BleakScannerWinRT._received_handler(<_bleak_winrt...0025957AACC90>, <_bleak_winrt...0025957AACA70>)>

Logs

2022-10-28 12:02:07,815 bleak.backends.winrt.scanner DEBUG: Received 6A:DF:59:88:3E:23: .
2022-10-28 12:02:07,816 bleak.backends.winrt.scanner DEBUG: skipping callback, waiting for scan response
2022-10-28 12:02:07,935 bleak.backends.winrt.scanner DEBUG: Received 2E:BD:06:A7:C9:E8: .

Exception in callback BleakScannerWinRT._received_handler(<_bleak_winrt...001575BE9D2D0>, <_bleak_winrt...001575BE9D430>)
handle: <Handle BleakScannerWinRT._received_handler(<_bleak_winrt...001575BE9D2D0>, <_bleak_winrt...001575BE9D430>)>
Traceback (most recent call last):
  File "C:\Users\tetl1201\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\tetl1201\AppData\Local\Programs\Python\Python39\lib\site-packages\bleak\backends\winrt\scanner.py", line 159, in _received_handler
    if args.transmit_power_level_in_d_bm is not None:
AttributeError: property is not available in this version of Windows

2022-10-28 12:02:07,939 bleak.backends.winrt.scanner DEBUG: Received 79:C5:6F:B8:69:22: .

And these messages repeat for 5 seconds.

@dlech dlech added bug Something isn't working Backend: WinRT Issues or PRs relating to the WinRT backend labels Oct 28, 2022
dlech added a commit that referenced this issue Oct 29, 2022
The transmit power property of the advertising data was added in Windows
build 19041, so we need a fallback for older versions of Windows.

Fixes #1094
dlech added a commit that referenced this issue Oct 29, 2022
The transmit power property of the advertising data was added in Windows
build 19041, so we need a fallback for older versions of Windows.

Fixes #1094
@dlech dlech mentioned this issue Oct 29, 2022
pmessan pushed a commit to workaroundgmbh/bleak that referenced this issue Nov 28, 2022
The transmit power property of the advertising data was added in Windows
build 19041, so we need a fallback for older versions of Windows.

Fixes hbldh#1094
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: WinRT Issues or PRs relating to the WinRT backend bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants