diff --git a/homeassistant/components/bluetooth/__init__.py b/homeassistant/components/bluetooth/__init__.py index 3ad8bb1c291b..f41817b092ef 100644 --- a/homeassistant/components/bluetooth/__init__.py +++ b/homeassistant/components/bluetooth/__init__.py @@ -25,6 +25,7 @@ from bluetooth_adapters import ( ) from bluetooth_data_tools import monotonic_time_coarse as MONOTONIC_TIME from habluetooth import ( + FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS, BaseHaRemoteScanner, BaseHaScanner, BluetoothReachabilityIntent, @@ -89,7 +90,6 @@ from .const import ( CONF_SOURCE_DOMAIN, CONF_SOURCE_MODEL, DOMAIN, - FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS, LINUX_FIRMWARE_LOAD_FALLBACK_SECONDS, SOURCE_LOCAL, ) diff --git a/homeassistant/components/bluetooth/config_flow.py b/homeassistant/components/bluetooth/config_flow.py index b0e01e3596fe..b87cc3c55e0a 100644 --- a/homeassistant/components/bluetooth/config_flow.py +++ b/homeassistant/components/bluetooth/config_flow.py @@ -22,7 +22,7 @@ from homeassistant.config_entries import ( ConfigFlowResult, OptionsFlow, ) -from homeassistant.const import CONF_SOURCE +from homeassistant.const import CONF_MODE, CONF_SOURCE from homeassistant.core import callback from homeassistant.helpers.schema_config_entry_flow import ( SchemaCommonFlowHandler, @@ -39,7 +39,6 @@ from homeassistant.helpers.typing import DiscoveryInfoType from .const import ( CONF_ADAPTER, CONF_DETAILS, - CONF_MODE, CONF_PASSIVE, CONF_SOURCE_CONFIG_ENTRY_ID, CONF_SOURCE_DEVICE_ID, diff --git a/homeassistant/components/bluetooth/manager.py b/homeassistant/components/bluetooth/manager.py index fa5f57f606b0..9ca5ed251477 100644 --- a/homeassistant/components/bluetooth/manager.py +++ b/homeassistant/components/bluetooth/manager.py @@ -21,6 +21,7 @@ from habluetooth import ( BluetoothScanningMode, HaScanner, ) +from home_assistant_bluetooth import BluetoothServiceInfoBleak from homeassistant import config_entries from homeassistant.const import ( @@ -55,12 +56,7 @@ from .match import ( IntegrationMatcher, ble_device_matches, ) -from .models import ( - BluetoothCallback, - BluetoothCallbackReplay, - BluetoothChange, - BluetoothServiceInfoBleak, -) +from .models import BluetoothCallback, BluetoothCallbackReplay, BluetoothChange from .storage import BluetoothStorage from .util import async_load_history_from_system diff --git a/homeassistant/components/bluetooth/match.py b/homeassistant/components/bluetooth/match.py index 2c8c19696cd2..f396495e3237 100644 --- a/homeassistant/components/bluetooth/match.py +++ b/homeassistant/components/bluetooth/match.py @@ -7,12 +7,13 @@ from functools import lru_cache import re from typing import TYPE_CHECKING, Final, TypedDict +from home_assistant_bluetooth import BluetoothServiceInfoBleak from lru import LRU from homeassistant.core import callback from homeassistant.loader import BluetoothMatcher, BluetoothMatcherOptional -from .models import BluetoothCallback, BluetoothServiceInfoBleak +from .models import BluetoothCallback if TYPE_CHECKING: from bleak.backends.scanner import AdvertisementData diff --git a/homeassistant/components/bluetooth/passive_update_processor.py b/homeassistant/components/bluetooth/passive_update_processor.py index dae9fee078b1..26dd3cd000da 100644 --- a/homeassistant/components/bluetooth/passive_update_processor.py +++ b/homeassistant/components/bluetooth/passive_update_processor.py @@ -29,9 +29,11 @@ from .update_coordinator import BasePassiveBluetoothCoordinator if TYPE_CHECKING: from collections.abc import Callable + from home_assistant_bluetooth import BluetoothServiceInfoBleak + from homeassistant.helpers.entity_platform import AddEntitiesCallback - from .models import BluetoothChange, BluetoothServiceInfoBleak + from .models import BluetoothChange STORAGE_KEY = "bluetooth.passive_update_processor" STORAGE_VERSION = 1 diff --git a/homeassistant/components/bluetooth/update_coordinator.py b/homeassistant/components/bluetooth/update_coordinator.py index 10b331be57b1..4ebefa4bc059 100644 --- a/homeassistant/components/bluetooth/update_coordinator.py +++ b/homeassistant/components/bluetooth/update_coordinator.py @@ -4,6 +4,7 @@ from abc import ABC, abstractmethod import logging from habluetooth import BluetoothScanningMode +from home_assistant_bluetooth import BluetoothServiceInfoBleak from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback @@ -14,7 +15,7 @@ from .api import ( async_track_unavailable, ) from .match import BluetoothCallbackMatcher -from .models import BluetoothChange, BluetoothServiceInfoBleak +from .models import BluetoothChange class BasePassiveBluetoothCoordinator(ABC): diff --git a/homeassistant/components/bluetooth/util.py b/homeassistant/components/bluetooth/util.py index b738b7a572da..5273353258ba 100644 --- a/homeassistant/components/bluetooth/util.py +++ b/homeassistant/components/bluetooth/util.py @@ -14,12 +14,13 @@ from bluetooth_adapters import ( ) from bluetooth_data_tools import monotonic_time_coarse from habluetooth import BluetoothScanningMode, get_manager +from home_assistant_bluetooth import BluetoothServiceInfoBleak +from homeassistant.const import CONF_MODE from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError -from .const import CONF_MODE, CONF_PASSIVE, DEFAULT_MODE -from .models import BluetoothServiceInfoBleak +from .const import CONF_PASSIVE, DEFAULT_MODE from .storage import BluetoothStorage _LOGGER = logging.getLogger(__name__)