Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for nexia."""
2 
3 from __future__ import annotations
4 
5 from typing import Any
6 
7 from homeassistant.components.diagnostics import async_redact_data
8 from homeassistant.core import HomeAssistant
9 
10 from .const import CONF_BRAND
11 from .types import NexiaConfigEntry
12 
13 TO_REDACT = {
14  "dealer_contact_info",
15 }
16 
17 
19  hass: HomeAssistant, entry: NexiaConfigEntry
20 ) -> dict[str, Any]:
21  """Return diagnostics for a config entry."""
22  coordinator = entry.runtime_data
23  nexia_home = coordinator.nexia_home
24 
25  return {
26  "entry": {
27  "title": entry.title,
28  "brand": entry.data.get(CONF_BRAND),
29  },
30  "automations": async_redact_data(nexia_home.automations_json, TO_REDACT),
31  "devices": async_redact_data(nexia_home.devices_json, TO_REDACT),
32  }
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, NexiaConfigEntry entry)
Definition: diagnostics.py:20