Skip to content

Commit

Permalink
platforms refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunas committed Jul 22, 2024
1 parent 42f159e commit 2e97bae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions custom_components/meteo_lt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
"""__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

from meteo_lt import MeteoLtAPI
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")
Expand All @@ -32,15 +37,15 @@ 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

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)

Expand Down
3 changes: 1 addition & 2 deletions custom_components/meteo_lt/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"integration_type": "service",
"loggers": ["meteo_lt"],
"requirements": ["meteo_lt-pkg==0.1.4"],
"dependencies": [],
"supported_platforms": ["weather"]
"dependencies": []
}

0 comments on commit 2e97bae

Please sign in to comment.