mirror of
https://github.com/micahqcade/custom_vesync.git
synced 2025-02-11 09:39:00 +01:00
add diagnostics (#20)
This commit is contained in:
parent
35370cbcae
commit
52b67ecb86
23
custom_components/vesync/diagnostics.py
Normal file
23
custom_components/vesync/diagnostics.py
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user