Get diagnostics of all devices in ViCare account (#102218)
* get diagnostics of all devices * correct test data * correct test data * correct test data
This commit is contained in:
parent
9d775bdbf6
commit
eee294d384
4 changed files with 4543 additions and 4538 deletions
|
@ -24,6 +24,7 @@ from .const import (
|
|||
PLATFORMS,
|
||||
VICARE_API,
|
||||
VICARE_DEVICE_CONFIG,
|
||||
VICARE_DEVICE_CONFIG_LIST,
|
||||
HeatingType,
|
||||
)
|
||||
|
||||
|
@ -83,7 +84,9 @@ def setup_vicare_api(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|||
)
|
||||
|
||||
# Currently we only support a single device
|
||||
device = vicare_api.devices[0]
|
||||
device_list = vicare_api.devices
|
||||
device = device_list[0]
|
||||
hass.data[DOMAIN][entry.entry_id][VICARE_DEVICE_CONFIG_LIST] = device_list
|
||||
hass.data[DOMAIN][entry.entry_id][VICARE_DEVICE_CONFIG] = device
|
||||
hass.data[DOMAIN][entry.entry_id][VICARE_API] = getattr(
|
||||
device,
|
||||
|
|
|
@ -14,6 +14,7 @@ PLATFORMS = [
|
|||
]
|
||||
|
||||
VICARE_DEVICE_CONFIG = "device_conf"
|
||||
VICARE_DEVICE_CONFIG_LIST = "device_config_list"
|
||||
VICARE_API = "api"
|
||||
VICARE_NAME = "ViCare"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import CONF_CLIENT_ID, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN, VICARE_DEVICE_CONFIG
|
||||
from .const import DOMAIN, VICARE_DEVICE_CONFIG_LIST
|
||||
|
||||
TO_REDACT = {CONF_CLIENT_ID, CONF_PASSWORD, CONF_USERNAME}
|
||||
|
||||
|
@ -19,10 +19,9 @@ async def async_get_config_entry_diagnostics(
|
|||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
# Currently we only support a single device
|
||||
device = hass.data[DOMAIN][entry.entry_id][VICARE_DEVICE_CONFIG]
|
||||
data: dict[str, Any] = json.loads(
|
||||
await hass.async_add_executor_job(device.dump_secure)
|
||||
)
|
||||
data = []
|
||||
for device in hass.data[DOMAIN][entry.entry_id][VICARE_DEVICE_CONFIG_LIST]:
|
||||
data.append(json.loads(await hass.async_add_executor_job(device.dump_secure)))
|
||||
return {
|
||||
"entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
||||
"data": data,
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue