]> git.basschouten.com Git - openhab-addons.git/commitdiff
[radiothermostat] Ignore updates if thermostat data is invalid (#13394)
authormlobstein <michael.lobstein@gmail.com>
Sat, 17 Sep 2022 15:49:59 +0000 (10:49 -0500)
committerGitHub <noreply@github.com>
Sat, 17 Sep 2022 15:49:59 +0000 (17:49 +0200)
* Ignore updates if data is invalid

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java

index 99b3e201b9c014b71566c693234af88eb3be9750..5a13607284beca6d606e8c8a5a21451b313f88d2 100644 (file)
@@ -371,14 +371,18 @@ public class RadioThermostatHandler extends BaseThingHandler implements RadioThe
             switch (evtKey) {
                 case DEFAULT_RESOURCE:
                     rthermData.setThermostatData(gson.fromJson(evtVal, RadioThermostatTstatDTO.class));
-                    updateAllChannels();
+                    // if thermostat returned -1 for temperature, skip this update
+                    if (rthermData.getThermostatData().getTemperature() >= 0) {
+                        updateAllChannels();
+                    }
                     break;
                 case HUMIDITY_RESOURCE:
                     RadioThermostatHumidityDTO dto = gson.fromJson(evtVal, RadioThermostatHumidityDTO.class);
-                    if (dto != null) {
+                    // if thermostat returned -1 for humidity, skip this update
+                    if (dto != null && dto.getHumidity() >= 0) {
                         rthermData.setHumidity(dto.getHumidity());
+                        updateChannel(HUMIDITY, rthermData);
                     }
-                    updateChannel(HUMIDITY, rthermData);
                     break;
                 case RUNTIME_RESOURCE:
                     rthermData.setRuntime(gson.fromJson(evtVal, RadioThermostatRuntimeDTO.class));