]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openwebnet] Thermo: fixes update setPoint when local offset in in use (#16626)
authorM Valla <12682715+mvalla@users.noreply.github.com>
Sun, 14 Apr 2024 22:55:13 +0000 (00:55 +0200)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2024 22:55:13 +0000 (00:55 +0200)
Signed-off-by: Massimo Valla <mvcode00@gmail.com>
bundles/org.openhab.binding.openwebnet/README.md
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java

index bc608a6c23a0025aa536506fe0d78ae48a393273..7bbdb6f82db07ee1fde7d466b2973d4b48cbfeb5 100644 (file)
@@ -163,7 +163,7 @@ The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing wi
 
 ##### Thermo Central Unit integration known limitations
 
-- Read setPoint temperature and current mode
+- Read CU setPoint temperature when in WEEKLY / SCENARIO / PROTECTION / VACATION / HOLIDAY
 - Set VACATION deadline date / time
 - Central Unit Programming and Customisations settings (T1/2/3 temperature levels, setting date & time, weekly/scenarios/holiday profiles programming, etc.)
 
@@ -242,8 +242,8 @@ OPEN command to execute: *5*8#134##
 
 | Channel Type ID (channel ID) | Applies to Thing Type IDs              | Item Type          | Description                                                                                                                           | Read/Write | Advanced |
 | ---------------------------- | -------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | :--------: | :------: |
-| `temperature`                | `bus_thermo_zone`, `bus_thermo_sensor` | Number:Temperature | The zone currently sensed temperature                                                                                                 | R          | N        |
-| `setpointTemperature`        | `bus_thermo_zone`, `bus_thermo_cu`     | Number:Temperature | The zone or Central Unit setpoint temperature                                                                                         | R/W        | N        |
+| `temperature`                | `bus_thermo_zone`, `bus_thermo_sensor` | Number:Temperature | Currently sensed temperature for zone or sensor                                                                                                 | R          | N        |
+| `setpointTemperature`        | `bus_thermo_zone`, `bus_thermo_cu`     | Number:Temperature | The zone or Central Unit manual setpoint temperature                                                                                         | R/W        | N        |
 | `function`                   | `bus_thermo_zone`, `bus_thermo_cu`     | String             | The zone set thermo function (`COOLING`, `HEATING`, `GENERIC`) or the Central Unit thermo function (`COOLING`, `HEATING`)             | R/W        | N        |
 | `mode`                       | `bus_thermo_zone`, `bus_thermo_cu`     | String             | The zone set mode (`AUTO`, `MANUAL`, `OFF`, `PROTECTION`) or the Central Unit set mode (`WEEKLY`, `MANUAL`, `SCENARIO`, `HOLIDAY`, `VACATION`, `OFF`, `PROTECTION`) | R/W        | N        |
 | `speedFanCoil`               | `bus_thermo_zone`                      | String             | The zone fancoil speed: `AUTO`, `SPEED_1`, `SPEED_2`, `SPEED_3`                                                                       | R/W        | N        |
@@ -255,11 +255,11 @@ OPEN command to execute: *5*8#134##
 | `batteryStatus`              | `bus_thermo_cu`                        | String             | The Central Unit Battery status: `OK`, `KO`                                                                                           | R          | Y        |
 | `weeklyProgram`              | `bus_thermo_cu`                        | Number             | The weekly program number (`1`, `2`, `3`) when Central Unit mode is `WEEKLY`                                                                 | R/W        | N        |
 | `scenarioProgram`            | `bus_thermo_cu`                        | Number             | The scenario program number (`1`, `2`, ... ,  `16`) when Central Unit mode is `SCENARIO`                                                       | R/W        | N        |
-| `vacationDays`               | `bus_thermo_cu`                        | Number             | Number of days 1-255 the Central Unit will be set to Antifreeze / Heat Protection temperature before returning to mode WEEKLY (read/write)  | R/W        | N        |
-| `failureDiscovered`          | `bus_thermo_cu`                        | Switch             | Indicates if a Failure was discovered by the Central Unit: `ON`, `OFF`                                                                | R          | Y        |
-| `atLeastOneProbeOff`         | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in OFF mode: `ON`, `OFF`                                                                           | R          | Y        |
-| `atLeastOneProbeProtection`  | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in PROTECTION mode: `ON`, `OFF`                                                                    | R          | Y        |
-| `atLeastOneProbeManual`      | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in MANUAL mode: `ON`, `OFF`                                                                        | R          | Y        |
+| `vacationDays`               | `bus_thermo_cu`                        | Number             | Number of days 1-255 the Central Unit will be set to Anti-freeze / Heat Protection temperature before returning to mode WEEKLY  | R/W        | N        |
+| `failureDiscovered`          | `bus_thermo_cu`                        | Switch             | Indicates if a Failure was discovered by the Central Unit (`ON`), or not (`OFF`)                                                                | R          | Y        |
+| `atLeastOneProbeOff`         | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in OFF mode (`ON`) or not (`OFF`) | R          | Y        |
+| `atLeastOneProbeProtection`  | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in PROTECTION mode (`ON`) or not (`OFF`)                                                                    | R          | Y        |
+| `atLeastOneProbeManual`      | `bus_thermo_cu`                        | Switch             | Indicates if at least one probe is in MANUAL mode (`ON`) or not (`OFF`)                                                                        | R          | Y        |
 
 ### Notes on channels
 
index 9eb2af59d76c3a9d6e0db927b12b63224f816fc3..e1420d86bfbb35fafb1f6191828b6b1404e42d15 100644 (file)
@@ -34,6 +34,7 @@ import org.openhab.core.thing.ThingTypeUID;
 import org.openhab.core.types.Command;
 import org.openhab.core.types.UnDefType;
 import org.openwebnet4j.communication.OWNException;
+import org.openwebnet4j.communication.Response;
 import org.openwebnet4j.message.BaseOpenMessage;
 import org.openwebnet4j.message.FrameException;
 import org.openwebnet4j.message.MalformedFrameException;
@@ -295,10 +296,24 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {
             } else {
                 newTemp = ((DecimalType) command).doubleValue();
             }
-            try {
-                send(Thermoregulation.requestWriteSetpointTemperature(getWhere(w.value()), newTemp, currentFunction));
-            } catch (MalformedFrameException | OWNException e) {
-                logger.warn("handleSetpoint() {}", e.getMessage());
+            if (newTemp >= 5.0 && newTemp <= 40.0) {
+                try {
+                    Response res;
+                    res = send(Thermoregulation.requestWriteSetpointTemperature(getWhere(w.value()), newTemp,
+                            currentFunction));
+                    // For zones no setPoint temperature confirmation message is returned from gw,
+                    // so we update channel with current requested temp on successful response.
+                    if (!isCentralUnit && res != null && res.isSuccess()) {
+                        updateState(CHANNEL_TEMP_SETPOINT, getAsQuantityTypeOrNull(newTemp, SIUnits.CELSIUS));
+                        currentSetPointTemp = newTemp;
+                    }
+                } catch (MalformedFrameException | OWNException e) {
+                    logger.warn("handleSetpoint() {}", e.getMessage());
+
+                }
+            } else {
+                logger.info("handleSetpoint() Setpoint temperature must be between 5°C and 40°C for thing {}",
+                        getThing().getUID());
             }
         } else {
             logger.warn("handleSetpoint() Unsupported command {} for thing {}", command, getThing().getUID());
@@ -465,9 +480,10 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {
             DimThermo dim = (DimThermo) tmsg.getDim();
             switch (dim) {
                 case TEMP_SETPOINT:
-                case COMPLETE_PROBE_STATUS:
                     updateSetpoint(tmsg);
                     break;
+                case COMPLETE_PROBE_STATUS:
+                    break;
                 case PROBE_TEMPERATURE:
                 case TEMPERATURE:
                     updateTemperature(tmsg);
@@ -599,7 +615,7 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {
                 }
                 String[] parameters = tmsg.getWhatParams();
                 if (parameters.length > 0 && tw.getType() == WhatThermoType.MANUAL) {
-                    // it should be like *4*110#TTTT*#0##
+                    // manual setpoint frame should be like *4*110#TTTT*#0##
                     newTemp = Thermoregulation.decodeTemperature(parameters[0]);
                     logger.debug("updateSetpoint() parsed temperature from {}: {} ---> {}", tmsg.toStringVerbose(),
                             parameters[0], newTemp);