Home Assistant Unofficial Reference 2024.12.1
diagnostics.py
Go to the documentation of this file.
1 """Provides diagnostics for Solarlog."""
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_HOST
9 from homeassistant.core import HomeAssistant
10 
11 from . import SolarlogConfigEntry
12 
13 TO_REDACT = [
14  CONF_HOST,
15 ]
16 
17 
19  hass: HomeAssistant, config_entry: SolarlogConfigEntry
20 ) -> dict[str, Any]:
21  """Return diagnostics for a config entry."""
22  data = config_entry.runtime_data.data
23 
24  return {
25  "config_entry": async_redact_data(config_entry.as_dict(), TO_REDACT),
26  "solarlog_data": data.to_dict(),
27  }
dict async_redact_data(Mapping data, Iterable[Any] to_redact)
Definition: util.py:14
dict[str, Any] async_get_config_entry_diagnostics(HomeAssistant hass, SolarlogConfigEntry config_entry)
Definition: diagnostics.py:20