diff --git a/bundles/org.openhab.binding.tibber/README.md b/bundles/org.openhab.binding.tibber/README.md index 3b8bd9abc..836abfa05 100644 --- a/bundles/org.openhab.binding.tibber/README.md +++ b/bundles/org.openhab.binding.tibber/README.md @@ -44,6 +44,7 @@ Tibber Pulse (optional): | Last Meter Consumption | Last Recorded Meter Consumption | True | | Accumulated Consumption | Accumulated Consumption since Midnight | True | | Accumulated Cost | Accumulated Cost since Midnight | True | +| Accumulated Reward | Accumulated Reward since Midnight | True | | Currency | Currency of Cost | True | | Min Power | Min Power Consumption since Midnight | True | | Average Power | Average Power Consumption since Midnight | True | @@ -231,6 +232,7 @@ Number:Power TibberAPILivePower "Live Power Con Number:Energy TibberAPILiveLastMeterConsumption "Last Meter Consumption [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:live_lastMeterConsumption"} Number:Energy TibberAPILiveAccumulatedConsumption "Accumulated Consumption [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:live_accumulatedConsumption"} Number:Dimensionless TibberAPILiveAccumulatedCost "Accumulated Cost [%.2f NOK]" {channel="tibber:tibberapi:7cfae492:live_accumulatedCost"} +Number:Dimensionless TibberAPILiveAccumulatedReward "Accumulated Reward [%.2f NOK]" {channel="tibber:tibberapi:7cfae492:live_accumulatedReward"} String TibberAPILiveCurrency "Currency" {channel="tibber:tibberapi:7cfae492:live_currency"} Number:Power TibberAPILiveMinPower "Min Power Consumption [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_minPower"} Number:Power TibberAPILiveAveragePower "Average Power Consumption [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_averagePower"} diff --git a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberBindingConstants.java b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberBindingConstants.java index d1dd24e4c..810731853 100644 --- a/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberBindingConstants.java +++ b/bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberBindingConstants.java @@ -60,6 +60,7 @@ public class TibberBindingConstants { public static final String LIVE_LASTMETERCONSUMPTION = "live_lastMeterConsumption"; public static final String LIVE_ACCUMULATEDCONSUMPTION = "live_accumulatedConsumption"; public static final String LIVE_ACCUMULATEDCOST = "live_accumulatedCost"; + public static final String LIVE_ACCUMULATEREWARD = "live_accumulatedReward"; public static final String LIVE_CURRENCY = "live_currency"; public static final String LIVE_MINPOWER = "live_minPower"; public static final String LIVE_AVERAGEPOWER = "live_averagePower"; 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 64565af2e..241599ee1 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 @@ -428,7 +428,6 @@ public class TibberHandler extends BaseThingHandler { } @WebSocket - @NonNullByDefault public class TibberWebSocketListener { @OnWebSocketConnect @@ -498,6 +497,9 @@ public class TibberHandler extends BaseThingHandler { if (myObject.has("accumulatedCost")) { updateChannel(LIVE_ACCUMULATEDCOST, myObject.get("accumulatedCost").toString()); } + if (myObject.has("accumulatedReward")) { + updateChannel(LIVE_ACCUMULATEREWARD, myObject.get("accumulatedReward").toString()); + } if (myObject.has("currency")) { updateState(LIVE_CURRENCY, new StringType(myObject.get("currency").toString())); } @@ -556,7 +558,7 @@ public class TibberHandler extends BaseThingHandler { public void startSubscription() { String query = "{\"id\":\"1\",\"type\":\"subscribe\",\"payload\":{\"variables\":{},\"extensions\":{},\"operationName\":null,\"query\":\"subscription {\\n liveMeasurement(homeId:\\\"" + tibberConfig.getHomeid() - + "\\\") {\\n timestamp\\n power\\n lastMeterConsumption\\n accumulatedConsumption\\n accumulatedCost\\n currency\\n minPower\\n averagePower\\n maxPower\\n" + + "\\\") {\\n timestamp\\n power\\n lastMeterConsumption\\n accumulatedConsumption\\n accumulatedCost\\n accumulatedReward\\n currency\\n minPower\\n averagePower\\n maxPower\\n" + "voltagePhase1\\n voltagePhase2\\n voltagePhase3\\n currentL1\\n currentL2\\n currentL3\\n powerProduction\\n accumulatedProduction\\n minPowerProduction\\n maxPowerProduction\\n }\\n }\\n\"}}"; try { TibberWebSocketListener socket = TibberHandler.this.socket; diff --git a/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/i18n/tibber.properties b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/i18n/tibber.properties index c79af77bb..a33f72ba8 100644 --- a/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/i18n/tibber.properties +++ b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/i18n/tibber.properties @@ -35,11 +35,13 @@ channel-type.tibber.price.label = Current Total Price channel-type.tibber.price.description = Total Price: Energy + Tax channel-type.tibber.production.label = Total Production channel-type.tibber.production.description = Accumulated Production since Midnight +channel-type.tibber.reward.label = Total Reward +channel-type.tibber.reward.description = Reward at given time interval (e.g. hourly, daily, accumulated since midnight) channel-type.tibber.timestamp.label = Timestamp channel-type.tibber.timestamp.description = Timestamp for measurement/change +channel-type.tibber.today_prices.label = Prices for today as a JSON array +channel-type.tibber.today_prices.description = JSON array of tuples startsAt,total, e.g. {["startsAt": "2022-09-10T00:00:00+02:00", "total": 5.332}, {"startsAt": ...}]. See binding documentation for full example. +channel-type.tibber.tomorrow_prices.label = Prices for tomorrow as a JSON array +channel-type.tibber.tomorrow_prices.description = JSON array of tuples startsAt,total, e.g. {["startsAt": "2022-09-10T00:00:00+02:00", "total": 5.332}, {"startsAt": ...}]. See binding documentation for full example. channel-type.tibber.voltage.label = Voltage channel-type.tibber.voltage.description = Voltage on given Phase -channel-type.tibber.tomorrow_prices.label = Prices for tomorrow as a JSON array -channel-type.tibber.tomorrow_prices.description = JSON array of tuples startsAt,total, e.g. {["startsAt": "2022-09-10T00:00:00+02:00", "total": 5.332}, {"startsAt": ...}]}. See binding documentation for full example. -channel-type.tibber.today_prices.label = Prices for today as a JSON array -channel-type.tibber.today_prices.description = JSON array of tuples startsAt,total, e.g. {["startsAt": "2022-09-10T00:00:00+02:00", "total": 5.332}, {"startsAt": ...}]}. See binding documentation for full example. diff --git a/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/thing-types.xml index 9118147f3..b08e544e4 100644 --- a/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/thing-types.xml @@ -26,6 +26,7 @@ + @@ -82,6 +83,12 @@ Cost at given time interval (e.g. hourly, daily, accumulated since midnight) + + Number:Dimensionless + + Reward at given time interval (e.g. hourly, daily, accumulated since midnight) + + Number:Energy