2022-01-21 16:23:42 +00:00
|
|
|
"""Diagnostics support for Brother."""
|
2024-03-08 13:51:32 +00:00
|
|
|
|
2022-01-21 16:23:42 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2022-09-18 21:28:17 +00:00
|
|
|
from dataclasses import asdict
|
2023-01-09 14:17:48 +00:00
|
|
|
from typing import Any
|
2022-09-18 21:28:17 +00:00
|
|
|
|
2022-01-21 16:23:42 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2024-05-04 14:29:08 +00:00
|
|
|
from . import BrotherConfigEntry
|
2022-01-21 16:23:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
2024-05-04 14:29:08 +00:00
|
|
|
hass: HomeAssistant, config_entry: BrotherConfigEntry
|
2023-01-09 14:17:48 +00:00
|
|
|
) -> dict[str, Any]:
|
2022-01-21 16:23:42 +00:00
|
|
|
"""Return diagnostics for a config entry."""
|
2024-05-04 14:29:08 +00:00
|
|
|
coordinator = config_entry.runtime_data
|
2022-01-21 16:23:42 +00:00
|
|
|
|
2024-04-06 09:07:37 +00:00
|
|
|
return {
|
2022-01-21 16:23:42 +00:00
|
|
|
"info": dict(config_entry.data),
|
2022-09-18 21:28:17 +00:00
|
|
|
"data": asdict(coordinator.data),
|
2024-02-22 21:27:24 +00:00
|
|
|
"model": coordinator.brother.model,
|
|
|
|
"firmware": coordinator.brother.firmware,
|
2022-01-21 16:23:42 +00:00
|
|
|
}
|