mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 09:38:58 +01:00
bd8e90bb00
Co-authored-by: Joostlek <joostlek@outlook.com>
33 lines
913 B
Python
33 lines
913 B
Python
"""Diagnostics support for Huum."""
|
|
|
|
from __future__ import annotations
|
|
|
|
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),
|
|
}
|