diff --git a/bundles/org.openhab.binding.tibber/README.md b/bundles/org.openhab.binding.tibber/README.md index 32131d98d69..8b5a0f82918 100644 --- a/bundles/org.openhab.binding.tibber/README.md +++ b/bundles/org.openhab.binding.tibber/README.md @@ -53,6 +53,7 @@ Tibber Pulse (optional): | Current 1-3 | Current per Phase | True | | Power Production | Live Power Production | True | | Accumulated Production | Accumulated Production since Midnight | True | +| Last Meter Production | Last Recorded Meter Production | True | | Min Power Production | Min Power Production since Midnight | True | | Max Power Production | Max Power Production since Midnight | True | @@ -227,6 +228,8 @@ DateTime TibberAPIHourlyFrom "Timestamp - Ho DateTime TibberAPIHourlyTo "Timestamp - Hourly To" {channel="tibber:tibberapi:7cfae492:hourly_to"} Number:Dimensionless TibberAPIHourlyCost "Total Hourly Cost [%.2f NOK]" {channel="tibber:tibberapi:7cfae492:hourly_cost"} Number:Energy TibberAPIHourlyConsumption "Total Hourly Consumption [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:hourly_consumption"} +String TibberAPITomorrowPrices "Price per hour tomorrow JSON array" {channel="tibber:tibberapi:7cfae492:tomorrow_prices"} +String TibberAPITodayPrices "Price per hour today JSON array" {channel="tibber:tibberapi:7cfae492:today_prices"} DateTime TibberAPILiveTimestamp "Timestamp - Live Measurement" {channel="tibber:tibberapi:7cfae492:live_timestamp"} Number:Power TibberAPILivePower "Live Power Consumption [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_power"} Number:Energy TibberAPILiveLastMeterConsumption "Last Meter Consumption [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:live_lastMeterConsumption"} @@ -244,9 +247,8 @@ Number:ElectricCurrent TibberAPILiveCurrent1 "Live Current P Number:ElectricCurrent TibberAPILiveCurrent2 "Live Current Phase 2 [%.1 A]" {channel="tibber:tibberapi:7cfae492:live_current2"} Number:ElectricCurrent TibberAPILiveCurrent3 "Live Current Phase 3 [%.1 A]" {channel="tibber:tibberapi:7cfae492:live_current3"} Number:Power TibberAPILivePowerProduction "Live Power Production [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_powerProduction"} +Number:Energy TibberAPILiveAccumulatedProduction "Accumulated Production [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:live_accumulatedProduction"} +Number:Energy TibberAPILiveLastMeterProduction "Min Power Production [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_lastMeterProduction"} Number:Power TibberAPILiveMinPowerproduction "Min Power Production [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_minPowerproduction"} Number:Power TibberAPILiveMaxPowerproduction "Max Power Production [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_maxPowerproduction"} -Number:Energy TibberAPILiveAccumulatedProduction "Accumulated Production [%.2f kWh]" {channel="tibber:tibberapi:7cfae492:live_accumulatedProduction"} -String TibberAPITomorrowPrices "Price per hour tomorrow JSON array" {channel="tibber:tibberapi:7cfae492:tomorrow_prices"} -String TibberAPITodayPrices "Price per hour today JSON array" {channel="tibber:tibberapi:7cfae492:today_prices"} ``` 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 810731853a9..54b1207f89b 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 @@ -58,6 +58,7 @@ public class TibberBindingConstants { public static final String LIVE_TIMESTAMP = "live_timestamp"; public static final String LIVE_POWER = "live_power"; public static final String LIVE_LASTMETERCONSUMPTION = "live_lastMeterConsumption"; + public static final String LIVE_LASTMETERPRODUCTION = "live_lastMeterProduction"; public static final String LIVE_ACCUMULATEDCONSUMPTION = "live_accumulatedConsumption"; public static final String LIVE_ACCUMULATEDCOST = "live_accumulatedCost"; public static final String LIVE_ACCUMULATEREWARD = "live_accumulatedReward"; 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 59e8e1b8cdb..d53cb58cc25 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 @@ -530,6 +530,9 @@ public class TibberHandler extends BaseThingHandler { if (myObject.has("lastMeterConsumption")) { updateChannel(LIVE_LASTMETERCONSUMPTION, myObject.get("lastMeterConsumption").toString()); } + if (myObject.has("lastMeterProduction")) { + updateChannel(LIVE_LASTMETERPRODUCTION, myObject.get("lastMeterProduction").toString()); + } if (myObject.has("accumulatedConsumption")) { updateChannel(LIVE_ACCUMULATEDCONSUMPTION, myObject.get("accumulatedConsumption").toString()); } @@ -597,7 +600,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 accumulatedReward\\n currency\\n minPower\\n averagePower\\n maxPower\\n" + + "\\\") {\\n timestamp\\n power\\n lastMeterConsumption\\n lastMeterProduction\\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 a33f72ba889..ff5e4b1c8ab 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 @@ -34,7 +34,7 @@ channel-type.tibber.power.description = Power consumption/production for given t 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.production.description = Production at given time interval (e.g. last meter reading, accumulated 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 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 b08e544e47a..ce809c5ea4e 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 @@ -24,6 +24,7 @@ + @@ -44,6 +45,7 @@ Tibber + 1 @@ -121,7 +123,7 @@ Number:Energy - Accumulated Production since Midnight + Production at given time interval (e.g. last meter reading, accumulated since midnight) diff --git a/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 00000000000..e01fe517789 --- /dev/null +++ b/bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,14 @@ + + + + + + + tibber:production + + + + +