feat: initial commit
This commit is contained in:
commit
e436fafd9e
13 changed files with 812 additions and 0 deletions
29
custom_components/two_gis_weather/__init__.py
Normal file
29
custom_components/two_gis_weather/__init__.py
Normal 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
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue