From 667a00e7f9f07f78f038d27f5d5259a96674bbba Mon Sep 17 00:00:00 2001 From: Brett Adams Date: Sun, 9 Apr 2023 09:50:26 +1000 Subject: [PATCH] Handle all three operating modes in Advantage Air climate (#91107) Co-authored-by: J. Nick Koston --- .../components/advantage_air/climate.py | 109 +++++++++++++----- .../advantage_air/fixtures/getSystemData.json | 72 +++++++++++- .../advantage_air/test_binary_sensor.py | 12 +- .../components/advantage_air/test_climate.py | 77 ++++++++----- tests/components/advantage_air/test_cover.py | 30 ++--- tests/components/advantage_air/test_select.py | 2 +- tests/components/advantage_air/test_sensor.py | 14 +-- tests/components/advantage_air/test_switch.py | 2 +- 8 files changed, 225 insertions(+), 93 deletions(-) diff --git a/homeassistant/components/advantage_air/climate.py b/homeassistant/components/advantage_air/climate.py index 53a41994fc6..a8f0e9c884f 100644 --- a/homeassistant/components/advantage_air/climate.py +++ b/homeassistant/components/advantage_air/climate.py @@ -5,6 +5,8 @@ import logging from typing import Any from homeassistant.components.climate import ( + ATTR_TARGET_TEMP_HIGH, + ATTR_TARGET_TEMP_LOW, FAN_AUTO, FAN_HIGH, FAN_LOW, @@ -32,18 +34,10 @@ ADVANTAGE_AIR_HVAC_MODES = { "cool": HVACMode.COOL, "vent": HVACMode.FAN_ONLY, "dry": HVACMode.DRY, - "myauto": HVACMode.AUTO, + "myauto": HVACMode.HEAT_COOL, } HASS_HVAC_MODES = {v: k for k, v in ADVANTAGE_AIR_HVAC_MODES.items()} -AC_HVAC_MODES = [ - HVACMode.OFF, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.FAN_ONLY, - HVACMode.DRY, -] - ADVANTAGE_AIR_FAN_MODES = { "autoAA": FAN_AUTO, "low": FAN_LOW, @@ -53,7 +47,14 @@ ADVANTAGE_AIR_FAN_MODES = { HASS_FAN_MODES = {v: k for k, v in ADVANTAGE_AIR_FAN_MODES.items()} FAN_SPEEDS = {FAN_LOW: 30, FAN_MEDIUM: 60, FAN_HIGH: 100} -ZONE_HVAC_MODES = [HVACMode.OFF, HVACMode.HEAT_COOL] +ADVANTAGE_AIR_AUTOFAN = "aaAutoFanModeEnabled" +ADVANTAGE_AIR_MYZONE = "MyZone" +ADVANTAGE_AIR_MYAUTO = "MyAuto" +ADVANTAGE_AIR_MYAUTO_ENABLED = "myAutoModeEnabled" +ADVANTAGE_AIR_MYTEMP = "MyTemp" +ADVANTAGE_AIR_MYTEMP_ENABLED = "climateControlModeEnabled" +ADVANTAGE_AIR_HEAT_TARGET = "myAutoHeatTargetTemp" +ADVANTAGE_AIR_COOL_TARGET = "myAutoCoolTargetTemp" PARALLEL_UPDATES = 0 @@ -75,7 +76,7 @@ async def async_setup_entry( entities.append(AdvantageAirAC(instance, ac_key)) for zone_key, zone in ac_device["zones"].items(): # Only add zone climate control when zone is in temperature control - if zone["type"] != 0: + if zone["type"] > 0: entities.append(AdvantageAirZone(instance, ac_key, zone_key)) async_add_entities(entities) @@ -83,24 +84,56 @@ async def async_setup_entry( class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): """AdvantageAir AC unit.""" + _attr_fan_modes = [FAN_LOW, FAN_MEDIUM, FAN_HIGH] _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = PRECISION_WHOLE _attr_max_temp = 32 _attr_min_temp = 16 - _attr_fan_modes = [FAN_AUTO, FAN_LOW, FAN_MEDIUM, FAN_HIGH] - _attr_hvac_modes = AC_HVAC_MODES - _attr_supported_features = ( - ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE - ) def __init__(self, instance: dict[str, Any], ac_key: str) -> None: """Initialize an AdvantageAir AC unit.""" super().__init__(instance, ac_key) - if self._ac.get("myAutoModeEnabled"): - self._attr_hvac_modes = AC_HVAC_MODES + [HVACMode.AUTO] + + # Set supported features and HVAC modes based on current operating mode + if self._ac.get(ADVANTAGE_AIR_MYAUTO_ENABLED): + # MyAuto + self._attr_supported_features = ( + ClimateEntityFeature.FAN_MODE + | ClimateEntityFeature.TARGET_TEMPERATURE + | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + ) + self._attr_hvac_modes = [ + HVACMode.OFF, + HVACMode.COOL, + HVACMode.HEAT, + HVACMode.FAN_ONLY, + HVACMode.DRY, + HVACMode.HEAT_COOL, + ] + elif self._ac.get(ADVANTAGE_AIR_MYTEMP_ENABLED): + # MyTemp + self._attr_supported_features = ClimateEntityFeature.FAN_MODE + self._attr_hvac_modes = [HVACMode.OFF, HVACMode.COOL, HVACMode.HEAT] + + else: + # MyZone + self._attr_supported_features = ( + ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.TARGET_TEMPERATURE + ) + self._attr_hvac_modes = [ + HVACMode.OFF, + HVACMode.COOL, + HVACMode.HEAT, + HVACMode.FAN_ONLY, + HVACMode.DRY, + ] + + # Add "ezfan" mode if supported + if self._ac.get(ADVANTAGE_AIR_AUTOFAN): + self._attr_fan_modes += [FAN_AUTO] @property - def target_temperature(self) -> float: + def target_temperature(self) -> float | None: """Return the current target temperature.""" return self._ac["setTemp"] @@ -116,6 +149,16 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): """Return the current fan modes.""" return ADVANTAGE_AIR_FAN_MODES.get(self._ac["fan"]) + @property + def target_temperature_high(self) -> float | None: + """Return the temperature cool mode is enabled.""" + return self._ac.get(ADVANTAGE_AIR_COOL_TARGET) + + @property + def target_temperature_low(self) -> float | None: + """Return the temperature heat mode is enabled.""" + return self._ac.get(ADVANTAGE_AIR_HEAT_TARGET) + async def async_turn_on(self) -> None: """Set the HVAC State to on.""" await self.aircon( @@ -166,27 +209,37 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): async def async_set_temperature(self, **kwargs: Any) -> None: """Set the Temperature.""" - temp = kwargs.get(ATTR_TEMPERATURE) - await self.aircon({self.ac_key: {"info": {"setTemp": temp}}}) + if ATTR_TEMPERATURE in kwargs: + await self.aircon( + {self.ac_key: {"info": {"setTemp": kwargs[ATTR_TEMPERATURE]}}} + ) + if ATTR_TARGET_TEMP_LOW in kwargs and ATTR_TARGET_TEMP_HIGH in kwargs: + await self.aircon( + { + self.ac_key: { + "info": { + ADVANTAGE_AIR_COOL_TARGET: kwargs[ATTR_TARGET_TEMP_HIGH], + ADVANTAGE_AIR_HEAT_TARGET: kwargs[ATTR_TARGET_TEMP_LOW], + } + } + } + ) class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity): - """AdvantageAir Zone control.""" + """AdvantageAir MyTemp Zone control.""" + _attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT_COOL] + _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = PRECISION_WHOLE _attr_max_temp = 32 _attr_min_temp = 16 - _attr_hvac_modes = ZONE_HVAC_MODES - _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE def __init__(self, instance: dict[str, Any], ac_key: str, zone_key: str) -> None: """Initialize an AdvantageAir Zone control.""" super().__init__(instance, ac_key, zone_key) self._attr_name = self._zone["name"] - self._attr_unique_id = ( - f'{self.coordinator.data["system"]["rid"]}-{ac_key}-{zone_key}' - ) @property def hvac_mode(self) -> HVACMode: @@ -196,7 +249,7 @@ class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity): return HVACMode.OFF @property - def current_temperature(self) -> float: + def current_temperature(self) -> float | None: """Return the current temperature.""" return self._zone["measuredTemp"] diff --git a/tests/components/advantage_air/fixtures/getSystemData.json b/tests/components/advantage_air/fixtures/getSystemData.json index 327ee2d53d5..02d63bccb72 100644 --- a/tests/components/advantage_air/fixtures/getSystemData.json +++ b/tests/components/advantage_air/fixtures/getSystemData.json @@ -2,6 +2,8 @@ "aircons": { "ac1": { "info": { + "aaAutoFanModeEnabled": false, + "climateControlModeEnabled": false, "climateControlModeIsRunning": false, "countDownToOff": 10, "countDownToOn": 0, @@ -9,8 +11,10 @@ "filterCleanStatus": 0, "freshAirStatus": "off", "mode": "vent", + "myAutoModeEnabled": false, + "myAutoModeIsRunning": false, "myZone": 1, - "name": "AC One", + "name": "myzone", "setTemp": 24, "state": "on" }, @@ -94,20 +98,76 @@ }, "ac2": { "info": { + "aaAutoFanModeEnabled": true, + "climateControlModeEnabled": true, "climateControlModeIsRunning": false, "countDownToOff": 0, "countDownToOn": 20, - "fan": "low", + "fan": "autoAA", + "filterCleanStatus": 1, + "freshAirStatus": "none", + "mode": "cool", + "myAutoModeCurrentSetMode": "cool", + "myAutoModeEnabled": false, + "myAutoModeIsRunning": false, + "myZone": 1, + "name": "mytemp", + "setTemp": 24, + "state": "off" + }, + "zones": { + "z01": { + "error": 0, + "maxDamper": 100, + "measuredTemp": 25, + "minDamper": 0, + "motion": 20, + "motionConfig": 2, + "name": "Zone A", + "number": 1, + "rssi": 40, + "setTemp": 24, + "state": "open", + "type": 1, + "value": 100 + }, + "z02": { + "error": 0, + "maxDamper": 100, + "measuredTemp": 26, + "minDamper": 0, + "motion": 21, + "motionConfig": 2, + "name": "Zone B", + "number": 2, + "rssi": 10, + "setTemp": 23, + "state": "open", + "type": 1, + "value": 50 + } + } + }, + "ac3": { + "info": { + "aaAutoFanModeEnabled": true, + "climateControlModeEnabled": false, + "climateControlModeIsRunning": false, + "countDownToOff": 0, + "countDownToOn": 0, + "fan": "autoAA", "filterCleanStatus": 1, "freshAirStatus": "none", "mode": "myauto", "myAutoModeCurrentSetMode": "cool", "myAutoModeEnabled": true, "myAutoModeIsRunning": true, + "myAutoCoolTargetTemp": 24, + "myAutoHeatTargetTemp": 20, "myZone": 0, - "name": "AC Two", + "name": "myauto", "setTemp": 24, - "state": "off" + "state": "on" }, "zones": { "z01": { @@ -117,7 +177,7 @@ "minDamper": 0, "motion": 0, "motionConfig": 0, - "name": "Zone open without sensor", + "name": "Zone Y", "number": 1, "rssi": 0, "setTemp": 24, @@ -132,7 +192,7 @@ "minDamper": 0, "motion": 0, "motionConfig": 0, - "name": "Zone closed without sensor", + "name": "Zone Z", "number": 2, "rssi": 0, "setTemp": 24, diff --git a/tests/components/advantage_air/test_binary_sensor.py b/tests/components/advantage_air/test_binary_sensor.py index ebccd4d0d78..37e816b366b 100644 --- a/tests/components/advantage_air/test_binary_sensor.py +++ b/tests/components/advantage_air/test_binary_sensor.py @@ -39,7 +39,7 @@ async def test_binary_sensor_async_setup_entry( assert len(aioclient_mock.mock_calls) == 1 # Test First Air Filter - entity_id = "binary_sensor.ac_one_filter" + entity_id = "binary_sensor.myzone_filter" state = hass.states.get(entity_id) assert state assert state.state == STATE_OFF @@ -49,7 +49,7 @@ async def test_binary_sensor_async_setup_entry( assert entry.unique_id == "uniqueid-ac1-filter" # Test Second Air Filter - entity_id = "binary_sensor.ac_two_filter" + entity_id = "binary_sensor.mytemp_filter" state = hass.states.get(entity_id) assert state assert state.state == STATE_ON @@ -59,7 +59,7 @@ async def test_binary_sensor_async_setup_entry( assert entry.unique_id == "uniqueid-ac2-filter" # Test First Motion Sensor - entity_id = "binary_sensor.ac_one_zone_open_with_sensor_motion" + entity_id = "binary_sensor.myzone_zone_open_with_sensor_motion" state = hass.states.get(entity_id) assert state assert state.state == STATE_ON @@ -69,7 +69,7 @@ async def test_binary_sensor_async_setup_entry( assert entry.unique_id == "uniqueid-ac1-z01-motion" # Test Second Motion Sensor - entity_id = "binary_sensor.ac_one_zone_closed_with_sensor_motion" + entity_id = "binary_sensor.myzone_zone_closed_with_sensor_motion" state = hass.states.get(entity_id) assert state assert state.state == STATE_OFF @@ -79,7 +79,7 @@ async def test_binary_sensor_async_setup_entry( assert entry.unique_id == "uniqueid-ac1-z02-motion" # Test First MyZone Sensor (disabled by default) - entity_id = "binary_sensor.ac_one_zone_open_with_sensor_myzone" + entity_id = "binary_sensor.myzone_zone_open_with_sensor_myzone" assert not hass.states.get(entity_id) @@ -101,7 +101,7 @@ async def test_binary_sensor_async_setup_entry( assert entry.unique_id == "uniqueid-ac1-z01-myzone" # Test Second Motion Sensor (disabled by default) - entity_id = "binary_sensor.ac_one_zone_closed_with_sensor_myzone" + entity_id = "binary_sensor.myzone_zone_closed_with_sensor_myzone" assert not hass.states.get(entity_id) diff --git a/tests/components/advantage_air/test_climate.py b/tests/components/advantage_air/test_climate.py index b3412cb1bc2..b045092d78d 100644 --- a/tests/components/advantage_air/test_climate.py +++ b/tests/components/advantage_air/test_climate.py @@ -4,6 +4,8 @@ from json import loads import pytest from homeassistant.components.advantage_air.climate import ( + ADVANTAGE_AIR_COOL_TARGET, + ADVANTAGE_AIR_HEAT_TARGET, HASS_FAN_MODES, HASS_HVAC_MODES, ) @@ -14,8 +16,13 @@ from homeassistant.components.advantage_air.const import ( ADVANTAGE_AIR_STATE_OPEN, ) from homeassistant.components.climate import ( + ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_HVAC_MODE, + ATTR_MAX_TEMP, + ATTR_MIN_TEMP, + ATTR_TARGET_TEMP_HIGH, + ATTR_TARGET_TEMP_LOW, DOMAIN as CLIMATE_DOMAIN, FAN_LOW, SERVICE_SET_FAN_MODE, @@ -58,20 +65,21 @@ async def test_climate_async_setup_entry( registry = er.async_get(hass) - # Test Main Climate Entity - entity_id = "climate.ac_one" + # Test MyZone Climate Entity + entity_id = "climate.myzone" state = hass.states.get(entity_id) assert state assert state.state == HVACMode.FAN_ONLY - assert state.attributes.get("min_temp") == 16 - assert state.attributes.get("max_temp") == 32 - assert state.attributes.get("temperature") == 24 - assert state.attributes.get("current_temperature") is None + assert state.attributes.get(ATTR_MIN_TEMP) == 16 + assert state.attributes.get(ATTR_MAX_TEMP) == 32 + assert state.attributes.get(ATTR_TEMPERATURE) == 24 + assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) is None entry = registry.async_get(entity_id) assert entry assert entry.unique_id == "uniqueid-ac1" + # Test setting HVAC Mode await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, @@ -86,6 +94,7 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test Turning Off with HVAC Mode await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, @@ -99,6 +108,7 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test changing Fan Mode await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_FAN_MODE, @@ -112,6 +122,7 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test changing Temperature await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, @@ -125,6 +136,7 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test Turning On await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_TURN_OFF, @@ -138,6 +150,7 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test Turning Off await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_TURN_ON, @@ -152,24 +165,26 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" # Test Climate Zone Entity - entity_id = "climate.ac_one_zone_open_with_sensor" + entity_id = "climate.myzone_zone_open_with_sensor" state = hass.states.get(entity_id) assert state - assert state.attributes.get("min_temp") == 16 - assert state.attributes.get("max_temp") == 32 - assert state.attributes.get("temperature") == 24 - assert state.attributes.get("current_temperature") == 25 + assert state.attributes.get(ATTR_MIN_TEMP) == 16 + assert state.attributes.get(ATTR_MAX_TEMP) == 32 + assert state.attributes.get(ATTR_TEMPERATURE) == 24 + assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 25 entry = registry.async_get(entity_id) assert entry assert entry.unique_id == "uniqueid-ac1-z01" + # Test Climate Zone On await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, {ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.FAN_ONLY}, blocking=True, ) + assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) @@ -178,12 +193,14 @@ async def test_climate_async_setup_entry( assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test Climate Zone Off await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, {ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.OFF}, blocking=True, ) + assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) @@ -197,36 +214,38 @@ async def test_climate_async_setup_entry( {ATTR_ENTITY_ID: [entity_id], ATTR_TEMPERATURE: 25}, blocking=True, ) + assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" - await hass.services.async_call( - CLIMATE_DOMAIN, - SERVICE_TURN_OFF, - {ATTR_ENTITY_ID: [entity_id]}, - blocking=True, - ) - assert aioclient_mock.mock_calls[-2][0] == "GET" - assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" - data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac1"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE - assert aioclient_mock.mock_calls[-1][0] == "GET" - assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + # Test MyAuto Climate Entity + entity_id = "climate.myauto" + state = hass.states.get(entity_id) + assert state + assert state.attributes.get(ATTR_TARGET_TEMP_LOW) == 20 + assert state.attributes.get(ATTR_TARGET_TEMP_HIGH) == 24 + + entry = registry.async_get(entity_id) + assert entry + assert entry.unique_id == "uniqueid-ac3" await hass.services.async_call( CLIMATE_DOMAIN, - SERVICE_TURN_ON, - {ATTR_ENTITY_ID: [entity_id]}, + SERVICE_SET_TEMPERATURE, + { + ATTR_ENTITY_ID: [entity_id], + ATTR_TARGET_TEMP_LOW: 21, + ATTR_TARGET_TEMP_HIGH: 23, + }, blocking=True, ) assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac1"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN - assert aioclient_mock.mock_calls[-1][0] == "GET" - assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" + assert data["ac3"]["info"][ADVANTAGE_AIR_HEAT_TARGET] == 21 + assert data["ac3"]["info"][ADVANTAGE_AIR_COOL_TARGET] == 23 async def test_climate_async_failed_update( @@ -248,7 +267,7 @@ async def test_climate_async_failed_update( await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, - {ATTR_ENTITY_ID: ["climate.ac_one"], ATTR_TEMPERATURE: 25}, + {ATTR_ENTITY_ID: ["climate.myzone"], ATTR_TEMPERATURE: 25}, blocking=True, ) assert aioclient_mock.mock_calls[-1][0] == "GET" diff --git a/tests/components/advantage_air/test_cover.py b/tests/components/advantage_air/test_cover.py index 8999cbe6e68..fd82bf94744 100644 --- a/tests/components/advantage_air/test_cover.py +++ b/tests/components/advantage_air/test_cover.py @@ -49,7 +49,7 @@ async def test_cover_async_setup_entry( assert len(aioclient_mock.mock_calls) == 1 # Test Cover Zone Entity - entity_id = "cover.ac_two_zone_open_without_sensor" + entity_id = "cover.myauto_zone_y" state = hass.states.get(entity_id) assert state assert state.state == STATE_OPEN @@ -58,7 +58,7 @@ async def test_cover_async_setup_entry( entry = registry.async_get(entity_id) assert entry - assert entry.unique_id == "uniqueid-ac2-z01" + assert entry.unique_id == "uniqueid-ac3-z01" await hass.services.async_call( COVER_DOMAIN, @@ -70,7 +70,7 @@ async def test_cover_async_setup_entry( assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE + assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" @@ -84,8 +84,8 @@ async def test_cover_async_setup_entry( assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN - assert data["ac2"]["zones"]["z01"]["value"] == 100 + assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN + assert data["ac3"]["zones"]["z01"]["value"] == 100 assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" @@ -99,7 +99,7 @@ async def test_cover_async_setup_entry( assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["value"] == 50 + assert data["ac3"]["zones"]["z01"]["value"] == 50 assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" @@ -113,7 +113,7 @@ async def test_cover_async_setup_entry( assert aioclient_mock.mock_calls[-2][0] == "GET" assert aioclient_mock.mock_calls[-2][1].path == "/setAircon" data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE + assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE assert aioclient_mock.mock_calls[-1][0] == "GET" assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" @@ -123,28 +123,28 @@ async def test_cover_async_setup_entry( SERVICE_CLOSE_COVER, { ATTR_ENTITY_ID: [ - "cover.ac_two_zone_open_without_sensor", - "cover.ac_two_zone_closed_without_sensor", + "cover.myauto_zone_y", + "cover.myauto_zone_z", ] }, blocking=True, ) assert len(aioclient_mock.mock_calls) == 11 data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE - assert data["ac2"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_CLOSE + assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE + assert data["ac3"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_CLOSE await hass.services.async_call( COVER_DOMAIN, SERVICE_OPEN_COVER, { ATTR_ENTITY_ID: [ - "cover.ac_two_zone_open_without_sensor", - "cover.ac_two_zone_closed_without_sensor", + "cover.myauto_zone_y", + "cover.myauto_zone_z", ] }, blocking=True, ) assert len(aioclient_mock.mock_calls) == 13 data = loads(aioclient_mock.mock_calls[-2][1].query["json"]) - assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN - assert data["ac2"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_OPEN + assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN + assert data["ac3"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_OPEN diff --git a/tests/components/advantage_air/test_select.py b/tests/components/advantage_air/test_select.py index 45c47e8bfe1..9209862f3c9 100644 --- a/tests/components/advantage_air/test_select.py +++ b/tests/components/advantage_air/test_select.py @@ -42,7 +42,7 @@ async def test_select_async_setup_entry( assert len(aioclient_mock.mock_calls) == 1 # Test MyZone Select Entity - entity_id = "select.ac_one_myzone" + entity_id = "select.myzone_myzone" state = hass.states.get(entity_id) assert state assert state.state == "Zone open with Sensor" diff --git a/tests/components/advantage_air/test_sensor.py b/tests/components/advantage_air/test_sensor.py index 9fc17fa55b2..2a7be320be6 100644 --- a/tests/components/advantage_air/test_sensor.py +++ b/tests/components/advantage_air/test_sensor.py @@ -45,7 +45,7 @@ async def test_sensor_platform( assert len(aioclient_mock.mock_calls) == 1 # Test First TimeToOn Sensor - entity_id = "sensor.ac_one_time_to_on" + entity_id = "sensor.myzone_time_to_on" state = hass.states.get(entity_id) assert state assert int(state.state) == 0 @@ -70,7 +70,7 @@ async def test_sensor_platform( assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" # Test First TimeToOff Sensor - entity_id = "sensor.ac_one_time_to_off" + entity_id = "sensor.myzone_time_to_off" state = hass.states.get(entity_id) assert state assert int(state.state) == 10 @@ -95,7 +95,7 @@ async def test_sensor_platform( assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData" # Test First Zone Vent Sensor - entity_id = "sensor.ac_one_zone_open_with_sensor_vent" + entity_id = "sensor.myzone_zone_open_with_sensor_vent" state = hass.states.get(entity_id) assert state assert int(state.state) == 100 @@ -105,7 +105,7 @@ async def test_sensor_platform( assert entry.unique_id == "uniqueid-ac1-z01-vent" # Test Second Zone Vent Sensor - entity_id = "sensor.ac_one_zone_closed_with_sensor_vent" + entity_id = "sensor.myzone_zone_closed_with_sensor_vent" state = hass.states.get(entity_id) assert state assert int(state.state) == 0 @@ -115,7 +115,7 @@ async def test_sensor_platform( assert entry.unique_id == "uniqueid-ac1-z02-vent" # Test First Zone Signal Sensor - entity_id = "sensor.ac_one_zone_open_with_sensor_signal" + entity_id = "sensor.myzone_zone_open_with_sensor_signal" state = hass.states.get(entity_id) assert state assert int(state.state) == 40 @@ -125,7 +125,7 @@ async def test_sensor_platform( assert entry.unique_id == "uniqueid-ac1-z01-signal" # Test Second Zone Signal Sensor - entity_id = "sensor.ac_one_zone_closed_with_sensor_signal" + entity_id = "sensor.myzone_zone_closed_with_sensor_signal" state = hass.states.get(entity_id) assert state assert int(state.state) == 10 @@ -135,7 +135,7 @@ async def test_sensor_platform( assert entry.unique_id == "uniqueid-ac1-z02-signal" # Test First Zone Temp Sensor (disabled by default) - entity_id = "sensor.ac_one_zone_open_with_sensor_temperature" + entity_id = "sensor.myzone_zone_open_with_sensor_temperature" assert not hass.states.get(entity_id) diff --git a/tests/components/advantage_air/test_switch.py b/tests/components/advantage_air/test_switch.py index 9730262352a..8d0be7755a5 100644 --- a/tests/components/advantage_air/test_switch.py +++ b/tests/components/advantage_air/test_switch.py @@ -46,7 +46,7 @@ async def test_cover_async_setup_entry( assert len(aioclient_mock.mock_calls) == 1 # Test Switch Entity - entity_id = "switch.ac_one_fresh_air" + entity_id = "switch.myzone_fresh_air" state = hass.states.get(entity_id) assert state assert state.state == STATE_OFF