[tibber] Add accumulatedReward channel (#14277)
* Add channel, fix warning Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
parent
29b17e9c75
commit
865c4b8e86
|
@ -44,6 +44,7 @@ Tibber Pulse (optional):
|
||||||
| Last Meter Consumption | Last Recorded Meter Consumption | True |
|
| Last Meter Consumption | Last Recorded Meter Consumption | True |
|
||||||
| Accumulated Consumption | Accumulated Consumption since Midnight | True |
|
| Accumulated Consumption | Accumulated Consumption since Midnight | True |
|
||||||
| Accumulated Cost | Accumulated Cost since Midnight | True |
|
| Accumulated Cost | Accumulated Cost since Midnight | True |
|
||||||
|
| Accumulated Reward | Accumulated Reward since Midnight | True |
|
||||||
| Currency | Currency of Cost | True |
|
| Currency | Currency of Cost | True |
|
||||||
| Min Power | Min Power Consumption since Midnight | True |
|
| Min Power | Min Power Consumption since Midnight | True |
|
||||||
| Average Power | Average 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 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: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 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"}
|
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 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"}
|
Number:Power TibberAPILiveAveragePower "Average Power Consumption [%.0f W]" {channel="tibber:tibberapi:7cfae492:live_averagePower"}
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class TibberBindingConstants {
|
||||||
public static final String LIVE_LASTMETERCONSUMPTION = "live_lastMeterConsumption";
|
public static final String LIVE_LASTMETERCONSUMPTION = "live_lastMeterConsumption";
|
||||||
public static final String LIVE_ACCUMULATEDCONSUMPTION = "live_accumulatedConsumption";
|
public static final String LIVE_ACCUMULATEDCONSUMPTION = "live_accumulatedConsumption";
|
||||||
public static final String LIVE_ACCUMULATEDCOST = "live_accumulatedCost";
|
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_CURRENCY = "live_currency";
|
||||||
public static final String LIVE_MINPOWER = "live_minPower";
|
public static final String LIVE_MINPOWER = "live_minPower";
|
||||||
public static final String LIVE_AVERAGEPOWER = "live_averagePower";
|
public static final String LIVE_AVERAGEPOWER = "live_averagePower";
|
||||||
|
|
|
@ -428,7 +428,6 @@ public class TibberHandler extends BaseThingHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@WebSocket
|
@WebSocket
|
||||||
@NonNullByDefault
|
|
||||||
public class TibberWebSocketListener {
|
public class TibberWebSocketListener {
|
||||||
|
|
||||||
@OnWebSocketConnect
|
@OnWebSocketConnect
|
||||||
|
@ -498,6 +497,9 @@ public class TibberHandler extends BaseThingHandler {
|
||||||
if (myObject.has("accumulatedCost")) {
|
if (myObject.has("accumulatedCost")) {
|
||||||
updateChannel(LIVE_ACCUMULATEDCOST, myObject.get("accumulatedCost").toString());
|
updateChannel(LIVE_ACCUMULATEDCOST, myObject.get("accumulatedCost").toString());
|
||||||
}
|
}
|
||||||
|
if (myObject.has("accumulatedReward")) {
|
||||||
|
updateChannel(LIVE_ACCUMULATEREWARD, myObject.get("accumulatedReward").toString());
|
||||||
|
}
|
||||||
if (myObject.has("currency")) {
|
if (myObject.has("currency")) {
|
||||||
updateState(LIVE_CURRENCY, new StringType(myObject.get("currency").toString()));
|
updateState(LIVE_CURRENCY, new StringType(myObject.get("currency").toString()));
|
||||||
}
|
}
|
||||||
|
@ -556,7 +558,7 @@ public class TibberHandler extends BaseThingHandler {
|
||||||
public void startSubscription() {
|
public void startSubscription() {
|
||||||
String query = "{\"id\":\"1\",\"type\":\"subscribe\",\"payload\":{\"variables\":{},\"extensions\":{},\"operationName\":null,\"query\":\"subscription {\\n liveMeasurement(homeId:\\\""
|
String query = "{\"id\":\"1\",\"type\":\"subscribe\",\"payload\":{\"variables\":{},\"extensions\":{},\"operationName\":null,\"query\":\"subscription {\\n liveMeasurement(homeId:\\\""
|
||||||
+ tibberConfig.getHomeid()
|
+ 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\"}}";
|
+ "voltagePhase1\\n voltagePhase2\\n voltagePhase3\\n currentL1\\n currentL2\\n currentL3\\n powerProduction\\n accumulatedProduction\\n minPowerProduction\\n maxPowerProduction\\n }\\n }\\n\"}}";
|
||||||
try {
|
try {
|
||||||
TibberWebSocketListener socket = TibberHandler.this.socket;
|
TibberWebSocketListener socket = TibberHandler.this.socket;
|
||||||
|
|
|
@ -35,11 +35,13 @@ channel-type.tibber.price.label = Current Total Price
|
||||||
channel-type.tibber.price.description = Total Price: Energy + Tax
|
channel-type.tibber.price.description = Total Price: Energy + Tax
|
||||||
channel-type.tibber.production.label = Total Production
|
channel-type.tibber.production.label = Total Production
|
||||||
channel-type.tibber.production.description = Accumulated Production since Midnight
|
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.label = Timestamp
|
||||||
channel-type.tibber.timestamp.description = Timestamp for measurement/change
|
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.label = Voltage
|
||||||
channel-type.tibber.voltage.description = Voltage on given Phase
|
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.
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<channel id="live_lastMeterConsumption" typeId="consumption"/>
|
<channel id="live_lastMeterConsumption" typeId="consumption"/>
|
||||||
<channel id="live_accumulatedConsumption" typeId="consumption"/>
|
<channel id="live_accumulatedConsumption" typeId="consumption"/>
|
||||||
<channel id="live_accumulatedCost" typeId="cost"/>
|
<channel id="live_accumulatedCost" typeId="cost"/>
|
||||||
|
<channel id="live_accumulatedReward" typeId="reward"/>
|
||||||
<channel id="live_currency" typeId="currency"/>
|
<channel id="live_currency" typeId="currency"/>
|
||||||
<channel id="live_minPower" typeId="power"/>
|
<channel id="live_minPower" typeId="power"/>
|
||||||
<channel id="live_averagePower" typeId="power"/>
|
<channel id="live_averagePower" typeId="power"/>
|
||||||
|
@ -82,6 +83,12 @@
|
||||||
<description>Cost at given time interval (e.g. hourly, daily, accumulated since midnight)</description>
|
<description>Cost at given time interval (e.g. hourly, daily, accumulated since midnight)</description>
|
||||||
<state pattern="%.3f"></state>
|
<state pattern="%.3f"></state>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
<channel-type id="reward">
|
||||||
|
<item-type>Number:Dimensionless</item-type>
|
||||||
|
<label>Total Reward</label>
|
||||||
|
<description>Reward at given time interval (e.g. hourly, daily, accumulated since midnight)</description>
|
||||||
|
<state pattern="%.3f"></state>
|
||||||
|
</channel-type>
|
||||||
<channel-type id="consumption">
|
<channel-type id="consumption">
|
||||||
<item-type>Number:Energy</item-type>
|
<item-type>Number:Energy</item-type>
|
||||||
<label>Total Consumption</label>
|
<label>Total Consumption</label>
|
||||||
|
|
Loading…
Reference in New Issue