Skip to content

Commit

Permalink
Merge pull request #14 from runemoennike/tariffs-incorrect-sort
Browse files Browse the repository at this point in the history
Fixed sorting of hourly tariffs.
  • Loading branch information
JonasPed committed Oct 6, 2022
2 parents 57f9d5c + 84f5253 commit abfb32f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyeloverblik/eloverblik.py
Expand Up @@ -257,7 +257,7 @@ def _parse_tariffs_from_charges_result(self, result):
if tariff['periodType'] == 'P1D':
charges[name] = tariff['prices'][0]['price']
elif tariff['periodType'] == 'PT1H':
sorted_prices = [p['price'] for p in sorted(tariff['prices'], key=lambda d: d['position'])]
sorted_prices = [p['price'] for p in sorted(tariff['prices'], key=lambda d: int(d['position']))]
charges[name] = sorted_prices
else:
raise NotImplementedError(f"Unsupported periodType for tariff '{tariff['periodType']}")
Expand Down

0 comments on commit abfb32f

Please sign in to comment.