From 6988b0725d33f604ab14aeb9eb734e734399c9ea Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 25 Apr 2022 11:25:29 +0200 Subject: [PATCH] Use climate enums in ambiclimate (#70625) --- homeassistant/components/ambiclimate/climate.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/ambiclimate/climate.py b/homeassistant/components/ambiclimate/climate.py index e461196ed97..0bf4ec35526 100644 --- a/homeassistant/components/ambiclimate/climate.py +++ b/homeassistant/components/ambiclimate/climate.py @@ -8,8 +8,8 @@ from typing import Any import ambiclimate import voluptuous as vol -from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature -from homeassistant.components.climate.const import HVAC_MODE_HEAT, HVAC_MODE_OFF +from homeassistant.components.climate import ClimateEntity +from homeassistant.components.climate.const import ClimateEntityFeature, HVACMode from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_NAME, @@ -149,7 +149,7 @@ class AmbiclimateEntity(ClimateEntity): _attr_temperature_unit = TEMP_CELSIUS _attr_target_temperature_step = 1 _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - _attr_hvac_modes = [HVAC_MODE_HEAT, HVAC_MODE_OFF] + _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] def __init__(self, heater, store): """Initialize the thermostat.""" @@ -171,10 +171,10 @@ class AmbiclimateEntity(ClimateEntity): async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set new target hvac mode.""" - if hvac_mode == HVAC_MODE_HEAT: + if hvac_mode == HVACMode.HEAT: await self._heater.turn_on() return - if hvac_mode == HVAC_MODE_OFF: + if hvac_mode == HVACMode.OFF: await self._heater.turn_off() async def async_update(self) -> None: @@ -195,5 +195,5 @@ class AmbiclimateEntity(ClimateEntity): self._attr_current_temperature = data.get("temperature") self._attr_current_humidity = data.get("humidity") self._attr_hvac_mode = ( - HVAC_MODE_HEAT if data.get("power", "").lower() == "on" else HVAC_MODE_OFF + HVACMode.HEAT if data.get("power", "").lower() == "on" else HVACMode.OFF )