Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) GetElecMeterConsumption(mpan, serialNo string, options ConsumptionOption) ([]Consumption, error)
- func (c *Client) GetGasMeterConsumption(mpan, serialNo string, options ConsumptionOption) ([]Consumption, error)
- func (c *Client) GetGridSupplyPoint(postcode string) (GridSupplyPoint, error)
- func (c *Client) GetMeterPoint(mpan string) (MeterPoint, error)
- func (c *Client) GetProduct(productCode string) (Product, error)
- func (c *Client) ListProducts() ([]Product, error)
- type Consumption
- type ConsumptionOption
- type GridSupplyPoint
- type Link
- type MeterPoint
- type Product
- type Tariff
Constants ¶
This section is empty.
Variables ¶
var GSPs = [...]GridSupplyPoint{
{10, "Eastern England", "UK Power Networks", "0800 029 4285", "EELC", "_A"},
{11, "East Midlands", "Western Power Distribution", "0800 096 3080", "EMEB", "_B"},
{12, "London", "UK Power Networks", "0800 029 4285", "LOND", "_C"},
{13, "Merseyside and Northern Wales", "SP Energy Networks", "0330 10 10 444", "MANW", "_D"},
{14, "West Midlands", "Western Power Distribution", "0800 096 3080", "MIDE", "_E"},
{15, "North Eastern England", "Northern Powergrid", "0800 011 3332", "NEEB", "_F"},
{16, "North Western England", "Electricity North West", "0800 048 1820", "NORW", "_G"},
{17, "Northern Scotland", "Scottish & Southern Electricity Networks", "0800 048 3516", "HYDE", "_P"},
{18, "Southern Scotland", "SP Energy Networks", "0330 10 10 444", "SPOW", "_N"},
{19, "South Eastern England", "UK Power Networks", "0800 029 4285", "SEEB", "_J"},
{20, "Southern England", "Scottish & Southern Electricity Networks", "0800 048 3516", "SOUT", "_H"},
{21, "Southern Wales", "Western Power Distribution", "0800 096 3080", "SWAE", "_K"},
{22, "South Western England", "Western Power Distribution", "0800 096 3080", "SWEB", "_L"},
{23, "Yorkshire", "Northern Powergrid", "0800 011 3332", "YELG", "_M"},
}
GSPs provides a list of Grid Supply Points (GSP) https://en.wikipedia.org/wiki/Meter_Point_Administration_Number#Distributor_ID
var PCs = map[int]string{
0: "Half-hourly supply (import and export)",
1: "Domestic unrestricted",
2: "Domestic Economy meter of two or more rates",
3: "Non-domestic unrestricted",
4: "Non-domestic Economy 7",
5: "Non-domestic, with maximum demand (MD) recording capability and with load factor (LF) less than or equal to 20%",
6: "Non-domestic, with MD recording capability and with LF less than or equal to 30% and greater than 20%",
7: "Non-domestic, with MD recording capability and with LF less than or equal to 40% and greater than 30%",
8: "Non-domestic, with MD recording capability and with LF greater than 40% (also all non-half-hourly export MSIDs)",
}
PCs represents Profile Class of a meter point https://en.wikipedia.org/wiki/Meter_Point_Administration_Number#Profile_Class_(PC)
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.0.2
type Client struct { URL string // contains filtered or unexported fields }
Client represents a Client to be used with the API
func (*Client) GetElecMeterConsumption ¶ added in v0.0.3
func (c *Client) GetElecMeterConsumption(mpan, serialNo string, options ConsumptionOption) ([]Consumption, error)
GetElecMeterConsumption retrieves electricity consumption https://developer.octopus.energy/docs/api/#consumption
func (*Client) GetGasMeterConsumption ¶ added in v0.0.3
func (c *Client) GetGasMeterConsumption(mpan, serialNo string, options ConsumptionOption) ([]Consumption, error)
GetGasMeterConsumption retrieves electricity consumption https://developer.octopus.energy/docs/api/#consumption
func (*Client) GetGridSupplyPoint ¶ added in v0.0.2
func (c *Client) GetGridSupplyPoint(postcode string) (GridSupplyPoint, error)
GetGridSupplyPoint gets a grid supply point based on postcode https://developer.octopus.energy/docs/api/#list-grid-supply-points
func (*Client) GetMeterPoint ¶ added in v0.0.2
func (c *Client) GetMeterPoint(mpan string) (MeterPoint, error)
GetMeterPoint retrieves an electricity meter point for a given MPAN https://developer.octopus.energy/docs/api/#electricity-meter-points
func (*Client) GetProduct ¶ added in v0.0.2
GetProduct retrieves a product based on its name https://developer.octopus.energy/docs/api/#retrieve-a-product
func (*Client) ListProducts ¶ added in v0.0.2
ListProducts returns a list of energy products https://developer.octopus.energy/docs/api/#list-products
type Consumption ¶
type Consumption struct { // Value represents meter reading for the interval // Unit depends on the type of meter: // // Electricity meters: kWh // // SMETS1 Secure gas meters: kWh // // SMETS2 gas meters: m^3 Value float32 `json:"consumption"` IntervalStart time.Time `json:"interval_start"` IntervalEnd time.Time `json:"interval_end"` }
Consumption represents a power consumption in a given interval
type ConsumptionOption ¶
type ConsumptionOption struct { From time.Time To time.Time PageSize int OrderBy string GroupBy string }
ConsumptionOption represents optional parameters for API.GetMeterConsumption
type GridSupplyPoint ¶
type GridSupplyPoint struct { ID int Name string Operator string PhoneNumber string ParticipantID string GSPGroupID string }
GridSupplyPoint represents a Grid Supply Point (GSP)
type Link ¶
type Link struct { Href string `json:"href"` Method string `json:"method"` Rel string `json:"rel"` }
Link represents a hyperlink
type MeterPoint ¶
type MeterPoint struct { GSP GridSupplyPoint MPAN string ProfileClass int }
MeterPoint represents a meter point https://developer.octopus.energy/docs/api/#retrieve-a-meter-point
type Product ¶
type Product struct { Code string `json:"code"` Direction string `json:"direciton"` FullName string `json:"full_name"` DisplayName string `json:"display_name"` Description string `json:"description"` IsVariable bool `json:"is_variable"` IsGreen bool `json:"is_green"` IsTracker bool `json:"is_tracker"` IsPrepay bool `json:"is_prepay"` IsBusiness bool `json:"is_business"` IsRestricted bool `json:"is_restricted"` Term int `json:"term"` AvailableFrom time.Time `json:"available_from"` AvailableTo time.Time `json:"available_to"` Links []Link `json:"links"` SingleRegisterElecTariffs map[string]map[string]Tariff `json:"single_register_electricity_tariffs"` DualRegisterElecTariffs map[string]map[string]Tariff `json:"dual_register_electricity_tariffs"` SingleRegisterGasTariffs map[string]map[string]Tariff `json:"single_register_gas_tariffs"` }
Product represents an Octopus Energy product https://developer.octopus.energy/docs/api/#retrieve-a-product
type Tariff ¶
type Tariff struct { Code string `json:"code"` StandingChargeExcVAT float32 `json:"standing_charge_exc_vat"` StandingChargeIncVAT float32 `json:"standing_charge_inc_vat"` OnlineDiscountExcVAT float32 `json:"online_discount_exc_vat"` OnlineDiscountIncVAT float32 `json:"online_discount_inc_vat"` DualFuelDiscountExcVAT float32 `json:"dual_fuel_discount_exc_vat"` DualFuelDiscountIncVAT float32 `json:"dual_fuel_discount_inc_vat"` ExitFeesExcVAT float32 `json:"exit_fees_exc_vat"` ExitFeesIncVAT float32 `json:"exit_fees_inc_vat"` Links []Link `json:"links"` StandardUnitRateExcVAT float32 `json:"standard_unit_rate_exc_vat"` StandardUnitRateIncVAT float32 `json:"standard_unit_rate_inc_vat"` }
Tariff represent an Octopus Energy tariff