From 5d4591a3ec34d828935d3328337a6d2b8a044396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 28 Dec 2022 16:37:50 +0100 Subject: [PATCH] airzone: update aioairzone to v0.5.2 (#84690) --- .../components/airzone/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../components/airzone/test_binary_sensor.py | 6 ++ tests/components/airzone/test_climate.py | 65 +++++++++++++++++++ tests/components/airzone/test_sensor.py | 6 ++ tests/components/airzone/util.py | 22 ++++++- 7 files changed, 101 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/airzone/manifest.json b/homeassistant/components/airzone/manifest.json index 142ace5e70b..5cf3ab0689d 100644 --- a/homeassistant/components/airzone/manifest.json +++ b/homeassistant/components/airzone/manifest.json @@ -3,7 +3,7 @@ "name": "Airzone", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/airzone", - "requirements": ["aioairzone==0.5.1"], + "requirements": ["aioairzone==0.5.2"], "codeowners": ["@Noltari"], "iot_class": "local_polling", "loggers": ["aioairzone"], diff --git a/requirements_all.txt b/requirements_all.txt index b42440e06bd..def1a344afa 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -119,7 +119,7 @@ aio_georss_gdacs==0.7 aioairq==0.2.4 # homeassistant.components.airzone -aioairzone==0.5.1 +aioairzone==0.5.2 # homeassistant.components.ambient_station aioambient==2021.11.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ad59b73714c..f6973c7df9f 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -106,7 +106,7 @@ aio_georss_gdacs==0.7 aioairq==0.2.4 # homeassistant.components.airzone -aioairzone==0.5.1 +aioairzone==0.5.2 # homeassistant.components.ambient_station aioambient==2021.11.0 diff --git a/tests/components/airzone/test_binary_sensor.py b/tests/components/airzone/test_binary_sensor.py index 138801d1dc0..860bc50e93c 100644 --- a/tests/components/airzone/test_binary_sensor.py +++ b/tests/components/airzone/test_binary_sensor.py @@ -78,3 +78,9 @@ async def test_airzone_create_binary_sensors(hass: HomeAssistant) -> None: state = hass.states.get("binary_sensor.salon_problem") assert state.state == STATE_OFF + + state = hass.states.get("binary_sensor.airzone_2_1_battery_low") + assert state is None + + state = hass.states.get("binary_sensor.airzone_2_1_problem") + assert state.state == STATE_OFF diff --git a/tests/components/airzone/test_climate.py b/tests/components/airzone/test_climate.py index a492abd8c61..640826bb30f 100644 --- a/tests/components/airzone/test_climate.py +++ b/tests/components/airzone/test_climate.py @@ -131,6 +131,20 @@ async def test_airzone_create_climates(hass: HomeAssistant) -> None: assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == API_TEMPERATURE_STEP assert state.attributes.get(ATTR_TEMPERATURE) == 19.1 + state = hass.states.get("climate.airzone_2_1") + assert state.state == HVACMode.OFF + assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 62 + assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 22.3 + assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.OFF + assert state.attributes.get(ATTR_HVAC_MODES) == [ + HVACMode.HEAT_COOL, + HVACMode.OFF, + ] + assert state.attributes.get(ATTR_MAX_TEMP) == 30 + assert state.attributes.get(ATTR_MIN_TEMP) == 15 + assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == API_TEMPERATURE_STEP + assert state.attributes.get(ATTR_TEMPERATURE) == 19.0 + async def test_airzone_climate_turn_on_off(hass: HomeAssistant) -> None: """Test turning on.""" @@ -187,6 +201,31 @@ async def test_airzone_climate_turn_on_off(hass: HomeAssistant) -> None: state = hass.states.get("climate.salon") assert state.state == HVACMode.OFF + HVAC_MOCK = { + API_DATA: [ + { + API_SYSTEM_ID: 2, + API_ZONE_ID: 1, + API_ON: 1, + } + ] + } + with patch( + "homeassistant.components.airzone.AirzoneLocalApi.put_hvac", + return_value=HVAC_MOCK, + ): + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_TURN_ON, + { + ATTR_ENTITY_ID: "climate.airzone_2_1", + }, + blocking=True, + ) + + state = hass.states.get("climate.airzone_2_1") + assert state.state == HVACMode.HEAT_COOL + async def test_airzone_climate_set_hvac_mode(hass: HomeAssistant) -> None: """Test setting the HVAC mode.""" @@ -246,6 +285,32 @@ async def test_airzone_climate_set_hvac_mode(hass: HomeAssistant) -> None: state = hass.states.get("climate.salon") assert state.state == HVACMode.OFF + HVAC_MOCK_3 = { + API_DATA: [ + { + API_SYSTEM_ID: 2, + API_ZONE_ID: 1, + API_ON: 1, + } + ] + } + with patch( + "homeassistant.components.airzone.AirzoneLocalApi.put_hvac", + return_value=HVAC_MOCK_3, + ): + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + { + ATTR_ENTITY_ID: "climate.airzone_2_1", + ATTR_HVAC_MODE: HVACMode.HEAT_COOL, + }, + blocking=True, + ) + + state = hass.states.get("climate.airzone_2_1") + assert state.state == HVACMode.HEAT_COOL + async def test_airzone_climate_set_hvac_slave_error(hass: HomeAssistant) -> None: """Test setting the HVAC mode for a slave zone.""" diff --git a/tests/components/airzone/test_sensor.py b/tests/components/airzone/test_sensor.py index bd57129cae0..248dc020732 100644 --- a/tests/components/airzone/test_sensor.py +++ b/tests/components/airzone/test_sensor.py @@ -48,3 +48,9 @@ async def test_airzone_create_sensors( state = hass.states.get("sensor.salon_humidity") assert state.state == "34" + + state = hass.states.get("sensor.airzone_2_1_temperature") + assert state.state == "22.3" + + state = hass.states.get("sensor.airzone_2_1_humidity") + assert state.state == "62" diff --git a/tests/components/airzone/util.py b/tests/components/airzone/util.py index 5bed0fc1d99..a29b035648b 100644 --- a/tests/components/airzone/util.py +++ b/tests/components/airzone/util.py @@ -177,7 +177,27 @@ HVAC_MOCK = { API_FLOOR_DEMAND: 0, }, ] - } + }, + { + API_DATA: [ + { + API_SYSTEM_ID: 2, + API_ZONE_ID: 1, + API_ON: 0, + API_MAX_TEMP: 30, + API_MIN_TEMP: 15, + API_SET_POINT: 19, + API_ROOM_TEMP: 22.299999, + API_COLD_STAGES: 1, + API_COLD_STAGE: 1, + API_HEAT_STAGES: 1, + API_HEAT_STAGE: 1, + API_HUMIDITY: 62, + API_UNITS: 0, + API_ERRORS: [], + }, + ] + }, ] }