easyenergy

package
v0.0.0-...-3cdd1f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2021 License: EUPL-1.2 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URL is the URL to the Easy Energy XML API
	URL = "https://mijn.easyenergy.com/nl/api/tariff/getapxtariffs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
}

Client is a HTTP client for the EasyEnergy API

func NewClient

func NewClient(cli *http.Client) *Client

NewClient creates a new HTTP client for the EasyEnergy API

func (*Client) Get

func (c *Client) Get(start, end time.Time) (data []EnergyTariff, err error)

Get retrieves the latest data from the EasyEnergy API

func (*Client) GetSenML

func (c *Client) GetSenML(start, end time.Time) ([]senml.Measurement, error)

GetSenML collects measurements from EasyEnergy and converts them to SenML

type EnergyTariff

type EnergyTariff struct {
	Time         time.Time `json:"Timestamp"`
	SupplierID   int       `json:"SupplierId"`
	TariffUsage  float64   `json:"TariffUsage"`
	TariffReturn float64   `json:"TariffReturn"`
}

EnergyTariff represents an hourly energy price from a supplier

type Error

type Error struct {
	Message string
}

Error represents an error message from the API

func (*Error) Error

func (e *Error) Error() error

Error returns the error for this Error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL