Since switching to the Octopus Agile tariff I have been saving about 35% a month on my electricity bill. I am not a very heavy user, and I don't have an electric vehicle or house battery. But I don't need to use much electricity between 16:00 and 19:00 which I think gives me the biggest saving. I also have a small server running 24 hours a day, which means I do use electricity all night long duing the cheaper periods.

The only problem I have with it is my SMETS1 meter sometimes fails to send half hourly readings to Octopus, and when this happens they can't bill me for that month. So I need to ask them to manually create a bill for me and try to obtain the missing HH readings.
To help spot when this happens I made a little Python script which I can pipe the JSON output from the Octopus API to and see when the difference between any two readings is more than 30 minutes.
The script looks like:
missing_octopus.py

#!/usr/bin/env python3
import json, sys
from datetime import datetime, timezone, timedelta

data = json.load(sys.stdin)

results = data['results']

last_end = ""
first_date=""

for result in results:
    # data is in descending date order
    consumption = result['consumption']
    start = result['interval_start']
    end = result['interval_end']

    if first_date == "":
        first_date = start

    if last_end == "":
        last_end = end
        continue

    # read time with timezone info
    time_end = datetime.strptime(end, '%Y-%m-%dT%H:%M:%S%z')
    time_last_end = datetime.strptime(last_end, '%Y-%m-%dT%H:%M:%S%z')

    # convert to UTC 
    utc_end = time_end.astimezone(timezone.utc).replace(tzinfo=None)
    utc_last_end = time_last_end.astimezone(timezone.utc).replace(tzinfo=None)
    diff = utc_last_end - utc_end
    diff_s = diff.total_seconds()

    # interval ends should be 30 mins apart
    if diff_s != 1800.0:
        print("last end:",utc_last_end,"this end:",utc_end, "diff:", diff, "missing ", (diff_s-1800.0)/1800.0, " readings")

    last_end = end
print("Found data from",start,"to",first_date)

and I run it like (to check data since 1st Jan 2023):

curl -u "sk_live_XXXXXXXXXXXXXXXXXXX:" "https://api.octopus.energy/v1/electricity-meter-points/123123123123123/meters/12B12B12B12B/consumption/?period_from=2023-01-01&page_size=15000" | python3 ./missing_octopus.py

which gives output as:

last end: 2024-01-25 12:30:00 this end: 2024-01-25 11:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-12-13 10:00:00 this end: 2023-12-13 09:00:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-17 10:00:00 this end: 2023-10-17 09:00:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-16 10:00:00 this end: 2023-10-16 08:30:00 diff: 1:30:00 missing  2.0  readings
last end: 2023-10-16 08:30:00 this end: 2023-10-16 07:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-15 17:30:00 this end: 2023-10-15 16:00:00 diff: 1:30:00 missing  2.0  readings
last end: 2023-10-15 08:30:00 this end: 2023-10-15 07:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-14 10:30:00 this end: 2023-10-14 09:00:00 diff: 1:30:00 missing  2.0  readings
last end: 2023-10-14 08:30:00 this end: 2023-10-14 07:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-13 10:30:00 this end: 2023-10-13 09:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-13 08:30:00 this end: 2023-10-13 07:30:00 diff: 1:00:00 missing  1.0  readings
last end: 2023-10-12 10:30:00 this end: 2023-10-12 09:30:00 diff: 1:00:00 missing  1.0  readings
Found data from 2023-04-20T05:30:00+01:00 to 2024-02-26T23:30:00Z

Your API key and meter numbers (and an example curl command) can be found on the Octopus API access page at https://octopus.energy/dashboard/new/accounts/personal-details/api-access. Make sure the script is run with python 3 otherwise it won't work.

Previous Post Next Post