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

feat: add debug logging for connection paths #154

Merged
merged 8 commits into from
Feb 21, 2025
14 changes: 14 additions & 0 deletions src/habluetooth/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,20 @@ def _async_get_best_available_backend_and_device(
reverse=True,
)

if sorted_devices and _LOGGER.isEnabledFor(logging.DEBUG):
_LOGGER.debug(
"%s - %s: Found %s connection path(s), preferred order: %s",
address,
sorted_devices[0].ble_device.name,
len(sorted_devices),
", ".join(
f"{device.scanner.name} "
f"(RSSI={device.advertisement.rssi}) "
f"(failures={self.__connect_failures.get(device.scanner, 0)})"
for device in sorted_devices
),
)

for device in sorted_devices:
if backend := self._async_get_backend_for_ble_device(
manager, device.scanner, device.ble_device
Expand Down