From 3b3d18cef40787281aea2811cdb38ccf3d691e31 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sun, 4 Dec 2022 12:18:20 +0100 Subject: [PATCH] [tibber] Fix SAT warnings (#13835) Signed-off-by: Leo Siepel --- bundles/org.openhab.binding.tibber/README.md | 2 +- .../binding/tibber/internal/handler/TibberHandler.java | 2 -- .../internal/handler/TibberPriceConsumptionHandler.java | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.binding.tibber/README.md b/bundles/org.openhab.binding.tibber/README.md index 3407a3ef9..4935e1526 100644 --- a/bundles/org.openhab.binding.tibber/README.md +++ b/bundles/org.openhab.binding.tibber/README.md @@ -212,7 +212,7 @@ Thing tibber:tibberapi:7cfae492 [ homeid="xxx", token="xxxxxxx" ] ``` ### demo.items: -. + ``` Number:Dimensionless TibberAPICurrentTotal "Current Total Price [%.2f NOK]" {channel="tibber:tibberapi:7cfae492:current_total"} DateTime TibberAPICurrentStartsAt "Timestamp - Current Price" {channel="tibber:tibberapi:7cfae492:current_startsAt"} diff --git a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberHandler.java b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberHandler.java index 27ca48e64..307993fee 100644 --- a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberHandler.java +++ b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberHandler.java @@ -206,7 +206,6 @@ public class TibberHandler extends BaseThingHandler { updateChannel(DAILY_COST, myObject.get("cost").toString()); updateChannel(DAILY_CONSUMPTION, myObject.get("consumption").toString()); - } catch (JsonSyntaxException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error communicating with Tibber API: " + e.getMessage()); @@ -226,7 +225,6 @@ public class TibberHandler extends BaseThingHandler { updateChannel(HOURLY_COST, myObject.get("cost").toString()); updateChannel(HOURLY_CONSUMPTION, myObject.get("consumption").toString()); - } catch (JsonSyntaxException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error communicating with Tibber API: " + e.getMessage()); diff --git a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberPriceConsumptionHandler.java b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberPriceConsumptionHandler.java index a32db9f55..7b603858f 100644 --- a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberPriceConsumptionHandler.java +++ b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberPriceConsumptionHandler.java @@ -32,9 +32,9 @@ public class TibberPriceConsumptionHandler { } public InputStream getInputStream(String homeId) { - String Query = "{\"query\": \"{viewer {home (id: \\\"" + homeId + String query = "{\"query\": \"{viewer {home (id: \\\"" + homeId + "\\\") {currentSubscription {priceInfo {current {total startsAt level } tomorrow { startsAt total }}} daily: consumption(resolution: DAILY, last: 1) {nodes {from to cost unitPrice consumption consumptionUnit}} hourly: consumption(resolution: HOURLY, last: 1) {nodes {from to cost unitPrice consumption consumptionUnit}}}}}\"}"; - return new ByteArrayInputStream(Query.getBytes(StandardCharsets.UTF_8)); + return new ByteArrayInputStream(query.getBytes(StandardCharsets.UTF_8)); } public InputStream getRealtimeInputStream(String homeId) {