Ensure all homekit_controller controllers are imported in advance (#112079)
* Ensure all homekit_controllers are imported in advance We want to avoid importing them in the event loop later * Ensure all homekit_controllers are imported in advance We want to avoid importing them in the event loop laterpull/112516/head
parent
12574bca8b
commit
b8e3bb8eb8
|
@ -6,6 +6,11 @@ import contextlib
|
|||
import logging
|
||||
|
||||
import aiohomekit
|
||||
from aiohomekit.const import (
|
||||
BLE_TRANSPORT_SUPPORTED,
|
||||
COAP_TRANSPORT_SUPPORTED,
|
||||
IP_TRANSPORT_SUPPORTED,
|
||||
)
|
||||
from aiohomekit.exceptions import (
|
||||
AccessoryDisconnectedError,
|
||||
AccessoryNotFoundError,
|
||||
|
@ -24,6 +29,15 @@ from .connection import HKDevice
|
|||
from .const import DOMAIN, KNOWN_DEVICES
|
||||
from .utils import async_get_controller
|
||||
|
||||
# Ensure all the controllers get imported in the executor
|
||||
# since they are loaded late.
|
||||
if BLE_TRANSPORT_SUPPORTED:
|
||||
from aiohomekit.controller import ble # noqa: F401
|
||||
if COAP_TRANSPORT_SUPPORTED:
|
||||
from aiohomekit.controller import coap # noqa: F401
|
||||
if IP_TRANSPORT_SUPPORTED:
|
||||
from aiohomekit.controller import ip # noqa: F401
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||
|
|
Loading…
Reference in New Issue