Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for Philips JS."""
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 PhilipsTVConfigEntry
11 
12 TO_REDACT = {
13  "serialnumber_encrypted",
14  "serialnumber",
15  "deviceid_encrypted",
16  "deviceid",
17  "username",
18  "password",
19  "title",
20  "unique_id",
21 }
22 
23 
25  hass: HomeAssistant, entry: PhilipsTVConfigEntry
26 ) -> dict[str, Any]:
27  """Return diagnostics for a config entry."""
28  coordinator = entry.runtime_data
29  api = coordinator.api
30 
31  return {
32  "entry": async_redact_data(entry.as_dict(), TO_REDACT),
33  "data": {
34  "system": async_redact_data(api.system, TO_REDACT),
35  "powerstate": api.powerstate,
36  "context": api.context,
37  "application": api.application,
38  "applications": api.applications,
39  "source_id": api.source_id,
40  "sources": api.sources,
41  "ambilight_styles": api.ambilight_styles,
42  "ambilight_topology": api.ambilight_topology,
43  "ambilight_current_configuration": api.ambilight_current_configuration,
44  "ambilight_mode_raw": api.ambilight_mode_raw,
45  "ambilight_modes": api.ambilight_modes,
46  "ambilight_power_raw": api.ambilight_power_raw,
47  "ambilight_power": api.ambilight_power,
48  "ambilight_cached": api.ambilight_cached,
49  "ambilight_measured": api.ambilight_measured,
50  "ambilight_processed": api.ambilight_processed,
51  "screenstate": api.screenstate,
52  "on": api.on,
53  "channel": api.channel,
54  "channels": api.channels,
55  "channel_lists": api.channel_lists,
56  "favorite_lists": api.favorite_lists,
57  },
58  }
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, PhilipsTVConfigEntry entry)
Definition: diagnostics.py:26