Replace Climate HVAC_MODE_* constants with HVACMode enum (#70286)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Franck Nijhof 2022-04-20 13:20:53 +02:00 committed by GitHub
parent 0dc426e2c4
commit a22f36178f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 87 additions and 86 deletions

View file

@ -2,37 +2,45 @@
from enum import IntEnum
# All activity disabled / Device is off/standby
from homeassistant.backports.enum import StrEnum
class HVACMode(StrEnum):
"""HVAC mode for climate devices."""
# All activity disabled / Device is off/standby
OFF = "off"
# Heating
HEAT = "heat"
# Cooling
COOL = "cool"
# The device supports heating/cooling to a range
HEAT_COOL = "heat_cool"
# The temperature is set based on a schedule, learned behavior, AI or some
# other related mechanism. User is not able to adjust the temperature
AUTO = "auto"
# Device is in Dry/Humidity mode
DRY = "dry"
# Only the fan is on, not fan and another mode like cool
FAN_ONLY = "fan_only"
# These HVAC_MODE_* constants are deprecated as of Home Assistant 2022.5.
# Please use the HVACMode enum instead.
HVAC_MODE_OFF = "off"
# Heating
HVAC_MODE_HEAT = "heat"
# Cooling
HVAC_MODE_COOL = "cool"
# The device supports heating/cooling to a range
HVAC_MODE_HEAT_COOL = "heat_cool"
# The temperature is set based on a schedule, learned behavior, AI or some
# other related mechanism. User is not able to adjust the temperature
HVAC_MODE_AUTO = "auto"
# Device is in Dry/Humidity mode
HVAC_MODE_DRY = "dry"
# Only the fan is on, not fan and another mode like cool
HVAC_MODE_FAN_ONLY = "fan_only"
HVAC_MODES = [
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_AUTO,
HVAC_MODE_DRY,
HVAC_MODE_FAN_ONLY,
]
HVAC_MODES = [cls.value for cls in HVACMode]
# No preset is active
PRESET_NONE = "none"
@ -149,7 +157,7 @@ class ClimateEntityFeature(IntEnum):
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
# Pleease use the ClimateEntityFeature enum instead.
# Please use the ClimateEntityFeature enum instead.
SUPPORT_TARGET_TEMPERATURE = 1
SUPPORT_TARGET_TEMPERATURE_RANGE = 2
SUPPORT_TARGET_HUMIDITY = 4