* Store data in config_entry.runtime_data * Update homeassistant/components/brother/__init__.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Fix setdefault * Do not include ignored and disabled * Check loaded entries --------- Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com> Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
24 lines
627 B
Python
24 lines
627 B
Python
"""Diagnostics support for Brother."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import asdict
|
|
from typing import Any
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from . import BrotherConfigEntry
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, config_entry: BrotherConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a config entry."""
|
|
coordinator = config_entry.runtime_data
|
|
|
|
return {
|
|
"info": dict(config_entry.data),
|
|
"data": asdict(coordinator.data),
|
|
"model": coordinator.brother.model,
|
|
"firmware": coordinator.brother.firmware,
|
|
}
|