Skip to content

Commit

Permalink
Revert "🐛 Distinguish between cool/heat climate mode"
Browse files Browse the repository at this point in the history
This reverts commit 3101b91.
  • Loading branch information
kamaradclimber committed Jul 18, 2024
1 parent 96e80e7 commit a29ca78
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions custom_components/aquarea/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
from dataclasses import dataclass
from enum import Enum, Flag, auto
from functools import partial

from homeassistant.components import mqtt
from homeassistant.components.mqtt.client import async_publish
Expand Down Expand Up @@ -135,7 +134,7 @@ def __init__(
self._operating_mode = OperatingMode(0) # i.e None

self._sensor_mode = ZoneSensorMode.WATER
self._climate_mode = {"HEATING": ZoneClimateMode.DIRECT, "COOLING": ZoneClimateMode.DIRECT}
self._climate_mode = ZoneClimateMode.DIRECT
self._mode = ZoneTemperatureMode.DIRECT
self.change_mode(ZoneTemperatureMode.DIRECT, initialization=True)

Expand All @@ -154,13 +153,9 @@ def evaluate_temperature_mode(self):
elif self._sensor_mode == ZoneSensorMode.EXTERNAL:
mode = ZoneTemperatureMode.NAN
elif self._sensor_mode == ZoneSensorMode.WATER:
if OperatingMode.HEAT in self._operating_mode:
key_mode = "HEATING"
else:
key_mode = "COOLING"
if self._climate_mode[key_mode] == ZoneClimateMode.DIRECT:
if self._climate_mode == ZoneClimateMode.DIRECT:
mode = ZoneTemperatureMode.DIRECT
elif self._climate_mode[key_mode] == ZoneClimateMode.COMPENSATION:
elif self._climate_mode == ZoneClimateMode.COMPENSATION:
mode = ZoneTemperatureMode.COMPENSATION
else:
assert False, f"Unknown combination of Sensor Mode and Climate Mode"
Expand Down Expand Up @@ -252,21 +247,21 @@ def sensor_mode_received(message):
)

@callback
def mode_received(mod_key: str, message):
def mode_received(message):
if message.payload == "0":
climate_mode = ZoneClimateMode.COMPENSATION
elif message.payload == "1":
climate_mode = ZoneClimateMode.DIRECT
else:
assert False, f"Climate Mode received is not a known value"
if climate_mode != self._climate_mode[mod_key]: # if climate mode was changed
self._climate_mode[mod_key] = climate_mode # updated it
if climate_mode != self._climate_mode: # if climate mode was changed
self._climate_mode = climate_mode # updated it
self.evaluate_temperature_mode() # and trigger temp eval

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

Expand Down

0 comments on commit a29ca78

Please sign in to comment.