From: M Valla <12682715+mvalla@users.noreply.github.com> Date: Sun, 14 Apr 2024 22:55:13 +0000 (+0200) Subject: [openwebnet] Thermo: fixes update setPoint when local offset in in use (#16626) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=d498a1622f25f39b7dd7133a8c5f626863f6a0bd;p=openhab-addons.git [openwebnet] Thermo: fixes update setPoint when local offset in in use (#16626) Signed-off-by: Massimo Valla --- diff --git a/bundles/org.openhab.binding.openwebnet/README.md b/bundles/org.openhab.binding.openwebnet/README.md index bc608a6c23..7bbdb6f82d 100644 --- a/bundles/org.openhab.binding.openwebnet/README.md +++ b/bundles/org.openhab.binding.openwebnet/README.md @@ -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 diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java index 9eb2af59d7..e1420d86bf 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java @@ -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);