diff --git a/homeassistant/components/wled/__init__.py b/homeassistant/components/wled/__init__.py index c3917507fb982c..a854254a262e70 100644 --- a/homeassistant/components/wled/__init__.py +++ b/homeassistant/components/wled/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv @@ -10,7 +9,11 @@ from homeassistant.util.hass_dict import HassKey from .const import DOMAIN -from .coordinator import WLEDDataUpdateCoordinator, WLEDReleasesDataUpdateCoordinator +from .coordinator import ( + WLEDConfigEntry, + WLEDDataUpdateCoordinator, + WLEDReleasesDataUpdateCoordinator, +) PLATFORMS = ( Platform.BUTTON, @@ -22,8 +25,6 @@ Platform.UPDATE, ) -type WLEDConfigEntry = ConfigEntry[WLEDDataUpdateCoordinator] - WLED_KEY: HassKey[WLEDReleasesDataUpdateCoordinator] = HassKey(DOMAIN) CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) diff --git a/homeassistant/components/wled/button.py b/homeassistant/components/wled/button.py index 119b2dc9b9fcba..ef39ff0c6ff893 100644 --- a/homeassistant/components/wled/button.py +++ b/homeassistant/components/wled/button.py @@ -7,8 +7,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLEDConfigEntry -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity from .helpers import wled_exception_handler diff --git a/homeassistant/components/wled/config_flow.py b/homeassistant/components/wled/config_flow.py index e80760508a09da..5182d04bfdca6d 100644 --- a/homeassistant/components/wled/config_flow.py +++ b/homeassistant/components/wled/config_flow.py @@ -9,7 +9,6 @@ from homeassistant.components import onboarding from homeassistant.config_entries import ( - ConfigEntry, ConfigFlow, ConfigFlowResult, OptionsFlowWithReload, @@ -20,6 +19,7 @@ from homeassistant.helpers.service_info.zeroconf import ZeroconfServiceInfo from .const import CONF_KEEP_MAIN_LIGHT, DEFAULT_KEEP_MAIN_LIGHT, DOMAIN +from .coordinator import WLEDConfigEntry class WLEDFlowHandler(ConfigFlow, domain=DOMAIN): @@ -32,7 +32,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN): @staticmethod @callback def async_get_options_flow( - config_entry: ConfigEntry, + config_entry: WLEDConfigEntry, ) -> WLEDOptionsFlowHandler: """Get the options flow for this handler.""" return WLEDOptionsFlowHandler() diff --git a/homeassistant/components/wled/coordinator.py b/homeassistant/components/wled/coordinator.py index 8e2855e9f05433..87cf41a244230a 100644 --- a/homeassistant/components/wled/coordinator.py +++ b/homeassistant/components/wled/coordinator.py @@ -26,18 +26,20 @@ SCAN_INTERVAL, ) +type WLEDConfigEntry = ConfigEntry[WLEDDataUpdateCoordinator] + class WLEDDataUpdateCoordinator(DataUpdateCoordinator[WLEDDevice]): """Class to manage fetching WLED data from single endpoint.""" keep_main_light: bool - config_entry: ConfigEntry + config_entry: WLEDConfigEntry def __init__( self, hass: HomeAssistant, *, - entry: ConfigEntry, + entry: WLEDConfigEntry, ) -> None: """Initialize global WLED data updater.""" self.keep_main_light = entry.options.get( diff --git a/homeassistant/components/wled/diagnostics.py b/homeassistant/components/wled/diagnostics.py index 732cd3602a0855..c38953b81b0bb8 100644 --- a/homeassistant/components/wled/diagnostics.py +++ b/homeassistant/components/wled/diagnostics.py @@ -7,7 +7,7 @@ from homeassistant.components.diagnostics import async_redact_data from homeassistant.core import HomeAssistant -from . import WLEDConfigEntry +from .coordinator import WLEDConfigEntry async def async_get_config_entry_diagnostics( diff --git a/homeassistant/components/wled/light.py b/homeassistant/components/wled/light.py index 5e2ff1175802a0..b1774927689ba7 100644 --- a/homeassistant/components/wled/light.py +++ b/homeassistant/components/wled/light.py @@ -19,7 +19,6 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLEDConfigEntry from .const import ( ATTR_CCT, ATTR_COLOR_PRIMARY, @@ -29,7 +28,7 @@ COLOR_TEMP_K_MIN, LIGHT_CAPABILITIES_COLOR_MODE_MAPPING, ) -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity from .helpers import kelvin_to_255, kelvin_to_255_reverse, wled_exception_handler diff --git a/homeassistant/components/wled/number.py b/homeassistant/components/wled/number.py index e4ff184fd4b0b1..84e7d6ba66a8db 100644 --- a/homeassistant/components/wled/number.py +++ b/homeassistant/components/wled/number.py @@ -13,9 +13,8 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLEDConfigEntry from .const import ATTR_INTENSITY, ATTR_SPEED -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity from .helpers import wled_exception_handler diff --git a/homeassistant/components/wled/select.py b/homeassistant/components/wled/select.py index e5835d0e67162c..f9785fa8e57eed 100644 --- a/homeassistant/components/wled/select.py +++ b/homeassistant/components/wled/select.py @@ -11,8 +11,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLEDConfigEntry -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity from .helpers import wled_exception_handler diff --git a/homeassistant/components/wled/sensor.py b/homeassistant/components/wled/sensor.py index 06f96782019059..83a3cd40ccc2f5 100644 --- a/homeassistant/components/wled/sensor.py +++ b/homeassistant/components/wled/sensor.py @@ -26,8 +26,7 @@ from homeassistant.helpers.typing import StateType from homeassistant.util.dt import utcnow -from . import WLEDConfigEntry -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity diff --git a/homeassistant/components/wled/switch.py b/homeassistant/components/wled/switch.py index 8ed6ed56114885..1bbac423118d21 100644 --- a/homeassistant/components/wled/switch.py +++ b/homeassistant/components/wled/switch.py @@ -10,9 +10,8 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLEDConfigEntry from .const import ATTR_DURATION, ATTR_TARGET_BRIGHTNESS, ATTR_UDP_PORT -from .coordinator import WLEDDataUpdateCoordinator +from .coordinator import WLEDConfigEntry, WLEDDataUpdateCoordinator from .entity import WLEDEntity from .helpers import wled_exception_handler diff --git a/homeassistant/components/wled/update.py b/homeassistant/components/wled/update.py index ccf72425b777ba..dc6c0a5273c931 100644 --- a/homeassistant/components/wled/update.py +++ b/homeassistant/components/wled/update.py @@ -12,8 +12,12 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from . import WLED_KEY, WLEDConfigEntry -from .coordinator import WLEDDataUpdateCoordinator, WLEDReleasesDataUpdateCoordinator +from . import WLED_KEY +from .coordinator import ( + WLEDConfigEntry, + WLEDDataUpdateCoordinator, + WLEDReleasesDataUpdateCoordinator, +) from .entity import WLEDEntity from .helpers import wled_exception_handler