Skip to content

Commit

Permalink
Add TURN_ON and TURN_OFF features. Closes #206
Browse files Browse the repository at this point in the history
  • Loading branch information
ScratMan committed Feb 14, 2024
1 parent 772781d commit 7b2c541
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ def __init__(self, **kwargs):
self._target_temp = kwargs.get('target_temp')
self._unit = kwargs.get('unit')
self._support_flags = ClimateEntityFeature.TARGET_TEMPERATURE
self._support_flags |= ClimateEntityFeature.TURN_OFF
self._support_flags |= ClimateEntityFeature.TURN_ON
self._enable_turn_on_off_backwards_compatibility = False # To be removed after deprecation period
self._attr_preset_mode = 'none'
self._away_temp = kwargs.get('away_temp')
self._eco_temp = kwargs.get('eco_temp')
Expand All @@ -301,8 +304,7 @@ def __init__(self, **kwargs):
self._home_temp,
self._sleep_temp,
self._activity_temp]]:
self._support_flags = ClimateEntityFeature.TARGET_TEMPERATURE | \
ClimateEntityFeature.PRESET_MODE
self._support_flags |= ClimateEntityFeature.PRESET_MODE
self._difference = kwargs.get('difference')
if self._ac_mode:
self._attr_hvac_modes = [HVACMode.COOL, HVACMode.HEAT, HVACMode.OFF]
Expand Down Expand Up @@ -975,7 +977,7 @@ def _is_device_active(self):
return float(self.hass.states.get(self.heater_or_cooler_entity).state) > 0
except:
return False

@property
def supported_features(self):
"""Return the list of supported features."""
Expand Down

0 comments on commit 7b2c541

Please sign in to comment.