mirror of
https://github.com/home-assistant/core.git
synced 2026-06-01 05:04:21 +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>
26 lines
715 B
Python
26 lines
715 B
Python
"""Diagnostics support for DSMR Reader."""
|
|
|
|
from typing import Any
|
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers import entity_registry as er
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: ConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for the config entry."""
|
|
ent_reg = er.async_get(hass)
|
|
entities = [
|
|
entity.entity_id
|
|
for entity in er.async_entries_for_config_entry(ent_reg, entry.entry_id)
|
|
]
|
|
|
|
entity_states = {entity: hass.states.get(entity) for entity in entities}
|
|
|
|
return {
|
|
"entry": entry.as_dict(),
|
|
"entities": entity_states,
|
|
}
|