Home Assistant Unofficial Reference 2024.12.1
issues.py
Go to the documentation of this file.
1 """Helpers for generating issues."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.core import HomeAssistant
6 from homeassistant.helpers import issue_registry as ir
7 
8 from . import DOMAIN
9 from .helpers import Observation
10 
11 
13  hass: HomeAssistant, observations: list[Observation], text: str = ""
14 ) -> None:
15  """If there are mirrored entries, the user is probably using a workaround for a patched bug."""
16  if len(observations) != 2:
17  return
18  if observations[0].is_mirror(observations[1]):
19  ir.async_create_issue(
20  hass,
21  DOMAIN,
22  "mirrored_entry/" + text,
23  breaks_in_ha_version="2022.10.0",
24  is_fixable=False,
25  severity=ir.IssueSeverity.WARNING,
26  translation_key="manual_migration",
27  translation_placeholders={"entity": text},
28  learn_more_url="https://github.com/home-assistant/core/pull/67631",
29  )
30 
31 
32 # Should deprecate in some future version (2022.10 at time of writing) & make prob_given_false required in schemas.
33 def raise_no_prob_given_false(hass: HomeAssistant, text: str) -> None:
34  """In previous 2022.9 and earlier, prob_given_false was optional and had a default version."""
35  ir.async_create_issue(
36  hass,
37  DOMAIN,
38  f"no_prob_given_false/{text}",
39  breaks_in_ha_version="2022.10.0",
40  is_fixable=False,
41  severity=ir.IssueSeverity.ERROR,
42  translation_key="no_prob_given_false",
43  translation_placeholders={"entity": text},
44  learn_more_url="https://github.com/home-assistant/core/pull/67631",
45  )
None raise_mirrored_entries(HomeAssistant hass, list[Observation] observations, str text="")
Definition: issues.py:14
None raise_no_prob_given_false(HomeAssistant hass, str text)
Definition: issues.py:33