github.com/FileGo/octopusenergyapi

Octopus Energy API package for Go


License
MIT
Install
go get github.com/FileGo/octopusenergyapi

Documentation

Octopus Energy API

PkgGoDev Go Report Card tests build

This package provides an interface to Octopus Energy's API, which provides a lot of useful data, including viewing half-hourly consumption of an electricity or gas meter.

An API key from Octopus Energy is required, as mentioned here. This can be obtained from your online dashboard.

Usage

client, err := octopusenergyapi.NewClient("{API_KEY}", http.DefaultClient)
if err != nil {
    log.Fatal(err)
}

mpoint, err := client.GetMeterPoint(mpan)
if err != nil {
    log.Fatal(err)
}

fmt.Printf("MPAN: %s\nProfile class: %d (%s)\n",
    mpoint.MPAN, mpoint.ProfileClass, octopusenergyapi.PCs[mpoint.ProfileClass])
fmt.Printf("GSP: %s (%s)\n",
    mpoint.GSP.GSPGroupID, mpoint.GSP.Name)

If you find bug or would like to see some additional functionality, please raise an issue. PRs are also more than welcome.