diff --git a/homeassistant/components/stiebel_eltron/climate.py b/homeassistant/components/stiebel_eltron/climate.py index 3b349713877..1aab76813ee 100644 --- a/homeassistant/components/stiebel_eltron/climate.py +++ b/homeassistant/components/stiebel_eltron/climate.py @@ -3,12 +3,11 @@ from __future__ import annotations import logging -from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature +from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( - HVAC_MODE_AUTO, - HVAC_MODE_HEAT, - HVAC_MODE_OFF, PRESET_ECO, + ClimateEntityFeature, + HVACMode, ) from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.core import HomeAssistant @@ -25,18 +24,18 @@ PRESET_DAY = "day" PRESET_SETBACK = "setback" PRESET_EMERGENCY = "emergency" -SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF] +SUPPORT_HVAC = [HVACMode.AUTO, HVACMode.HEAT, HVACMode.OFF] SUPPORT_PRESET = [PRESET_ECO, PRESET_DAY, PRESET_EMERGENCY, PRESET_SETBACK] # Mapping STIEBEL ELTRON states to homeassistant states/preset. STE_TO_HA_HVAC = { - "AUTOMATIC": HVAC_MODE_AUTO, - "MANUAL MODE": HVAC_MODE_HEAT, - "STANDBY": HVAC_MODE_AUTO, - "DAY MODE": HVAC_MODE_AUTO, - "SETBACK MODE": HVAC_MODE_AUTO, - "DHW": HVAC_MODE_OFF, - "EMERGENCY OPERATION": HVAC_MODE_AUTO, + "AUTOMATIC": HVACMode.AUTO, + "MANUAL MODE": HVACMode.HEAT, + "STANDBY": HVACMode.AUTO, + "DAY MODE": HVACMode.AUTO, + "SETBACK MODE": HVACMode.AUTO, + "DHW": HVACMode.OFF, + "EMERGENCY OPERATION": HVACMode.AUTO, } STE_TO_HA_PRESET = { @@ -47,9 +46,9 @@ STE_TO_HA_PRESET = { } HA_TO_STE_HVAC = { - HVAC_MODE_AUTO: "AUTOMATIC", - HVAC_MODE_HEAT: "MANUAL MODE", - HVAC_MODE_OFF: "DHW", + HVACMode.AUTO: "AUTOMATIC", + HVACMode.HEAT: "MANUAL MODE", + HVACMode.OFF: "DHW", } HA_TO_STE_PRESET = {k: i for i, k in STE_TO_HA_PRESET.items()} @@ -71,6 +70,7 @@ def setup_platform( class StiebelEltron(ClimateEntity): """Representation of a STIEBEL ELTRON heat pump.""" + _attr_hvac_modes = SUPPORT_HVAC _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) @@ -148,12 +148,7 @@ class StiebelEltron(ClimateEntity): return float(f"{self._current_humidity:.1f}") @property - def hvac_modes(self): - """List of the operation modes.""" - return SUPPORT_HVAC - - @property - def hvac_mode(self): + def hvac_mode(self) -> HVACMode | None: """Return current operation ie. heat, cool, idle.""" return STE_TO_HA_HVAC.get(self._operation) @@ -167,7 +162,7 @@ class StiebelEltron(ClimateEntity): """Return a list of available preset modes.""" return SUPPORT_PRESET - def set_hvac_mode(self, hvac_mode): + def set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new operation mode.""" if self.preset_mode: return