Skip to content

Commit 0e9ef03

Browse files
committed
Implement turn_on and turn_off ClimateEntityFeature
1 parent 22a33dd commit 0e9ef03

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

custom_components/smartthinq_sensors/climate.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
# general ac attributes
4646
ATTR_FRIDGE = "fridge"
4747
ATTR_FREEZER = "freezer"
48+
ATTR_SWING_HORIZONTAL = "swing_mode_horizontal"
49+
ATTR_SWING_VERTICAL = "swing_mode_vertical"
50+
HVAC_MODE_NONE = "--"
51+
SWING_PREFIX = ["Vertical", "Horizontal"]
4852

4953
# service definitions
5054
SERVICE_SET_SLEEP_TIME = "set_sleep_time"
@@ -72,10 +76,11 @@
7276
ACMode.ENERGY_SAVER.name: {"preset": PRESET_ECO, "hvac": HVACMode.COOL},
7377
}
7478

75-
HVAC_MODE_NONE = "--"
76-
ATTR_SWING_HORIZONTAL = "swing_mode_horizontal"
77-
ATTR_SWING_VERTICAL = "swing_mode_vertical"
78-
SWING_PREFIX = ["Vertical", "Horizontal"]
79+
DEFAULT_AC_FEATURES = (
80+
ClimateEntityFeature.TARGET_TEMPERATURE
81+
| ClimateEntityFeature.TURN_OFF
82+
| ClimateEntityFeature.TURN_ON
83+
)
7984

8085
_LOGGER = logging.getLogger(__name__)
8186

@@ -174,6 +179,8 @@ def _async_discover_device(lge_devices: dict) -> None:
174179
class LGEClimate(CoordinatorEntity, ClimateEntity):
175180
"""Base climate device."""
176181

182+
_enable_turn_on_off_backwards_compatibility = False
183+
177184
def __init__(self, api: LGEDevice):
178185
"""Initialize the climate."""
179186
super().__init__(api.coordinator)
@@ -259,7 +266,7 @@ def _get_swing_mode(self, hor_mode=False) -> str | None:
259266
@property
260267
def supported_features(self) -> ClimateEntityFeature:
261268
"""Return the list of supported features."""
262-
features = ClimateEntityFeature.TARGET_TEMPERATURE
269+
features = DEFAULT_AC_FEATURES
263270
if len(self.fan_modes) > 0:
264271
features |= ClimateEntityFeature.FAN_MODE
265272
if self.preset_modes:

0 commit comments

Comments
 (0)