2023-03-14 21:24:47 +00:00
|
|
|
"""Fetches diagnostic data for Starlink systems."""
|
|
|
|
|
|
|
|
from dataclasses import asdict
|
|
|
|
from typing import Any
|
|
|
|
|
2024-09-12 18:37:00 +00:00
|
|
|
from homeassistant.components.diagnostics import async_redact_data
|
2023-03-14 21:24:47 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2025-02-13 15:36:07 +00:00
|
|
|
from .coordinator import StarlinkConfigEntry
|
2023-03-14 21:24:47 +00:00
|
|
|
|
2023-08-19 09:36:23 +00:00
|
|
|
TO_REDACT = {"id", "latitude", "longitude", "altitude"}
|
2023-03-14 21:24:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
2025-02-13 15:36:07 +00:00
|
|
|
hass: HomeAssistant, config_entry: StarlinkConfigEntry
|
2023-03-14 21:24:47 +00:00
|
|
|
) -> dict[str, Any]:
|
|
|
|
"""Return diagnostics for Starlink config entries."""
|
2025-02-13 15:36:07 +00:00
|
|
|
return async_redact_data(asdict(config_entry.runtime_data.data), TO_REDACT)
|