mirror of
https://github.com/home-assistant/core.git
synced 2026-06-06 07:26:58 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
31 lines
877 B
Python
31 lines
877 B
Python
"""Diagnostics support for Huum."""
|
|
|
|
from typing import Any
|
|
|
|
from homeassistant.components.diagnostics import async_redact_data
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import HuumConfigEntry
|
|
|
|
TO_REDACT_DATA = {"sauna_name", "payment_end_date"}
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: HuumConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a config entry."""
|
|
coordinator = entry.runtime_data
|
|
|
|
return {
|
|
"entry": {
|
|
"version": entry.version,
|
|
},
|
|
"coordinator": {
|
|
"last_update_success": coordinator.last_update_success,
|
|
"last_exception": (
|
|
str(coordinator.last_exception) if coordinator.last_exception else None
|
|
),
|
|
},
|
|
"data": async_redact_data(coordinator.data.to_dict(), TO_REDACT_DATA),
|
|
}
|