Fix logging the wrong bluetooth adapter while connecting and out of slots (#83158)

pull/83168/head
J. Nick Koston 2022-12-02 13:24:12 -10:00 committed by GitHub
parent 5a8cf38552
commit 144f1b918b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 6 deletions

View File

@ -7,7 +7,7 @@
"quality_scale": "internal",
"requirements": [
"bleak==0.19.2",
"bleak-retry-connector==2.8.7",
"bleak-retry-connector==2.8.9",
"bluetooth-adapters==0.11.0",
"bluetooth-auto-recovery==0.5.3",
"bluetooth-data-tools==0.3.0",

View File

@ -12,7 +12,7 @@ from bleak import BleakClient, BleakError
from bleak.backends.client import BaseBleakClient, get_platform_client_backend_type
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementDataCallback, BaseBleakScanner
from bleak_retry_connector import NO_RSSI_VALUE
from bleak_retry_connector import NO_RSSI_VALUE, ble_device_description
from homeassistant.core import CALLBACK_TYPE, callback as hass_callback
from homeassistant.helpers.frame import report
@ -189,7 +189,15 @@ class HaBleakClientWrapper(BleakClient):
timeout=self.__timeout,
hass=models.MANAGER.hass,
)
return await super().connect(**kwargs)
if debug_logging := _LOGGER.isEnabledFor(logging.DEBUG):
# Only lookup the description if we are going to log it
description = ble_device_description(wrapped_backend.device)
rssi = wrapped_backend.device.rssi
_LOGGER.debug("%s: Connecting (last rssi: %s)", description, rssi)
connected = await super().connect(**kwargs)
if debug_logging:
_LOGGER.debug("%s: Connected (last rssi: %s)", description, rssi)
return connected
@hass_callback
def _async_get_backend_for_ble_device(

View File

@ -10,7 +10,7 @@ atomicwrites-homeassistant==1.4.1
attrs==21.2.0
awesomeversion==22.9.0
bcrypt==3.1.7
bleak-retry-connector==2.8.7
bleak-retry-connector==2.8.9
bleak==0.19.2
bluetooth-adapters==0.11.0
bluetooth-auto-recovery==0.5.3

View File

@ -422,7 +422,7 @@ bimmer_connected==0.10.4
bizkaibus==0.1.1
# homeassistant.components.bluetooth
bleak-retry-connector==2.8.7
bleak-retry-connector==2.8.9
# homeassistant.components.bluetooth
bleak==0.19.2

View File

@ -346,7 +346,7 @@ bellows==0.34.5
bimmer_connected==0.10.4
# homeassistant.components.bluetooth
bleak-retry-connector==2.8.7
bleak-retry-connector==2.8.9
# homeassistant.components.bluetooth
bleak==0.19.2