Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The MyQ integration."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.config_entries import ConfigEntry, ConfigEntryState
6 from homeassistant.core import HomeAssistant
7 from homeassistant.helpers import issue_registry as ir
8 
9 DOMAIN = "myq"
10 
11 
12 async def async_setup_entry(hass: HomeAssistant, _: ConfigEntry) -> bool:
13  """Set up MyQ from a config entry."""
14  ir.async_create_issue(
15  hass,
16  DOMAIN,
17  DOMAIN,
18  is_fixable=False,
19  severity=ir.IssueSeverity.ERROR,
20  translation_key="integration_removed",
21  translation_placeholders={
22  "blog": "https://www.home-assistant.io/blog/2023/11/06/removal-of-myq-integration/",
23  "entries": "/config/integrations/integration/myQ",
24  },
25  )
26 
27  return True
28 
29 
30 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
31  """Unload a config entry."""
32  if all(
33  config_entry.state is ConfigEntryState.NOT_LOADED
34  for config_entry in hass.config_entries.async_entries(DOMAIN)
35  if config_entry.entry_id != entry.entry_id
36  ):
37  ir.async_delete_issue(hass, DOMAIN, DOMAIN)
38 
39  return True
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:30
bool async_setup_entry(HomeAssistant hass, ConfigEntry _)
Definition: __init__.py:12