Skip to content

Commit

Permalink
All tests passing. But using deprecated constants
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocarrera authored and swingerman committed Nov 7, 2022
1 parent 1c3f242 commit e2504c5
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions custom_components/dual_smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e2504c5

Please sign in to comment.