Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/modules/electricity_tariffs/tibber/tariff.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def fetch_prices(config: TibberTariffConfiguration) -> Dict[int, float]:
headers = {'Authorization': 'Bearer ' + config.token, 'Content-Type': 'application/json'}
data = '{ "query": "{viewer {home(id:\\"' + config.home_id + \
'\\") {currentSubscription {priceInfo {today {total startsAt} tomorrow {total startsAt}}}}}}" }'
'\\") {currentSubscription {priceInfo (resolution: QUARTER_HOURLY) {today {total startsAt} tomorrow {total startsAt}}}}}}" }'

Check failure on line 25 in packages/modules/electricity_tariffs/tibber/tariff.py

View workflow job for this annotation

GitHub Actions / build

line too long (133 > 120 characters)
response = req.get_http_session().post('https://api.tibber.com/v1-beta/gql', headers=headers, data=data, timeout=6)
response_json = response.json()
if response_json.get("errors") is None:
Expand Down
9 changes: 9 additions & 0 deletions packages/modules/electricity_tariffs/tibber/tariff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
{"priceInfo":
{"today": [{"total": 0.8724, "startsAt": "2023-10-27T00:00:00.000+02:00"},
{"total": 0.8551, "startsAt": "2023-10-27T01:00:00.000+02:00"},
{"total": 0.8552, "startsAt": "2023-10-27T01:15:00.000+02:00"},
{"total": 0.8553, "startsAt": "2023-10-27T01:30:00.000+02:00"},
{"total": 0.8554, "startsAt": "2023-10-27T01:45:00.000+02:00"},
{"total": 0.8389, "startsAt": "2023-10-27T02:00:00.000+02:00"},
{"total": 0.8189, "startsAt": "2023-10-27T03:00:00.000+02:00"},
{"total": 0.8544, "startsAt": "2023-10-27T04:00:00.000+02:00"},
Expand All @@ -35,6 +38,9 @@
{"total": 1.6862, "startsAt": "2023-10-27T07:00:00.000+02:00"},
{"total": 2.3264, "startsAt": "2023-10-27T08:00:00.000+02:00"},
{"total": 2.3024, "startsAt": "2023-10-27T09:00:00.000+02:00"},
{"total": 2.3124, "startsAt": "2023-10-27T09:15:00.000+02:00"},
{"total": 2.3224, "startsAt": "2023-10-27T09:30:00.000+02:00"},
{"total": 2.3324, "startsAt": "2023-10-27T09:45:00.000+02:00"},
{"total": 1.7204, "startsAt": "2023-10-27T10:00:00.000+02:00"},
{"total": 1.7213, "startsAt": "2023-10-27T11:00:00.000+02:00"},
{"total": 1.8697, "startsAt": "2023-10-27T12:00:00.000+02:00"},
Expand All @@ -55,7 +61,10 @@
EXPECTED_PRICES = {
"1698382800": 0.0016862,
"1698386400": 0.0023264,
"1698390000": 0.0023024,

Check failure on line 64 in packages/modules/electricity_tariffs/tibber/tariff_test.py

View workflow job for this annotation

GitHub Actions / build

dictionary key '1698390000' repeated with different values
"1698390000": 0.0023124,

Check failure on line 65 in packages/modules/electricity_tariffs/tibber/tariff_test.py

View workflow job for this annotation

GitHub Actions / build

dictionary key '1698390000' repeated with different values
"1698390000": 0.0023224,

Check failure on line 66 in packages/modules/electricity_tariffs/tibber/tariff_test.py

View workflow job for this annotation

GitHub Actions / build

dictionary key '1698390000' repeated with different values
"1698390000": 0.0023324,

Check failure on line 67 in packages/modules/electricity_tariffs/tibber/tariff_test.py

View workflow job for this annotation

GitHub Actions / build

dictionary key '1698390000' repeated with different values
"1698393600": 0.0017204,
"1698397200": 0.0017213,
"1698400800": 0.0018697,
Expand Down
Loading