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 later
This commit is contained in:
parent
131068358a
commit
2fe12ade4c
1 changed files with 14 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue