Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for august."""
2 
3 from __future__ import annotations
4 
5 from typing import Any
6 
7 from yalexs.const import DEFAULT_BRAND
8 
9 from homeassistant.components.diagnostics import async_redact_data
10 from homeassistant.core import HomeAssistant
11 
12 from . import AugustConfigEntry
13 from .const import CONF_BRAND
14 
15 TO_REDACT = {
16  "HouseID",
17  "OfflineKeys",
18  "installUserID",
19  "invitations",
20  "key",
21  "pins",
22  "pubsubChannel",
23  "recentImage",
24  "remoteOperateSecret",
25  "users",
26  "zWaveDSK",
27  "contentToken",
28 }
29 
30 
32  hass: HomeAssistant, entry: AugustConfigEntry
33 ) -> dict[str, Any]:
34  """Return diagnostics for a config entry."""
35  data = entry.runtime_data
36 
37  return {
38  "locks": {
39  lock.device_id: async_redact_data(
40  data.get_device_detail(lock.device_id).raw, TO_REDACT
41  )
42  for lock in data.locks
43  },
44  "doorbells": {
45  doorbell.device_id: async_redact_data(
46  data.get_device_detail(doorbell.device_id).raw, TO_REDACT
47  )
48  for doorbell in data.doorbells
49  },
50  "brand": entry.data.get(CONF_BRAND, DEFAULT_BRAND),
51  }
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, AugustConfigEntry entry)
Definition: diagnostics.py:33
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14