1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-31 04:34:10 +01:00

Remove uneeded check for fan mode in Whirlpool (#152053)

This commit is contained in:
Abílio Costa
2025-09-10 14:47:05 +01:00
committed by GitHub
parent 1663ad1adb
commit fad8d4fca2
2 changed files with 23 additions and 31 deletions
+3 -11
View File
@@ -43,13 +43,6 @@ AIRCON_FANSPEED_MAP = {
FAN_MODE_TO_AIRCON_FANSPEED = {v: k for k, v in AIRCON_FANSPEED_MAP.items()}
SUPPORTED_FAN_MODES = [FAN_AUTO, FAN_HIGH, FAN_MEDIUM, FAN_LOW, FAN_OFF]
SUPPORTED_HVAC_MODES = [
HVACMode.COOL,
HVACMode.HEAT,
HVACMode.FAN_ONLY,
HVACMode.OFF,
]
SUPPORTED_MAX_TEMP = 30
SUPPORTED_MIN_TEMP = 16
SUPPORTED_SWING_MODES = [SWING_HORIZONTAL, SWING_OFF]
@@ -71,9 +64,9 @@ class AirConEntity(WhirlpoolEntity, ClimateEntity):
_appliance: Aircon
_attr_fan_modes = SUPPORTED_FAN_MODES
_attr_name = None
_attr_hvac_modes = SUPPORTED_HVAC_MODES
_attr_fan_modes = [*FAN_MODE_TO_AIRCON_FANSPEED.keys()]
_attr_hvac_modes = [HVACMode.OFF, *HVAC_MODE_TO_AIRCON_MODE.keys()]
_attr_max_temp = SUPPORTED_MAX_TEMP
_attr_min_temp = SUPPORTED_MIN_TEMP
_attr_supported_features = (
@@ -143,8 +136,7 @@ class AirConEntity(WhirlpoolEntity, ClimateEntity):
async def async_set_fan_mode(self, fan_mode: str) -> None:
"""Set fan mode."""
if not (fanspeed := FAN_MODE_TO_AIRCON_FANSPEED.get(fan_mode)):
raise ValueError(f"Invalid fan mode {fan_mode}")
fanspeed = FAN_MODE_TO_AIRCON_FANSPEED[fan_mode]
await self._appliance.set_fanspeed(fanspeed)
@property
@@ -6,17 +6,17 @@
'area_id': None,
'capabilities': dict({
'fan_modes': list([
'auto',
'high',
'medium',
'low',
'off',
'auto',
'low',
'medium',
'high',
]),
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.COOL: 'cool'>,
<HVACMode.HEAT: 'heat'>,
<HVACMode.FAN_ONLY: 'fan_only'>,
<HVACMode.OFF: 'off'>,
]),
'max_temp': 30,
'min_temp': 16,
@@ -62,18 +62,18 @@
'current_temperature': 15,
'fan_mode': 'auto',
'fan_modes': list([
'auto',
'high',
'medium',
'low',
'off',
'auto',
'low',
'medium',
'high',
]),
'friendly_name': 'Aircon said1',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.COOL: 'cool'>,
<HVACMode.HEAT: 'heat'>,
<HVACMode.FAN_ONLY: 'fan_only'>,
<HVACMode.OFF: 'off'>,
]),
'max_temp': 30,
'min_temp': 16,
@@ -101,17 +101,17 @@
'area_id': None,
'capabilities': dict({
'fan_modes': list([
'auto',
'high',
'medium',
'low',
'off',
'auto',
'low',
'medium',
'high',
]),
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.COOL: 'cool'>,
<HVACMode.HEAT: 'heat'>,
<HVACMode.FAN_ONLY: 'fan_only'>,
<HVACMode.OFF: 'off'>,
]),
'max_temp': 30,
'min_temp': 16,
@@ -157,18 +157,18 @@
'current_temperature': 15,
'fan_mode': 'auto',
'fan_modes': list([
'auto',
'high',
'medium',
'low',
'off',
'auto',
'low',
'medium',
'high',
]),
'friendly_name': 'Aircon said2',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.COOL: 'cool'>,
<HVACMode.HEAT: 'heat'>,
<HVACMode.FAN_ONLY: 'fan_only'>,
<HVACMode.OFF: 'off'>,
]),
'max_temp': 30,
'min_temp': 16,