diff --git a/homeassistant/components/airzone_cloud/diagnostics.py b/homeassistant/components/airzone_cloud/diagnostics.py index a86f95d6187..0bce3251d5a 100644 --- a/homeassistant/components/airzone_cloud/diagnostics.py +++ b/homeassistant/components/airzone_cloud/diagnostics.py @@ -7,6 +7,7 @@ from typing import Any from aioairzone_cloud.const import ( API_CITY, API_GROUP_ID, + API_GROUPS, API_LOCATION_ID, API_OLD_ID, API_PIN, @@ -29,7 +30,6 @@ from .coordinator import AirzoneUpdateCoordinator TO_REDACT_API = [ API_CITY, - API_GROUP_ID, API_LOCATION_ID, API_OLD_ID, API_PIN, @@ -58,11 +58,17 @@ def gather_ids(api_data: dict[str, Any]) -> dict[str, Any]: ids[dev_id] = f"device{dev_idx}" dev_idx += 1 + group_idx = 1 inst_idx = 1 - for inst_id in api_data[RAW_INSTALLATIONS]: + for inst_id, inst_data in api_data[RAW_INSTALLATIONS].items(): if inst_id not in ids: ids[inst_id] = f"installation{inst_idx}" inst_idx += 1 + for group in inst_data[API_GROUPS]: + group_id = group[API_GROUP_ID] + if group_id not in ids: + ids[group_id] = f"group{group_idx}" + group_idx += 1 ws_idx = 1 for ws_id in api_data[RAW_WEBSERVERS]: diff --git a/homeassistant/components/airzone_cloud/manifest.json b/homeassistant/components/airzone_cloud/manifest.json index 8602dfa14cf..289565f0473 100644 --- a/homeassistant/components/airzone_cloud/manifest.json +++ b/homeassistant/components/airzone_cloud/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/airzone_cloud", "iot_class": "cloud_polling", "loggers": ["aioairzone_cloud"], - "requirements": ["aioairzone-cloud==0.2.0"] + "requirements": ["aioairzone-cloud==0.2.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index cc0922a0337..a4a4cf09bbd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -191,7 +191,7 @@ aio-georss-gdacs==0.8 aioairq==0.2.4 # homeassistant.components.airzone_cloud -aioairzone-cloud==0.2.0 +aioairzone-cloud==0.2.1 # homeassistant.components.airzone aioairzone==0.6.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e6a3baf8136..1a79cab57c4 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -169,7 +169,7 @@ aio-georss-gdacs==0.8 aioairq==0.2.4 # homeassistant.components.airzone_cloud -aioairzone-cloud==0.2.0 +aioairzone-cloud==0.2.1 # homeassistant.components.airzone aioairzone==0.6.4 diff --git a/tests/components/airzone_cloud/test_diagnostics.py b/tests/components/airzone_cloud/test_diagnostics.py index 730ac27325a..6c8ae366518 100644 --- a/tests/components/airzone_cloud/test_diagnostics.py +++ b/tests/components/airzone_cloud/test_diagnostics.py @@ -5,9 +5,11 @@ from unittest.mock import patch from aioairzone_cloud.const import ( API_DEVICE_ID, API_DEVICES, + API_GROUP_ID, API_GROUPS, API_WS_ID, AZD_AIDOOS, + AZD_GROUPS, AZD_INSTALLATIONS, AZD_SYSTEMS, AZD_WEBSERVERS, @@ -40,9 +42,10 @@ RAW_DATA_MOCK = { CONFIG[CONF_ID]: { API_GROUPS: [ { + API_GROUP_ID: "grp1", API_DEVICES: [ { - API_DEVICE_ID: "device1", + API_DEVICE_ID: "dev1", API_WS_ID: WS_ID, }, ], @@ -91,6 +94,12 @@ async def test_config_entry_diagnostics( assert list(diag["api_data"]) >= list(RAW_DATA_MOCK) assert "dev1" not in diag["api_data"][RAW_DEVICES_CONFIG] assert "device1" in diag["api_data"][RAW_DEVICES_CONFIG] + assert ( + diag["api_data"][RAW_INSTALLATIONS]["installation1"][API_GROUPS][0][ + API_GROUP_ID + ] + == "group1" + ) assert "inst1" not in diag["api_data"][RAW_INSTALLATIONS] assert "installation1" in diag["api_data"][RAW_INSTALLATIONS] assert WS_ID not in diag["api_data"][RAW_WEBSERVERS] @@ -111,6 +120,7 @@ async def test_config_entry_diagnostics( assert list(diag["coord_data"]) >= [ AZD_AIDOOS, + AZD_GROUPS, AZD_INSTALLATIONS, AZD_SYSTEMS, AZD_WEBSERVERS, diff --git a/tests/components/airzone_cloud/util.py b/tests/components/airzone_cloud/util.py index 80c0b4ae027..a8cb539bb1d 100644 --- a/tests/components/airzone_cloud/util.py +++ b/tests/components/airzone_cloud/util.py @@ -16,6 +16,7 @@ from aioairzone_cloud.const import ( API_DISCONNECTION_DATE, API_ERRORS, API_FAH, + API_GROUP_ID, API_GROUPS, API_HUMIDITY, API_INSTALLATION_ID, @@ -61,6 +62,7 @@ CONFIG = { GET_INSTALLATION_MOCK = { API_GROUPS: [ { + API_GROUP_ID: "grp1", API_NAME: "Group", API_DEVICES: [ { @@ -94,6 +96,7 @@ GET_INSTALLATION_MOCK = { ], }, { + API_GROUP_ID: "grp2", API_NAME: "Aidoo Group", API_DEVICES: [ { @@ -176,6 +179,18 @@ def mock_get_device_status(device: Device) -> dict[str, Any]: API_WS_CONNECTED: True, API_WARNINGS: [], } + if device.get_id() == "zone1": + return { + API_ACTIVE: True, + API_HUMIDITY: 30, + API_IS_CONNECTED: True, + API_WS_CONNECTED: True, + API_LOCAL_TEMP: { + API_FAH: 68, + API_CELSIUS: 20, + }, + API_WARNINGS: [], + } if device.get_id() == "zone2": return { API_ACTIVE: False, @@ -188,17 +203,7 @@ def mock_get_device_status(device: Device) -> dict[str, Any]: }, API_WARNINGS: [], } - return { - API_ACTIVE: True, - API_HUMIDITY: 30, - API_IS_CONNECTED: True, - API_WS_CONNECTED: True, - API_LOCAL_TEMP: { - API_FAH: 68, - API_CELSIUS: 20, - }, - API_WARNINGS: [], - } + return None def mock_get_webserver(webserver: WebServer, devices: bool) -> dict[str, Any]: