From bbd4e5a6ae18236e763f9a538bafb3162509886d Mon Sep 17 00:00:00 2001 From: Max R Date: Thu, 12 Dec 2024 21:20:41 -0500 Subject: [PATCH 1/6] Add features --- README.md | 2 ++ custom_components/kumo/climate.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5470006..89a32ca 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,8 @@ Use the standard `climate` service calls to control or automate each unit. Avail - `climate.set_fan_mode` - `climate.set_hvac_mode` - `climate.set_swing_mode` +- `climate.turn_on` +- `climate.turn_off` Specific support and behavior can vary, depending on the capabilities of your indoor unit. diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index 36f6bed..3c5f1d2 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -155,7 +155,10 @@ def __init__(self, coordinator: KumoDataUpdateCoordinator): self._swing_modes = self._pykumo.get_vane_directions() self._hvac_modes = [HVACMode.OFF, HVACMode.COOL] self._supported_features = ( - ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE + ClimateEntityFeature.TARGET_TEMPERATURE | + ClimateEntityFeature.FAN_MODE | + ClimateEntityFeature.TURN_OFF | + ClimateEntityFeature.TURN_ON ) if self._pykumo.has_dry_mode(): self._hvac_modes.append(HVACMode.DRY) From 9e97e2857f422ec351a215066ed2f3e6b4a3d99d Mon Sep 17 00:00:00 2001 From: Max R Date: Fri, 13 Dec 2024 10:03:24 -0500 Subject: [PATCH 2/6] implement --- custom_components/kumo/climate.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index 3c5f1d2..4025515 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -498,7 +498,7 @@ def set_temperature(self, **kwargs): "Kumo %s set %s temp response: %s", self._name, "cool", str(response) ) - def set_hvac_mode(self, hvac_mode): + def set_hvac_mode(self, hvac_mode, caller="set_hvac_mode"): """Set new target operation mode.""" try: mode = HA_STATE_TO_KUMO[hvac_mode] @@ -511,7 +511,7 @@ def set_hvac_mode(self, hvac_mode): response = self._pykumo.set_mode(mode) _LOGGER.debug( - "Kumo %s set mode %s response: %s", self._name, hvac_mode, response + "Kumo %s set mode %s (via `%s`) response: %s", self._name, hvac_mode, caller, response ) def set_swing_mode(self, swing_mode): @@ -531,3 +531,14 @@ def set_fan_mode(self, fan_mode): response = self._pykumo.set_fan_speed(fan_mode) _LOGGER.debug("Kumo %s set fan speed response: %s", self._name, response) + + def turn_on(self) -> None: + """Turn the climate on. This implements https://www.home-assistant.io/integrations/climate/#action-climateturn_on. + + For now, turn it on to HVACMode.COOL which always exists in self._hvac_modes. + In the future, make the default "on" mode configurable.""" + self.set_hvac_mode(HVACMode.COOL, caller="turn_on") + + def turn_off(self, hvac_mode): + """Turn the climate off. This implements https://www.home-assistant.io/integrations/climate/#action-climateturn_off.""" + self.set_hvac_mode(HVACMode.OFF, caller="turn_off") From 7b11e9a7efb5c67ee8d566d4c6925302179f17d7 Mon Sep 17 00:00:00 2001 From: Max R Date: Fri, 13 Dec 2024 10:06:33 -0500 Subject: [PATCH 3/6] update --- custom_components/kumo/climate.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index 4025515..c73d848 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -128,8 +128,6 @@ class KumoThermostat(CoordinatedKumoEntity, ClimateEntity): "runstate", ] - _enable_turn_on_off_backwards_compatibility = False # can be removed once 2024.12 is no longer supported - def __init__(self, coordinator: KumoDataUpdateCoordinator): """Initialize the thermostat.""" From 0a4f2e935916d480c6a02ff975a25c541a346556 Mon Sep 17 00:00:00 2001 From: Max R Date: Fri, 13 Dec 2024 10:30:39 -0500 Subject: [PATCH 4/6] fix --- custom_components/kumo/climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index c73d848..9864441 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -537,6 +537,6 @@ def turn_on(self) -> None: In the future, make the default "on" mode configurable.""" self.set_hvac_mode(HVACMode.COOL, caller="turn_on") - def turn_off(self, hvac_mode): + def turn_off(self): """Turn the climate off. This implements https://www.home-assistant.io/integrations/climate/#action-climateturn_off.""" self.set_hvac_mode(HVACMode.OFF, caller="turn_off") From d89b013831c3703916a66eac06582de861951aa1 Mon Sep 17 00:00:00 2001 From: Max R Date: Sat, 14 Dec 2024 09:43:11 -0500 Subject: [PATCH 5/6] rm turn on --- README.md | 1 - custom_components/kumo/climate.py | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index 89a32ca..7c721c5 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ Use the standard `climate` service calls to control or automate each unit. Avail - `climate.set_fan_mode` - `climate.set_hvac_mode` - `climate.set_swing_mode` -- `climate.turn_on` - `climate.turn_off` Specific support and behavior can vary, depending on the capabilities of your indoor unit. diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index 9864441..1425d4c 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -155,8 +155,7 @@ def __init__(self, coordinator: KumoDataUpdateCoordinator): self._supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | - ClimateEntityFeature.TURN_OFF | - ClimateEntityFeature.TURN_ON + ClimateEntityFeature.TURN_OFF ) if self._pykumo.has_dry_mode(): self._hvac_modes.append(HVACMode.DRY) @@ -530,13 +529,6 @@ def set_fan_mode(self, fan_mode): response = self._pykumo.set_fan_speed(fan_mode) _LOGGER.debug("Kumo %s set fan speed response: %s", self._name, response) - def turn_on(self) -> None: - """Turn the climate on. This implements https://www.home-assistant.io/integrations/climate/#action-climateturn_on. - - For now, turn it on to HVACMode.COOL which always exists in self._hvac_modes. - In the future, make the default "on" mode configurable.""" - self.set_hvac_mode(HVACMode.COOL, caller="turn_on") - def turn_off(self): """Turn the climate off. This implements https://www.home-assistant.io/integrations/climate/#action-climateturn_off.""" self.set_hvac_mode(HVACMode.OFF, caller="turn_off") From 7e96632cfe9f4a1066e4e0188583837be6094c8f Mon Sep 17 00:00:00 2001 From: Max R Date: Sat, 14 Dec 2024 10:17:36 -0500 Subject: [PATCH 6/6] Update climate.py --- custom_components/kumo/climate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index 1425d4c..670ac84 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -128,6 +128,8 @@ class KumoThermostat(CoordinatedKumoEntity, ClimateEntity): "runstate", ] + _enable_turn_on_off_backwards_compatibility = False # can be removed once 2024.12 is no longer supported + def __init__(self, coordinator: KumoDataUpdateCoordinator): """Initialize the thermostat."""