From e2504c5d7de29bb6d442e15f3c04c695301e5a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Carrera=20Barroso?= Date: Mon, 7 Nov 2022 09:48:32 +0000 Subject: [PATCH] All tests passing. But using deprecated constants --- .../dual_smart_thermostat/climate.py | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/custom_components/dual_smart_thermostat/climate.py b/custom_components/dual_smart_thermostat/climate.py index f2bc739..3320338 100644 --- a/custom_components/dual_smart_thermostat/climate.py +++ b/custom_components/dual_smart_thermostat/climate.py @@ -16,7 +16,9 @@ PRESET_COMFORT, PRESET_HOME, PRESET_NONE, - ClimateEntityFeature, + SUPPORT_PRESET_MODE, + SUPPORT_TARGET_TEMPERATURE, + SUPPORT_TARGET_TEMPERATURE_RANGE, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -272,16 +274,16 @@ def __init__( self._unit = unit self._unique_id = unique_id self._support_flags = ( - ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + SUPPORT_TARGET_TEMPERATURE_RANGE if cooler_entity_id - else ClimateEntityFeature.TARGET_TEMPERATURE + else SUPPORT_TARGET_TEMPERATURE ) if away_temp or eco_temp or comfort_temp or at_home_temp or anti_freeze_temp: self._support_flags = ( - ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + SUPPORT_TARGET_TEMPERATURE_RANGE if cooler_entity_id - else ClimateEntityFeature.TARGET_TEMPERATURE - ) | ClimateEntityFeature.PRESET_MODE + else SUPPORT_TARGET_TEMPERATURE + ) | SUPPORT_PRESET_MODE self._away_temp = away_temp self._eco_temp = eco_temp self._comfort_temp = comfort_temp @@ -549,28 +551,25 @@ async def async_set_hvac_mode(self, hvac_mode): if hvac_mode == HVACMode.HEAT: self._hvac_mode = HVACMode.HEAT self._support_flags = ( - ClimateEntityFeature.TARGET_TEMPERATURE - | ClimateEntityFeature.PRESET_MODE - if self._support_flags >= ClimateEntityFeature.PRESET_MODE - else ClimateEntityFeature.TARGET_TEMPERATURE + SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE + if self._support_flags >= SUPPORT_PRESET_MODE + else SUPPORT_TARGET_TEMPERATURE ) await self._async_control_heating(force=True) elif hvac_mode == HVACMode.COOL: self._hvac_mode = HVACMode.COOL self._support_flags = ( - ClimateEntityFeature.TARGET_TEMPERATURE - | ClimateEntityFeature.PRESET_MODE - if self._support_flags >= ClimateEntityFeature.PRESET_MODE - else ClimateEntityFeature.TARGET_TEMPERATURE + SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE + if self._support_flags >= SUPPORT_PRESET_MODE + else SUPPORT_TARGET_TEMPERATURE ) await self._async_control_cooling(force=True) elif hvac_mode == HVACMode.HEAT_COOL: self._hvac_mode = HVACMode.HEAT_COOL self._support_flags = ( - ClimateEntityFeature.TARGET_TEMPERATURE_RANGE - | ClimateEntityFeature.PRESET_MODE - if self._support_flags >= ClimateEntityFeature.PRESET_MODE - else ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + SUPPORT_TARGET_TEMPERATURE_RANGE | SUPPORT_PRESET_MODE + if self._support_flags >= SUPPORT_PRESET_MODE + else SUPPORT_TARGET_TEMPERATURE_RANGE ) await self._async_control_heat_cool(force=True) elif hvac_mode == HVACMode.OFF: