core/homeassistant/components/gios/diagnostics.py

26 lines
710 B
Python

"""Diagnostics support for GIOS."""
from __future__ import annotations
from dataclasses import asdict
from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from . import GiosDataUpdateCoordinator
from .const import DOMAIN
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
coordinator: GiosDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
diagnostics_data = {
"config_entry": config_entry.as_dict(),
"coordinator_data": asdict(coordinator.data),
}
return diagnostics_data