Skip to content

Commit

Permalink
Revert "✨ Start support for cool mode in climate entities"
Browse files Browse the repository at this point in the history
This reverts commit e702885.
  • Loading branch information
kamaradclimber committed Jul 18, 2024
1 parent 45587cb commit 96e80e7
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions custom_components/aquarea/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
self._attr_temperature_unit = "°C"
self._enable_turn_on_off_backwards_compatibility = False
self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.COOL, HVACMode.OFF]
self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
self._attr_hvac_mode = HVACMode.OFF

self._zone_state = ZoneState(0) # i.e None
Expand All @@ -143,8 +143,7 @@ async def async_turn_off(self) -> None:
await self.async_set_hvac_mode(HVACMode.OFF)

async def async_turn_on(self) -> None:
# TODO: how could we guess whether we should turn on heat or cool
await self.async_set_hvac_mode(HVACMode.HEAT)
await self.async_set_hvac_mode(HVACMode.HEATING)

def evaluate_temperature_mode(self):
mode = self._mode
Expand Down Expand Up @@ -271,13 +270,6 @@ def mode_received(mod_key: str, message):
1,
)

await mqtt.async_subscribe(
self.hass,
f"{self.discovery_prefix}main/Cooling_Mode",
partial(mode_received, "COOLING"),
1,
)

@callback
def current_temperature_message_received(message):
self._attr_current_temperature = float(message.payload)
Expand Down Expand Up @@ -311,12 +303,9 @@ def target_temperature_message_received(message):

def guess_hvac_mode() -> HVACMode:
global_heating = OperatingMode.HEAT in self._operating_mode
global_cooling = OperatingMode.COOL in self._operating_mode
zone_heating = ZoneState.from_id(self.zone_id) in self._zone_state
if global_heating and zone_heating:
return HVACMode.HEAT
elif global_cooling and zone_heating:
return HVACMode.COOL
else:
return HVACMode.OFF

Expand Down Expand Up @@ -346,14 +335,11 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
if hvac_mode == HVACMode.HEAT:
new_zone_state = self._zone_state | ZoneState.from_id(self.zone_id)
new_operating_mode = self._operating_mode | OperatingMode.HEAT
elif hvac_mode == HVACMode.COOL:
new_zone_state = self._zone_state | ZoneState.from_id(self.zone_id)
new_operating_mode = self._operating_mode | OperatingMode.COOL
elif hvac_mode == HVACMode.OFF:
new_zone_state = self._zone_state & ~ZoneState.from_id(self.zone_id)
new_operating_mode = self._operating_mode
if new_zone_state == ZoneState(0):
new_operating_mode = self._operating_mode & ~OperatingMode.HEAT & ~OperatingMode.COOL
new_operating_mode = self._operating_mode & ~OperatingMode.HEAT
else:
raise NotImplemented(
f"Mode {hvac_mode} has not been implemented by this entity"
Expand Down

0 comments on commit 96e80e7

Please sign in to comment.