1 """The Hong Kong Observatory integration."""
3 from __future__
import annotations
5 from hko
import LOCATIONS
12 from .const
import DEFAULT_DISTRICT, DOMAIN, KEY_DISTRICT, KEY_LOCATION
13 from .coordinator
import HKOUpdateCoordinator
15 PLATFORMS: list[Platform] = [Platform.WEATHER]
19 """Set up Hong Kong Observatory from a config entry."""
21 location = entry.data[CONF_LOCATION]
23 (item
for item
in LOCATIONS
if item[KEY_LOCATION] == location),
24 {KEY_DISTRICT: DEFAULT_DISTRICT},
29 await coordinator.async_config_entry_first_refresh()
30 hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
32 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
38 """Unload a config entry."""
39 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
40 hass.data[DOMAIN].pop(entry.entry_id)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)