From 2e97baeb3b9f4ae8d7e742b1f64d79ee6e772dd0 Mon Sep 17 00:00:00 2001 From: Brunas Date: Mon, 22 Jul 2024 22:55:49 +0300 Subject: [PATCH] platforms refactoring --- custom_components/meteo_lt/__init__.py | 9 +++++++-- custom_components/meteo_lt/manifest.json | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/custom_components/meteo_lt/__init__.py b/custom_components/meteo_lt/__init__.py index 9506a9b..8268309 100644 --- a/custom_components/meteo_lt/__init__.py +++ b/custom_components/meteo_lt/__init__.py @@ -1,6 +1,9 @@ """__init__.py""" +from typing import Final + from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.typing import ConfigType @@ -8,6 +11,8 @@ from .const import DOMAIN, LOGGER from .coordinator import MeteoLtCoordinator +PLATFORMS: Final = [Platform.WEATHER] + async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Meteo.Lt from a config entry.""" LOGGER.info("Setting up Meteo.Lt from config entry") @@ -32,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: "coordinator": coordinator, } - await hass.config_entries.async_forward_entry_setups(entry, ["weather"]) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True @@ -40,7 +45,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" LOGGER.info("Unloading Meteo.Lt config entry") - unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "weather") + unload_ok = await hass.config_entries.async_forward_entry_unload(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) diff --git a/custom_components/meteo_lt/manifest.json b/custom_components/meteo_lt/manifest.json index b96d45c..b21198a 100644 --- a/custom_components/meteo_lt/manifest.json +++ b/custom_components/meteo_lt/manifest.json @@ -9,6 +9,5 @@ "integration_type": "service", "loggers": ["meteo_lt"], "requirements": ["meteo_lt-pkg==0.1.4"], - "dependencies": [], - "supported_platforms": ["weather"] + "dependencies": [] } \ No newline at end of file