Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for A. O. Smith."""
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 . import AOSmithConfigEntry
11 
12 TO_REDACT = {
13  "address",
14  "city",
15  "contactId",
16  "dsn",
17  "email",
18  "firstName",
19  "heaterSsid",
20  "id",
21  "lastName",
22  "phone",
23  "postalCode",
24  "registeredOwner",
25  "serial",
26  "ssid",
27  "state",
28 }
29 
30 
32  hass: HomeAssistant, config_entry: AOSmithConfigEntry
33 ) -> dict[str, Any]:
34  """Return diagnostics for a config entry."""
35  data = config_entry.runtime_data
36 
37  all_device_info = await data.client.get_all_device_info()
38  return async_redact_data(all_device_info, TO_REDACT)
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, AOSmithConfigEntry config_entry)
Definition: diagnostics.py:33
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14