mirror of
https://github.com/home-assistant/core.git
synced 2026-07-06 14:25:34 +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>
35 lines
933 B
Python
35 lines
933 B
Python
"""Diagnostics support for IKEA Tradfri."""
|
|
|
|
from typing import Any, cast
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers import device_registry as dr
|
|
|
|
from .const import CONF_GATEWAY_ID, DOMAIN
|
|
from .coordinator import TradfriConfigEntry
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: TradfriConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics the Tradfri platform."""
|
|
tradfri_data = entry.runtime_data
|
|
|
|
device_registry = dr.async_get(hass)
|
|
device = cast(
|
|
dr.DeviceEntry,
|
|
device_registry.async_get_device(
|
|
identifiers={(DOMAIN, entry.data[CONF_GATEWAY_ID])}
|
|
),
|
|
)
|
|
|
|
device_data: list = [
|
|
coordinator.device.device_info.model_number
|
|
for coordinator in tradfri_data.coordinator_list
|
|
]
|
|
|
|
return {
|
|
"gateway_version": device.sw_version,
|
|
"device_data": sorted(device_data),
|
|
}
|