Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for Yale Smart Alarm."""
2 
3 from __future__ import annotations
4 
5 from dataclasses import asdict
6 from typing import Any
7 
8 from homeassistant.components.diagnostics import async_redact_data
9 from homeassistant.core import HomeAssistant
10 
11 from . import YaleConfigEntry
12 
13 TO_REDACT = {
14  "address",
15  "name",
16  "mac",
17  "device_id",
18  "user_id",
19  "id",
20  "mail_address",
21  "report_account",
22 }
23 
24 
26  hass: HomeAssistant, entry: YaleConfigEntry
27 ) -> dict[str, Any]:
28  """Return diagnostics for a config entry."""
29  coordinator = entry.runtime_data
30 
31  assert coordinator.yale
32  get_all_data = await hass.async_add_executor_job(coordinator.yale.get_all)
33  return async_redact_data(asdict(get_all_data), TO_REDACT)
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:27