feat: initial commit

This commit is contained in:
devilr33f 2025-11-04 11:21:01 +06:00
commit e436fafd9e
13 changed files with 812 additions and 0 deletions

View file

@ -0,0 +1,29 @@
from __future__ import annotations
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import DOMAIN, PLATFORMS
from .coordinator import TwoGisWeatherUpdateCoordinator
async def async_setup(hass: HomeAssistant, _config: dict) -> bool:
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
coordinator = TwoGisWeatherUpdateCoordinator(hass, entry)
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data.get(DOMAIN, {}).pop(entry.entry_id, None)
return unload_ok