From: lolodomo Date: Mon, 16 May 2022 08:27:19 +0000 (+0200) Subject: [goecharger] Fix compatibility with go-eCharger V3 (#12733) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=cff0629fdddbbdb5f2f22b3b2e39b616fa22cc13;p=openhab-addons.git [goecharger] Fix compatibility with go-eCharger V3 (#12733) Also avoid the thing to remain in state UNKNOWN if the decoding of the JSON response is failing. Fix #12719 Signed-off-by: Laurent Garnier --- diff --git a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/api/GoEStatusResponseV2DTO.java b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/api/GoEStatusResponseV2DTO.java index 37f903cc63..c65c63b22b 100644 --- a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/api/GoEStatusResponseV2DTO.java +++ b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/api/GoEStatusResponseV2DTO.java @@ -34,7 +34,7 @@ public class GoEStatusResponseV2DTO extends GoEStatusResponseBaseDTO { public Double[] temperatures; @SerializedName("wh") - public Long sessionChargeConsumption; + public Double sessionChargeConsumption; @SerializedName("dwo") public Double sessionChargeConsumptionLimit; diff --git a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerBaseHandler.java b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerBaseHandler.java index 9711b7767c..d0ac23d3c9 100644 --- a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerBaseHandler.java +++ b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerBaseHandler.java @@ -142,7 +142,7 @@ public abstract class GoEChargerBaseHandler extends BaseThingHandler { } catch (InterruptedException ie) { Thread.currentThread().interrupt(); updateChannelsAndStatus(null, ie.getMessage()); - } catch (TimeoutException | ExecutionException e) { + } catch (TimeoutException | ExecutionException | JsonSyntaxException e) { updateChannelsAndStatus(null, e.getMessage()); } }