1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-29 21:21:46 +01:00
Files
core/homeassistant/components/pure_energie/diagnostics.py
Michael 15b8687c53 Explicitly pass in the config_entry in pure_energie coordinator (#138035)
explicitly pass in the config_entry in coordinator
2025-02-09 16:02:18 +02:00

36 lines
926 B
Python

"""Diagnostics support for Pure Energie."""
from __future__ import annotations
from dataclasses import asdict
from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from .coordinator import PureEnergieConfigEntry
TO_REDACT = {
CONF_HOST,
"n2g_id",
}
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, entry: PureEnergieConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
return {
"entry": {
"title": entry.title,
"data": async_redact_data(entry.data, TO_REDACT),
},
"data": {
"device": async_redact_data(
asdict(entry.runtime_data.data.device), TO_REDACT
),
"smartbridge": asdict(entry.runtime_data.data.smartbridge),
},
}