From edb6da3efa256559b09e7e73a7c3250a6e4b8a99 Mon Sep 17 00:00:00 2001 From: abmantis Date: Thu, 10 Apr 2025 19:20:53 +0100 Subject: [PATCH] Add missing humidity feature flag to Whirlpool climate Both the service action and attribute were implemented already. --- homeassistant/components/whirlpool/climate.py | 1 + .../whirlpool/snapshots/test_climate.ambr | 18 ++++++++++++++---- tests/components/whirlpool/test_climate.py | 7 +++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/whirlpool/climate.py b/homeassistant/components/whirlpool/climate.py index 6829dca3004..145f951f821 100644 --- a/homeassistant/components/whirlpool/climate.py +++ b/homeassistant/components/whirlpool/climate.py @@ -78,6 +78,7 @@ class AirConEntity(WhirlpoolEntity, ClimateEntity): _attr_should_poll = False _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE + | ClimateEntityFeature.TARGET_HUMIDITY | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.SWING_MODE | ClimateEntityFeature.TURN_OFF diff --git a/tests/components/whirlpool/snapshots/test_climate.ambr b/tests/components/whirlpool/snapshots/test_climate.ambr index 2957a609fa2..3db164c6025 100644 --- a/tests/components/whirlpool/snapshots/test_climate.ambr +++ b/tests/components/whirlpool/snapshots/test_climate.ambr @@ -18,7 +18,9 @@ , , ]), + 'max_humidity': 99, 'max_temp': 30, + 'min_humidity': 30, 'min_temp': 16, 'swing_modes': list([ 'horizontal', @@ -48,7 +50,7 @@ 'original_name': None, 'platform': 'whirlpool', 'previous_unique_id': None, - 'supported_features': , + 'supported_features': , 'translation_key': None, 'unique_id': 'said1', 'unit_of_measurement': None, @@ -68,15 +70,18 @@ 'off', ]), 'friendly_name': 'Aircon said1', + 'humidity': 50, 'hvac_modes': list([ , , , , ]), + 'max_humidity': 99, 'max_temp': 30, + 'min_humidity': 30, 'min_temp': 16, - 'supported_features': , + 'supported_features': , 'swing_mode': 'horizontal', 'swing_modes': list([ 'horizontal', @@ -112,7 +117,9 @@ , , ]), + 'max_humidity': 99, 'max_temp': 30, + 'min_humidity': 30, 'min_temp': 16, 'swing_modes': list([ 'horizontal', @@ -142,7 +149,7 @@ 'original_name': None, 'platform': 'whirlpool', 'previous_unique_id': None, - 'supported_features': , + 'supported_features': , 'translation_key': None, 'unique_id': 'said2', 'unit_of_measurement': None, @@ -162,15 +169,18 @@ 'off', ]), 'friendly_name': 'Aircon said2', + 'humidity': 50, 'hvac_modes': list([ , , , , ]), + 'max_humidity': 99, 'max_temp': 30, + 'min_humidity': 30, 'min_temp': 16, - 'supported_features': , + 'supported_features': , 'swing_mode': 'horizontal', 'swing_modes': list([ 'horizontal', diff --git a/tests/components/whirlpool/test_climate.py b/tests/components/whirlpool/test_climate.py index 31ae253031b..536f9ae1a84 100644 --- a/tests/components/whirlpool/test_climate.py +++ b/tests/components/whirlpool/test_climate.py @@ -10,6 +10,7 @@ from homeassistant.components.climate import ( ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, + ATTR_HUMIDITY, ATTR_HVAC_MODE, ATTR_SWING_MODE, DOMAIN as CLIMATE_DOMAIN, @@ -20,6 +21,7 @@ from homeassistant.components.climate import ( FAN_MIDDLE, FAN_OFF, SERVICE_SET_FAN_MODE, + SERVICE_SET_HUMIDITY, SERVICE_SET_HVAC_MODE, SERVICE_SET_SWING_MODE, SERVICE_SET_TEMPERATURE, @@ -136,21 +138,25 @@ async def test_dynamic_attributes( mock_instance.get_current_temp.return_value = 15 mock_instance.get_temp.return_value = 20 mock_instance.get_current_humidity.return_value = 80 + mock_instance.get_humidity.return_value = 30 mock_instance.get_h_louver_swing.return_value = True attributes = (await update_ac_state(hass, entity_id, mock_instance)).attributes assert attributes[ATTR_CURRENT_TEMPERATURE] == 15 assert attributes[ATTR_TEMPERATURE] == 20 assert attributes[ATTR_CURRENT_HUMIDITY] == 80 + assert attributes[ATTR_HUMIDITY] == 30 assert attributes[ATTR_SWING_MODE] == SWING_HORIZONTAL mock_instance.get_current_temp.return_value = 16 mock_instance.get_temp.return_value = 21 mock_instance.get_current_humidity.return_value = 70 + mock_instance.get_humidity.return_value = 40 mock_instance.get_h_louver_swing.return_value = False attributes = (await update_ac_state(hass, entity_id, mock_instance)).attributes assert attributes[ATTR_CURRENT_TEMPERATURE] == 16 assert attributes[ATTR_TEMPERATURE] == 21 assert attributes[ATTR_CURRENT_HUMIDITY] == 70 + assert attributes[ATTR_HUMIDITY] == 40 assert attributes[ATTR_SWING_MODE] == SWING_OFF @@ -184,6 +190,7 @@ async def test_dynamic_attributes( [False], ), (SERVICE_SET_TEMPERATURE, {ATTR_TEMPERATURE: 20}, "set_temp", [20]), + (SERVICE_SET_HUMIDITY, {ATTR_HUMIDITY: 30}, "set_humidity", [30]), ( SERVICE_SET_FAN_MODE, {ATTR_FAN_MODE: FAN_AUTO},