From 98293f2179fdb6d0d6dc559f7d80d601efeb96e3 Mon Sep 17 00:00:00 2001
From: epenet <6771947+epenet@users.noreply.github.com>
Date: Sun, 31 Jul 2022 21:29:54 +0200
Subject: [PATCH] Use climate enums in alexa (#75911)

---
 homeassistant/components/alexa/capabilities.py |  2 +-
 homeassistant/components/alexa/const.py        | 16 ++++++++--------
 homeassistant/components/alexa/entities.py     |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/homeassistant/components/alexa/capabilities.py b/homeassistant/components/alexa/capabilities.py
index 3963372fec1..1456221e20e 100644
--- a/homeassistant/components/alexa/capabilities.py
+++ b/homeassistant/components/alexa/capabilities.py
@@ -379,7 +379,7 @@ class AlexaPowerController(AlexaCapability):
             raise UnsupportedProperty(name)
 
         if self.entity.domain == climate.DOMAIN:
-            is_on = self.entity.state != climate.HVAC_MODE_OFF
+            is_on = self.entity.state != climate.HVACMode.OFF
         elif self.entity.domain == fan.DOMAIN:
             is_on = self.entity.state == fan.STATE_ON
         elif self.entity.domain == vacuum.DOMAIN:
diff --git a/homeassistant/components/alexa/const.py b/homeassistant/components/alexa/const.py
index 6b509d9b3c6..c6ac3071d94 100644
--- a/homeassistant/components/alexa/const.py
+++ b/homeassistant/components/alexa/const.py
@@ -68,16 +68,16 @@ API_TEMP_UNITS = {TEMP_FAHRENHEIT: "FAHRENHEIT", TEMP_CELSIUS: "CELSIUS"}
 # back to HA state.
 API_THERMOSTAT_MODES = OrderedDict(
     [
-        (climate.HVAC_MODE_HEAT, "HEAT"),
-        (climate.HVAC_MODE_COOL, "COOL"),
-        (climate.HVAC_MODE_HEAT_COOL, "AUTO"),
-        (climate.HVAC_MODE_AUTO, "AUTO"),
-        (climate.HVAC_MODE_OFF, "OFF"),
-        (climate.HVAC_MODE_FAN_ONLY, "OFF"),
-        (climate.HVAC_MODE_DRY, "CUSTOM"),
+        (climate.HVACMode.HEAT, "HEAT"),
+        (climate.HVACMode.COOL, "COOL"),
+        (climate.HVACMode.HEAT_COOL, "AUTO"),
+        (climate.HVACMode.AUTO, "AUTO"),
+        (climate.HVACMode.OFF, "OFF"),
+        (climate.HVACMode.FAN_ONLY, "OFF"),
+        (climate.HVACMode.DRY, "CUSTOM"),
     ]
 )
-API_THERMOSTAT_MODES_CUSTOM = {climate.HVAC_MODE_DRY: "DEHUMIDIFY"}
+API_THERMOSTAT_MODES_CUSTOM = {climate.HVACMode.DRY: "DEHUMIDIFY"}
 API_THERMOSTAT_PRESETS = {climate.PRESET_ECO: "ECO"}
 
 # AlexaModeController does not like a single mode for the fan preset, we add PRESET_MODE_NA if a fan has only one preset_mode
diff --git a/homeassistant/components/alexa/entities.py b/homeassistant/components/alexa/entities.py
index f380f990449..ac78dbeed5e 100644
--- a/homeassistant/components/alexa/entities.py
+++ b/homeassistant/components/alexa/entities.py
@@ -460,7 +460,7 @@ class ClimateCapabilities(AlexaEntity):
     def interfaces(self):
         """Yield the supported interfaces."""
         # If we support two modes, one being off, we allow turning on too.
-        if climate.HVAC_MODE_OFF in self.entity.attributes.get(
+        if climate.HVACMode.OFF in self.entity.attributes.get(
             climate.ATTR_HVAC_MODES, []
         ):
             yield AlexaPowerController(self.entity)