Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Octopus API s are using different date format #3

Open
MikeHenley opened this issue May 27, 2019 · 0 comments
Open

Octopus API s are using different date format #3

MikeHenley opened this issue May 27, 2019 · 0 comments

Comments

@MikeHenley
Copy link

This is a great script - the only one I've found that does exactly what I was looking for - I am an Octopus Agile user.
Problem I found was Agile rates are displayed same as Go rate. After investigation, issue is due to different date formats being used for usage (meter) API and price API (the script defaults to Go rate if if can't find a match for date).
In https://api.octopus.energy/v1/electricity-meter-points "interval_end":"2019-05-18T20:00:00+01:00"
In https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs "valid_to":"2019-05-20T17:00:00Z"
I patched it like this, but Python is not my language, so I'm sure it can be fixed much better!!!!
period = maya.parse(measurement['interval_end'])
time = period.datetime().strftime('%Y-%m-%dT%H:%M:%SZ')
agile_standing_charge = rate_data['agile_standing_charge'] / 48
agile_unit_rate = agile_rates.get(
time,
rate_data[rate] # cludge, use Go rate during DST changeover
)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant