Skip to content
This repository was archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
add diagnostics (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlebourl authored Apr 26, 2022
1 parent 35370cb commit 52b67ec
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions custom_components/vesync/diagnostics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Provides diagnostics for VeSync."""
from __future__ import annotations

from typing import Any

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant

from .const import DOMAIN


async def async_get_config_entry_diagnostics(
hass: HomeAssistant, entry: ConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
devices = {"fans": [], "outlets": [], "switches": [], "bulbs": []}
for type in ["fans", "outlets", "switches", "bulbs"]:
for d in data["manager"]._dev_list[type]:
devices[type].append(
{"device": d.config_dict, "config": d.config, "details": d.details}
)
return devices

0 comments on commit 52b67ec

Please sign in to comment.