Update aioairzone-cloud to v0.2.1 (#96063)

pull/96137/head
Álvaro Fernández Rojas 2023-07-08 11:41:39 +02:00 committed by GitHub
parent e0274ec854
commit 1eb2ddf010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 17 deletions

View File

@ -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]:

View File

@ -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"]
}

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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]: