From 8a9c66a5670ab071e68440b7bda336f77e09cd95 Mon Sep 17 00:00:00 2001 From: mlobstein Date: Sat, 17 Sep 2022 10:49:59 -0500 Subject: [PATCH] [radiothermostat] Ignore updates if thermostat data is invalid (#13394) * Ignore updates if data is invalid Signed-off-by: Michael Lobstein --- .../internal/handler/RadioThermostatHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java b/bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java index 99b3e201b..5a1360728 100644 --- a/bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java +++ b/bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java @@ -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));