2019-06-06 23:07:15 +00:00
|
|
|
"""Life360 integration."""
|
2022-06-29 16:40:02 +00:00
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2024-01-11 20:49:39 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
2022-01-03 11:08:14 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2024-01-11 20:49:39 +00:00
|
|
|
from homeassistant.helpers import issue_registry as ir
|
2024-01-02 16:43:33 +00:00
|
|
|
|
2024-01-11 20:49:39 +00:00
|
|
|
DOMAIN = "life360"
|
2022-06-29 16:40:02 +00:00
|
|
|
|
2019-06-06 23:07:15 +00:00
|
|
|
|
2024-01-11 20:49:39 +00:00
|
|
|
async def async_setup_entry(hass: HomeAssistant, _: ConfigEntry) -> bool:
|
2019-06-06 23:07:15 +00:00
|
|
|
"""Set up config entry."""
|
2024-01-11 20:49:39 +00:00
|
|
|
ir.async_create_issue(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
DOMAIN,
|
|
|
|
is_fixable=False,
|
|
|
|
severity=ir.IssueSeverity.ERROR,
|
|
|
|
translation_key="integration_removed",
|
|
|
|
translation_placeholders={
|
|
|
|
"entries": "/config/integrations/integration/life360"
|
|
|
|
},
|
|
|
|
)
|
2019-06-06 23:07:15 +00:00
|
|
|
return True
|
2019-06-10 19:45:22 +00:00
|
|
|
|
|
|
|
|
2022-01-03 11:08:14 +00:00
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
2019-06-10 19:45:22 +00:00
|
|
|
"""Unload config entry."""
|
2024-01-11 20:49:39 +00:00
|
|
|
if all(
|
|
|
|
config_entry.state is ConfigEntryState.NOT_LOADED
|
|
|
|
for config_entry in hass.config_entries.async_entries(DOMAIN)
|
|
|
|
if config_entry.entry_id != entry.entry_id
|
|
|
|
):
|
|
|
|
ir.async_delete_issue(hass, DOMAIN, DOMAIN)
|
|
|
|
return True
|