1 """The Nice G.O. integration."""
3 from __future__
import annotations
11 from .coordinator
import NiceGOUpdateCoordinator
13 _LOGGER = logging.getLogger(__name__)
14 PLATFORMS: list[Platform] = [
21 type NiceGOConfigEntry = ConfigEntry[NiceGOUpdateCoordinator]
25 """Set up Nice G.O. from a config entry."""
28 entry.async_on_unload(
29 hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, coordinator.async_ha_stop)
32 await coordinator.async_config_entry_first_refresh()
34 entry.runtime_data = coordinator
36 entry.async_create_background_task(
38 coordinator.client_listen(),
39 "nice_go_websocket_task",
42 entry.async_on_unload(coordinator.unsubscribe)
44 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
50 """Unload a config entry."""
51 if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
52 await entry.runtime_data.api.close()
bool async_unload_entry(HomeAssistant hass, NiceGOConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, NiceGOConfigEntry entry)