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

Bleak returns a mac address that is 00:00:00:00:00:00 #1490

Open
ZeldricTom opened this issue Jan 5, 2024 · 7 comments
Open

Bleak returns a mac address that is 00:00:00:00:00:00 #1490

ZeldricTom opened this issue Jan 5, 2024 · 7 comments
Labels
3rd party issue The issue is with the Bluetooth stack, the BLE device, or other 3rd party code not with Bleak itself Backend: BlueZ Issues and PRs relating to the BlueZ backend

Comments

@ZeldricTom
Copy link

  • bleak version: 0.21.1
  • Python version: 3.9.2
  • Operating System: Raspbian GNU/Linux 11 (bullseye)
  • BlueZ version (bluetoothctl -v) in case of Linux: 5.66

Description

I'm trying to get the mac address from a BLE device. But it returns a mac address equal to -> 00:00:00:00:00:00

What I Did

Of course I tried to restart the rasp, I also tried to see if there bluetooth drivers I needed to install, but didn't find any. I was unable to find any good thread for this type of problem.

My code

Here is the code I use to get the mac addresses.

import asyncio
from bleak import BleakScanner

async def discover_devices():
devices = await BleakScanner.discover(timeout=20)
for device in devices:
print(f"Device: {device.name}, Address: {device.address}")

asyncio.run(discover_devices())

@ZeldricTom
Copy link
Author

Sans titre

Here is what my pc sees. Also, only this BLE device has this mac address. Every other bluetooth device has a correct mac address.

@dlech
Copy link
Collaborator

dlech commented Jan 5, 2024

Please see https://bleak.readthedocs.io/en/latest/troubleshooting.html to enable debug logging and how to log Bluetooth packets.

Bleak only reports the value returned by BlueZ so this is likely a BlueZ issue or an issue with the Bluetooth adapter.

@dlech dlech added 3rd party issue The issue is with the Bluetooth stack, the BLE device, or other 3rd party code not with Bleak itself Backend: BlueZ Issues and PRs relating to the BlueZ backend labels Jan 5, 2024
@ZeldricTom
Copy link
Author

ZeldricTom commented Jan 5, 2024

@dlech Here are the logs
https://pastebin.com/dGWPBpn4

@dlech
Copy link
Collaborator

dlech commented Jan 5, 2024

As seen in the second line of the logs:

2024-01-05 14:22:14,983 bleak.backends.bluezdbus.manager MainThread DEBUG: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_00_00_00_00_00_00):

BlueZ thinks the device address is all 0s.

@Nilon123456789
Copy link

Is there a way to fix the issue? Do we need to downgrade BlueZ to an earlier version?

@dlech
Copy link
Collaborator

dlech commented Jan 9, 2024

I would start with logging Bluetooth packets. If the device is actually sending the address 00:00:00:00:00:00 then there is nothing wrong with the software.

@Nilon123456789
Copy link

The device is sending a MAC address since I can see it on MacOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party issue The issue is with the Bluetooth stack, the BLE device, or other 3rd party code not with Bleak itself Backend: BlueZ Issues and PRs relating to the BlueZ backend
Projects
None yet
Development

No branches or pull requests

3 participants