hbldh / bleak

A cross platform Bluetooth Low Energy Client for Python using asyncio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ZeldricTom opened this issue · comments

  • 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())

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.

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.

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.

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

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.

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