Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Diagnostics support for the Pi-hole integration."""
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.const import CONF_API_KEY
9 from homeassistant.core import HomeAssistant
10 
11 from . import PiHoleConfigEntry
12 
13 TO_REDACT = {CONF_API_KEY}
14 
15 
17  hass: HomeAssistant, entry: PiHoleConfigEntry
18 ) -> dict[str, Any]:
19  """Return diagnostics for a config entry."""
20  api = entry.runtime_data.api
21 
22  return {
23  "entry": async_redact_data(entry.as_dict(), TO_REDACT),
24  "data": api.data,
25  "versions": api.versions,
26  }
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, PiHoleConfigEntry entry)
Definition: diagnostics.py:18