INNER CODE UNIT · Python
async_unload_entry
dummylabs/thewatchman · custom_components/watchman/__init__.py:186
async def async_unload_entry(hass: HomeAssistant, config_entry: WMConfigEntry) -> bool: # pylint: disable=unused-argument
"""Handle integration unload."""
if hasattr(config_entry, "runtime_data") and config_entry.runtime_data:
await config_entry.runtime_data.coordinator.async_shutdown()
if hass.services.has_service(DOMAIN, REPORT_SERVICE_NAME):
hass.services.async_remove(DOMAIN, REPORT_SERVICE_NAME)
unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS
)
if DOMAIN_DATA in hass.data:
hass.data.pop(DOMAIN_DATA)
if DOMAIN in hass.data:
hass.data.pop(DOMAIN)
if unload_ok: