Bump habluetooth to 2.8.0 (#115789)

* Bump habluetooth to 2.8.0

Adds support for recovering some adapters that fail to initialize
due to kernel races

* bump lib

* tweak
This commit is contained in:
J. Nick Koston 2024-04-18 09:37:20 -05:00 committed by GitHub
parent 74afed3b6d
commit fbdef7f5cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 16 deletions

View File

@ -53,7 +53,6 @@ from homeassistant.loader import async_get_bluetooth
from . import models, passive_update_processor from . import models, passive_update_processor
from .api import ( from .api import (
_get_manager,
async_address_present, async_address_present,
async_ble_device_from_address, async_ble_device_from_address,
async_discovered_service_info, async_discovered_service_info,
@ -130,13 +129,6 @@ _LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN) CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
async def _async_get_adapter_from_address(
hass: HomeAssistant, address: str
) -> str | None:
"""Get an adapter by the address."""
return await _get_manager(hass).async_get_adapter_from_address(address)
async def _async_start_adapter_discovery( async def _async_start_adapter_discovery(
hass: HomeAssistant, hass: HomeAssistant,
manager: HomeAssistantBluetoothManager, manager: HomeAssistantBluetoothManager,
@ -303,17 +295,16 @@ async def async_update_device(
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a config entry for a bluetooth scanner.""" """Set up a config entry for a bluetooth scanner."""
manager: HomeAssistantBluetoothManager = hass.data[DATA_MANAGER]
address = entry.unique_id address = entry.unique_id
assert address is not None assert address is not None
adapter = await _async_get_adapter_from_address(hass, address) adapter = await manager.async_get_adapter_from_address_or_recover(address)
if adapter is None: if adapter is None:
raise ConfigEntryNotReady( raise ConfigEntryNotReady(
f"Bluetooth adapter {adapter} with address {address} not found" f"Bluetooth adapter {adapter} with address {address} not found"
) )
passive = entry.options.get(CONF_PASSIVE) passive = entry.options.get(CONF_PASSIVE)
mode = BluetoothScanningMode.PASSIVE if passive else BluetoothScanningMode.ACTIVE mode = BluetoothScanningMode.PASSIVE if passive else BluetoothScanningMode.ACTIVE
manager: HomeAssistantBluetoothManager = hass.data[DATA_MANAGER]
scanner = HaScanner(mode, adapter, address) scanner = HaScanner(mode, adapter, address)
scanner.async_setup() scanner.async_setup()
try: try:

View File

@ -10,7 +10,7 @@ from bluetooth_adapters import get_dbus_managed_objects
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from . import _get_manager from .api import _get_manager
async def async_get_config_entry_diagnostics( async def async_get_config_entry_diagnostics(

View File

@ -20,6 +20,6 @@
"bluetooth-auto-recovery==1.4.1", "bluetooth-auto-recovery==1.4.1",
"bluetooth-data-tools==1.19.0", "bluetooth-data-tools==1.19.0",
"dbus-fast==2.21.1", "dbus-fast==2.21.1",
"habluetooth==2.7.0" "habluetooth==2.8.0"
] ]
} }

View File

@ -28,7 +28,7 @@ dbus-fast==2.21.1
fnv-hash-fast==0.5.0 fnv-hash-fast==0.5.0
ha-av==10.1.1 ha-av==10.1.1
ha-ffmpeg==3.2.0 ha-ffmpeg==3.2.0
habluetooth==2.7.0 habluetooth==2.8.0
hass-nabucasa==0.78.0 hass-nabucasa==0.78.0
hassil==1.6.1 hassil==1.6.1
home-assistant-bluetooth==1.12.0 home-assistant-bluetooth==1.12.0

View File

@ -1029,7 +1029,7 @@ ha-philipsjs==3.1.1
habitipy==0.2.0 habitipy==0.2.0
# homeassistant.components.bluetooth # homeassistant.components.bluetooth
habluetooth==2.7.0 habluetooth==2.8.0
# homeassistant.components.cloud # homeassistant.components.cloud
hass-nabucasa==0.78.0 hass-nabucasa==0.78.0

View File

@ -843,7 +843,7 @@ ha-philipsjs==3.1.1
habitipy==0.2.0 habitipy==0.2.0
# homeassistant.components.bluetooth # homeassistant.components.bluetooth
habluetooth==2.7.0 habluetooth==2.8.0
# homeassistant.components.cloud # homeassistant.components.cloud
hass-nabucasa==0.78.0 hass-nabucasa==0.78.0