Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ClimateEntityFeature.TURN_OFF feature & implementation #176

Merged
merged 6 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ 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_off`

Specific support and behavior can vary, depending on the capabilities of your indoor unit.

Expand Down
12 changes: 9 additions & 3 deletions custom_components/kumo/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ 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
)
if self._pykumo.has_dry_mode():
self._hvac_modes.append(HVACMode.DRY)
Expand Down Expand Up @@ -495,7 +497,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]
Expand All @@ -508,7 +510,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):
Expand All @@ -528,3 +530,7 @@ 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_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")
Loading