Home Assistant Unofficial Reference 2024.12.1
repairs.py
Go to the documentation of this file.
1 """Repairs support for notify integration."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.repairs import ConfirmRepairFlow, RepairsFlow
6 from homeassistant.core import HomeAssistant, callback
7 from homeassistant.helpers import issue_registry as ir
8 
9 from .const import DOMAIN
10 
11 
12 @callback
14  hass: HomeAssistant,
15  domain: str,
16  integration_title: str,
17  breaks_in_ha_version: str,
18  service_name: str | None = None,
19 ) -> None:
20  """Ensure an issue is registered."""
21  if service_name is not None:
22  ir.async_create_issue(
23  hass,
24  DOMAIN,
25  f"migrate_notify_{domain}_{service_name}",
26  breaks_in_ha_version=breaks_in_ha_version,
27  issue_domain=domain,
28  is_fixable=True,
29  is_persistent=True,
30  translation_key="migrate_notify_service",
31  translation_placeholders={
32  "domain": domain,
33  "integration_title": integration_title,
34  "service_name": service_name,
35  },
36  severity=ir.IssueSeverity.WARNING,
37  )
38  return
39  ir.async_create_issue(
40  hass,
41  DOMAIN,
42  f"migrate_notify_{domain}",
43  breaks_in_ha_version=breaks_in_ha_version,
44  issue_domain=domain,
45  is_fixable=True,
46  is_persistent=True,
47  translation_key="migrate_notify",
48  translation_placeholders={
49  "domain": domain,
50  "integration_title": integration_title,
51  },
52  severity=ir.IssueSeverity.WARNING,
53  )
54 
55 
57  hass: HomeAssistant,
58  issue_id: str,
59  data: dict[str, str | int | float | None] | None,
60 ) -> RepairsFlow:
61  """Create flow."""
62  assert issue_id.startswith("migrate_notify_")
63  return ConfirmRepairFlow()
None migrate_notify_issue(HomeAssistant hass, str domain, str integration_title, str breaks_in_ha_version, str|None service_name=None)
Definition: repairs.py:19
RepairsFlow async_create_fix_flow(HomeAssistant hass, str issue_id, dict[str, str|int|float|None]|None data)
Definition: repairs.py:60