"""The ge_home integration.""" from homeassistant.const import EVENT_HOMEASSISTANT_STOP import voluptuous as vol from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from .const import DOMAIN from .update_coordinator import GeHomeUpdateCoordinator CONFIG_SCHEMA = vol.Schema({DOMAIN: vol.Schema({})}, extra=vol.ALLOW_EXTRA) async def async_setup(hass: HomeAssistant, config: dict): return True async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up the ge_home component.""" hass.data.setdefault(DOMAIN, {}) """Set up ge_home from a config entry.""" coordinator = GeHomeUpdateCoordinator(hass, entry) hass.data[DOMAIN][entry.entry_id] = coordinator if not await coordinator.async_setup(): return False hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, coordinator.shutdown) return True async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" coordinator: GeHomeUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] ok = await coordinator.async_reset() if ok: hass.data[DOMAIN].pop(entry.entry_id) return ok async def async_update_options(hass, config_entry): """Update options.""" await hass.config_entries.async_reload(config_entry.entry_id)