Skip to content

Commit

Permalink
Implement turn_on and turn_off ClimateEntityFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed Mar 30, 2024
1 parent 22a33dd commit 0e9ef03
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions custom_components/smartthinq_sensors/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
# general ac attributes
ATTR_FRIDGE = "fridge"
ATTR_FREEZER = "freezer"
ATTR_SWING_HORIZONTAL = "swing_mode_horizontal"
ATTR_SWING_VERTICAL = "swing_mode_vertical"
HVAC_MODE_NONE = "--"
SWING_PREFIX = ["Vertical", "Horizontal"]

# service definitions
SERVICE_SET_SLEEP_TIME = "set_sleep_time"
Expand Down Expand Up @@ -72,10 +76,11 @@
ACMode.ENERGY_SAVER.name: {"preset": PRESET_ECO, "hvac": HVACMode.COOL},
}

HVAC_MODE_NONE = "--"
ATTR_SWING_HORIZONTAL = "swing_mode_horizontal"
ATTR_SWING_VERTICAL = "swing_mode_vertical"
SWING_PREFIX = ["Vertical", "Horizontal"]
DEFAULT_AC_FEATURES = (
ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TURN_ON
)

_LOGGER = logging.getLogger(__name__)

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

_enable_turn_on_off_backwards_compatibility = False

def __init__(self, api: LGEDevice):
"""Initialize the climate."""
super().__init__(api.coordinator)
Expand Down Expand Up @@ -259,7 +266,7 @@ def _get_swing_mode(self, hor_mode=False) -> str | None:
@property
def supported_features(self) -> ClimateEntityFeature:
"""Return the list of supported features."""
features = ClimateEntityFeature.TARGET_TEMPERATURE
features = DEFAULT_AC_FEATURES
if len(self.fan_modes) > 0:
features |= ClimateEntityFeature.FAN_MODE
if self.preset_modes:
Expand Down

0 comments on commit 0e9ef03

Please sign in to comment.