From cff0629fdddbbdb5f2f22b3b2e39b616fa22cc13 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Mon, 16 May 2022 10:27:19 +0200 Subject: [PATCH] [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 --- .../binding/goecharger/internal/api/GoEStatusResponseV2DTO.java | 2 +- .../goecharger/internal/handler/GoEChargerBaseHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 37f903cc6..c65c63b22 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 9711b7767..d0ac23d3c 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()); } }