[tibber] add level to today_prices and tomorrow_prices (#17916)

Fixes #17915

Signed-off-by: Tom Quist <tom+github@quist.de>
This commit is contained in:
Tom Quist 2024-12-18 22:59:58 +01:00 committed by GitHub
parent f45f29f920
commit f78c618dad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 25 deletions

View File

@ -115,99 +115,123 @@ Example of tomorrow and today prices data structure - an array of tuples:
[
{
"startsAt": "2022-09-27T00:00:00.000+02:00",
"total": 3.8472
"total": 3.8472,
"level": "NORMAL"
},
{
"startsAt": "2022-09-27T01:00:00.000+02:00",
"total": 3.0748
"total": 3.0748,
"level": "NORMAL"
},
{
"startsAt": "2022-09-27T02:00:00.000+02:00",
"total": 2.2725
"total": 2.2725,
"level": "CHEAP"
},
{
"startsAt": "2022-09-27T03:00:00.000+02:00",
"total": 2.026
"total": 2.026,
"level": "VERY_CHEAP"
},
{
"startsAt": "2022-09-27T04:00:00.000+02:00",
"total": 2.6891
"total": 2.6891,
"level": "CHEAP"
},
{
"startsAt": "2022-09-27T05:00:00.000+02:00",
"total": 3.7821
"total": 3.7821,
"level": "NORMAL"
},
{
"startsAt": "2022-09-27T06:00:00.000+02:00",
"total": 3.9424
"total": 3.9424,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T07:00:00.000+02:00",
"total": 4.158
"total": 4.158,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T08:00:00.000+02:00",
"total": 4.2648
"total": 4.2648,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T09:00:00.000+02:00",
"total": 4.2443
"total": 4.2443,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T10:00:00.000+02:00",
"total": 4.2428
"total": 4.2428,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T11:00:00.000+02:00",
"total": 4.2061
"total": 4.2061,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T12:00:00.000+02:00",
"total": 4.1458
"total": 4.1458,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T13:00:00.000+02:00",
"total": 3.9396
"total": 3.9396,
"level": "NORMAL"
},
{
"startsAt": "2022-09-27T14:00:00.000+02:00",
"total": 3.8563
"total": 3.8563,
"level": "NORMAL"
},
{
"startsAt": "2022-09-27T15:00:00.000+02:00",
"total": 4.0364
"total": 4.0364,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T16:00:00.000+02:00",
"total": 4.093
"total": 4.093,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T17:00:00.000+02:00",
"total": 4.1823
"total": 4.1823,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T18:00:00.000+02:00",
"total": 4.2779
"total": 4.2779,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T19:00:00.000+02:00",
"total": 4.3154
"total": 4.3154,
"level": "VERY_EXPENSIVE"
},
{
"startsAt": "2022-09-27T20:00:00.000+02:00",
"total": 4.3469
"total": 4.3469,
"level": "VERY_EXPENSIVE"
},
{
"startsAt": "2022-09-27T21:00:00.000+02:00",
"total": 4.2329
"total": 4.2329,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T22:00:00.000+02:00",
"total": 4.1014
"total": 4.1014,
"level": "EXPENSIVE"
},
{
"startsAt": "2022-09-27T23:00:00.000+02:00",
"total": 4.0265
"total": 4.0265,
"level": "EXPENSIVE"
}
]
```

View File

@ -33,7 +33,7 @@ public class TibberPriceConsumptionHandler {
public InputStream getInputStream(String homeId) {
String query = "{\"query\": \"{viewer {home (id: \\\"" + homeId
+ "\\\") {currentSubscription {priceInfo {current {total startsAt level } tomorrow { startsAt total } today { 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}}}}}\"}";
+ "\\\") {currentSubscription {priceInfo {current {total startsAt level } tomorrow { startsAt total level } today { startsAt total level }}} 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));
}