Repository: openhab/openhab-addons (2025-08-06T11:05:53Z)

Issue:
[avmfritz] FRITZ!DECT 302: BoostMode not detected in radiator_mode channel in some case
It seems that the channel radiator_mode only changes to boost when the radiator was turned on before.



## Expected Behavior
1) Radiator turned off (6°C)
2) Press boost button on device
3) Expect that radiator_mode channel changes to BOOST


## Current Behavior
1) Radiator turned off (6°C)
2) Press boost button on device
3) radiator_mode channel remains OFF

## Possible Solution / Workaround for the moment
1) Radiator turned off (6°C)
2) Press + button on device to set to 8°C.
3) Press boost button on device
3) radiator_mode channel changes to BOOST



## Your Environment
* Version used: openHAB 4.2.0



Discussion:
This issue has been mentioned on **openHAB Community**. There might be relevant details there:

https://community.openhab.org/t/fritz-binding-dect302-smartthermo302/165280/6




Patch:
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/dto/HeatingModel.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/dto/HeatingModel.java
index 2f5f37478166f..33be7d8fc1062 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/dto/HeatingModel.java
+++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/dto/HeatingModel.java
@@ -92,8 +92,15 @@ public void setAbsenk(BigDecimal absenk) {
         this.absenk = absenk;
     }
 
+    /**
+     * Helper to check if the value is equal to 1 regardless of the BigDecimal scale.
+     */
+    private static boolean isOne(@Nullable BigDecimal value) {
+        return (value != null) && (BigDecimal.ONE.compareTo(value) == 0);
+    }
+
     public String getMode() {
-        if (BigDecimal.ONE.equals(getHolidayactive())) {
+        if (isOne(getHolidayactive())) {
             return MODE_VACATION;
         } else if (getNextchange() != null && getNextchange().getEndperiod() != 0) {
             return MODE_AUTO;
@@ -103,20 +110,20 @@ public String getMode() {
     }
 
     public String getRadiatorMode() {
-        if (tsoll == null) {
+        if (isOne(getWindowopenactiv())) {
+            return MODE_WINDOW_OPEN;
+        } else if (isOne(getBoostactive()) || (tsoll != null && TEMP_FRITZ_MAX.compareTo(tsoll) == 0)) {
+            return MODE_BOOST;
+        } else if (tsoll == null) {
             return MODE_UNKNOWN;
         } else if (TEMP_FRITZ_ON.compareTo(tsoll) == 0) {
             return MODE_ON;
         } else if (TEMP_FRITZ_OFF.compareTo(tsoll) == 0) {
             return MODE_OFF;
-        } else if (BigDecimal.ONE.equals(getWindowopenactiv())) {
-            return MODE_WINDOW_OPEN;
         } else if (komfort != null && komfort.compareTo(tsoll) == 0) {
             return MODE_COMFORT;
         } else if (absenk != null && absenk.compareTo(tsoll) == 0) {
             return MODE_ECO;
-        } else if (BigDecimal.ONE.equals(getBoostactive()) || TEMP_FRITZ_MAX.compareTo(tsoll) == 0) {
-            return MODE_BOOST;
         } else {
             return MODE_ON;
         }
@@ -171,6 +178,10 @@ public void setWindowopenactiv(BigDecimal windowopenactiv) {
         return boostactive;
     }
 
+    public void setBoostactive(BigDecimal boostActive) {
+        this.boostactive = boostActive;
+    }
+
     public @Nullable BigDecimal getBoostactiveendtime() {
         return boostactiveendtime;
     }


Test patch:
diff --git a/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/dto/HeatingModelTest.java b/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/dto/HeatingModelTest.java
index 3fe38a06feb75..6e7ce713b2ae1 100644
--- a/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/dto/HeatingModelTest.java
+++ b/bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/dto/HeatingModelTest.java
@@ -70,7 +70,15 @@ public void validateGetRadiatorModeReturnsValidMode() {
         heatingModel.setTsoll(BigDecimal.ONE);
         assertEquals(MODE_ON, heatingModel.getRadiatorMode());
 
+        heatingModel.setWindowopenactiv(new BigDecimal(1.0));
+        assertEquals(MODE_WINDOW_OPEN, heatingModel.getRadiatorMode());
+        heatingModel.setWindowopenactiv(new BigDecimal(0.0));
+
         heatingModel.setKomfort(BigDecimal.ONE);
         assertEquals(MODE_COMFORT, heatingModel.getRadiatorMode());
+        heatingModel.setKomfort(null);
+
+        heatingModel.setBoostactive(new BigDecimal(1.0));
+        assertEquals(MODE_BOOST, heatingModel.getRadiatorMode());
     }
 }