Skip to content

Commit

Permalink
Fix climate warnings in HA 2024-2-1 #136
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou authored Feb 15, 2024
1 parent 5143f81 commit 34b8634
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/localtuya/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def flow_schema(dps):
class LocaltuyaClimate(LocalTuyaEntity, ClimateEntity):
"""Tuya climate device."""

_enable_turn_on_off_backwards_compatibility = False

def __init__(
self,
device,
Expand Down Expand Up @@ -183,6 +185,13 @@ def supported_features(self):
supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE
if self.has_config(CONF_PRESET_DP) or self.has_config(CONF_ECO_DP):
supported_features |= ClimateEntityFeature.PRESET_MODE

try: # requires HA >= 2024.2.1
supported_features |= ClimateEntityFeature.TURN_OFF
supported_features |= ClimateEntityFeature.TURN_ON
except AttributeError:
...

return supported_features

@property
Expand Down

0 comments on commit 34b8634

Please sign in to comment.