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