Skip to content

Commit

Permalink
Fix WaterHeater not available on some AWHP devices (issue #637)
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed Dec 16, 2023
1 parent fc3784f commit 87f4883
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion custom_components/smartthinq_sensors/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
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"]
Expand Down Expand Up @@ -199,6 +200,9 @@ def _available_hvac_modes(self) -> dict[str, HVACMode]:
for key, mode in HVAC_MODE_LOOKUP.items()
if key in self._device.op_modes
}
if not self._hvac_mode_lookup:
self._hvac_mode_lookup = {HVAC_MODE_NONE: HVACMode.AUTO}

return self._hvac_mode_lookup

def _available_preset_modes(self) -> dict[str, str]:
Expand Down Expand Up @@ -295,7 +299,8 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:

if not self._api.state.is_on:
await self._device.power(True)
await self._device.set_op_mode(operation_mode)
if operation_mode != HVAC_MODE_NONE:
await self._device.set_op_mode(operation_mode)
self._api.async_set_updated()

@property
Expand Down
4 changes: 2 additions & 2 deletions custom_components/smartthinq_sensors/wideq/devices/ac.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SUPPORT_JET_COOL = [SUPPORT_RAC_SUBMODE, "@AC_MAIN_WIND_MODE_COOL_JET_W"]
SUPPORT_JET_HEAT = [SUPPORT_RAC_SUBMODE, "@AC_MAIN_WIND_MODE_HEAT_JET_W"]
SUPPORT_AIRCLEAN = [SUPPORT_RAC_MODE, "@AIRCLEAN"]
SUPPORT_HOT_WATER = [SUPPORT_PAC_MODE, "@HOTWATER"]
SUPPORT_HOT_WATER = [SUPPORT_PAC_MODE, ["@HOTWATER", "@HOTWATER_ONLY"]]
SUPPORT_LIGHT_SWITCH = [SUPPORT_LIGHT, "@RAC_88_DISPLAY_CONTROL"]
SUPPORT_LIGHT_INV_SWITCH = [SUPPORT_LIGHT, "@BRIGHTNESS_CONTROL"]
SUPPORT_PM = [
Expand Down Expand Up @@ -530,7 +530,7 @@ def is_water_heater_supported(self):
"""Return if Water Heater is supported."""
if not self.is_air_to_water:
return False
return self._is_mode_supported(SUPPORT_HOT_WATER)
return any(self._is_mode_supported(SUPPORT_HOT_WATER))

@cached_property
def op_modes(self):
Expand Down

0 comments on commit 87f4883

Please sign in to comment.