Skip to content

Commit

Permalink
add child entities to diagnostics when downloading diagnostics for group
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Feb 10, 2024
1 parent 41178a9 commit 4c8f246
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom_components/powercalc/diagnostics.py
Expand Up @@ -12,12 +12,10 @@ async def async_get_config_entry_diagnostics(
) -> dict:
"""Return diagnostics for a config entry."""

data = {"entry": entry.as_dict()}
data: dict = {"entry": entry.as_dict()}

if entry.data.get(CONF_SENSOR_TYPE) == SensorType.GROUP:
data.update({
"power_entities": await resolve_entity_ids_recursively(hass, entry, SensorDeviceClass.POWER),
"energy_entities": await resolve_entity_ids_recursively(hass, entry, SensorDeviceClass.ENERGY),
})
data["power_entities"] = await resolve_entity_ids_recursively(hass, entry, SensorDeviceClass.POWER)
data["energy_entities"] = await resolve_entity_ids_recursively(hass, entry, SensorDeviceClass.ENERGY)

return data

0 comments on commit 4c8f246

Please sign in to comment.