From cf7ca92f43273f80d664c2b677bda54452be54ee Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 28 Nov 2026 17:39:34 +0000 Subject: [PATCH] Report the pre-defrost state 202 as heating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit State 202 is the countdown before a defrost on the Flint. The compressor keeps running at full speed, heat still goes into the water, and the defrost is sometimes called off without happening. Only 204 is the actual defrost, where the cycle reverses and heat is taken out of the water. Weheat counts 202 as heating in its own minute and hour data, so report it as heating here too. This also gives a positive COP in 202. Source: live readings of 90 Flints over an hour at outside temperatures between -2 and +2 °C, where 202 lasted about 5.7 minutes and 204 about 2.5 minutes, and 202 ended without a defrost 9 out of 77 times: https://gathering.tweakers.net/forum/list_message/86688488#86688488 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PzfstQPeFyPUQi9DTM5fBq --- tests/test_heat_pump.py | 4 ++++ weheat/abstractions/heat_pump.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_heat_pump.py b/tests/test_heat_pump.py index 1259e9a..ebe4c3a 100644 --- a/tests/test_heat_pump.py +++ b/tests/test_heat_pump.py @@ -36,6 +36,9 @@ def heat_pump(**fields) -> HeatPump: (138, None), (150, HeatPump.State.DHW), (200, HeatPump.State.DEFROSTING), + # counting down to a defrost while still heating at full speed + (202, HeatPump.State.HEATING), + (204, HeatPump.State.DEFROSTING), (239, HeatPump.State.DEFROSTING), (240, None), (1010, HeatPump.State.UPDATING), @@ -108,6 +111,7 @@ def test_cooling_start_conditions_without_a_log(): [ # heat into the water is what heating is for, so the ratio is positive (70, 500, 2000, 4.0), + (202, 500, 2000, 4.0), (150, 500, 2000, 4.0), # heat out of the water is what cooling is for, so that is positive too (132, 521, -2671, pytest.approx(5.126, abs=0.001)), diff --git a/weheat/abstractions/heat_pump.py b/weheat/abstractions/heat_pump.py index f3be9cd..15d8b89 100644 --- a/weheat/abstractions/heat_pump.py +++ b/weheat/abstractions/heat_pump.py @@ -110,8 +110,14 @@ class CoolingStopReason(Enum): CONTACT_SWITCH_OVER = 6 THERMOSTAT_DISABLED = 7 + # The state a heat pump reports in the minutes before a defrost starts. The + # compressor keeps running at full speed and heat still goes into the water, + # and the defrost is sometimes called off without happening. Weheat counts + # it as heating in its own minute and hour data, so it is reported as that. + PRE_DEFROST_STATE = 202 + # The numeric states the heat pump reports while cooling, and while defrosting. - DEFROST_STATES = frozenset({84, 90, 100, 110, 120, *range(200, 240)}) + DEFROST_STATES = frozenset({84, 90, 100, 110, 120, *range(200, 240)}) - {PRE_DEFROST_STATE} COOLING_STATES = frozenset(state.value for state in CoolingState) # Bit masks of the conditions that must all be met before cooling can start. @@ -410,7 +416,7 @@ def heat_pump_state(self) -> Union[State, None]: return self.State.OFFLINE if numeric_state == 40: return self.State.STANDBY - elif numeric_state == 70: + elif numeric_state in (70, self.PRE_DEFROST_STATE): return self.State.HEATING elif numeric_state == self.CoolingState.WATER_CHECK.value: return self.State.WATER_CHECK