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());
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());
}
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) {