From 5b9f40b0f06921db93650002a84c2dec78d61733 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 21 Mar 2024 15:40:15 -1000 Subject: [PATCH] Pre import mobile app platforms to avoid having to wait on them (#113966) --- homeassistant/components/mobile_app/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/mobile_app/__init__.py b/homeassistant/components/mobile_app/__init__.py index 28f66954ca3..20a5448f2be 100644 --- a/homeassistant/components/mobile_app/__init__.py +++ b/homeassistant/components/mobile_app/__init__.py @@ -19,7 +19,16 @@ from homeassistant.helpers import ( from homeassistant.helpers.storage import Store from homeassistant.helpers.typing import ConfigType -from . import websocket_api +# Pre-import the platforms so they get loaded when the integration +# is imported as they are almost always going to be loaded and its +# cheaper to import them all at once. +from . import ( # noqa: F401 + binary_sensor as binary_sensor_pre_import, + device_tracker as device_tracker_pre_import, + notify as notify_pre_import, + sensor as sensor_pre_import, + websocket_api, +) from .const import ( ATTR_DEVICE_NAME, ATTR_MANUFACTURER,