tariff

package
v0.0.0-...-a4a4f50 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const SlotDuration = 15 * time.Minute

Variables

This section is empty.

Functions

func At

func At(t api.Tariff, ts time.Time) (api.Rate, error)

At returns the rate at the given time

func Name

func Name(conf config.Typed) string

Name returns the tariff type name

func NewAmberFromConfig

func NewAmberFromConfig(other map[string]any) (api.Tariff, error)

func NewAverageProxy

func NewAverageProxy(t api.Tariff) (api.Tariff, error)

NewAverageProxy creates a proxy that tariff averaging

func NewAwattarFromConfig

func NewAwattarFromConfig(other map[string]any) (api.Tariff, error)

func NewCachedFromConfig

func NewCachedFromConfig(ctx context.Context, typ string, other map[string]any) (api.Tariff, error)

NewCachedFromConfig creates a proxy that controls tariff instantiation and caching

func NewCombined

func NewCombined(tariffs []api.Tariff) api.Tariff

func NewConfigurableFromConfig

func NewConfigurableFromConfig(ctx context.Context, other map[string]any) (api.Tariff, error)

func NewEdfTempoFromConfig

func NewEdfTempoFromConfig(other map[string]any) (api.Tariff, error)

func NewElectricityMapsFromConfig

func NewElectricityMapsFromConfig(other map[string]any) (api.Tariff, error)

func NewEleringFromConfig

func NewEleringFromConfig(other map[string]any) (api.Tariff, error)

func NewEntsoeFromConfig

func NewEntsoeFromConfig(other map[string]any) (api.Tariff, error)

func NewFixedFromConfig

func NewFixedFromConfig(other map[string]any) (api.Tariff, error)

func NewFromConfig

func NewFromConfig(ctx context.Context, typ string, other map[string]any) (api.Tariff, error)

NewFromConfig creates tariff from configuration

func NewFromTemplateConfig

func NewFromTemplateConfig(ctx context.Context, other map[string]any) (api.Tariff, error)

func NewGrünStromIndexFromConfig

func NewGrünStromIndexFromConfig(other map[string]any) (api.Tariff, error)

func NewMergedFromConfig

func NewMergedFromConfig(ctx context.Context, other map[string]any) (api.Tariff, error)

func NewNgesoFromConfig

func NewNgesoFromConfig(other map[string]any) (api.Tariff, error)

func NewOctopusDeFromConfig

func NewOctopusDeFromConfig(other map[string]any) (api.Tariff, error)

NewOctopusDeFromConfig creates the tariff provider from the given config map, and runs it.

func NewOctopusFromConfig

func NewOctopusFromConfig(other map[string]any) (api.Tariff, error)

NewOctopusFromConfig creates the tariff provider from the given config map, and runs it.

func NewOstromFromConfig

func NewOstromFromConfig(other map[string]any) (api.Tariff, error)

func NewProxyFromConfig

func NewProxyFromConfig(ctx context.Context, typ string, other map[string]any) (api.Tariff, error)

NewProxyFromConfig creates a tariff proxy supporting average or caching

func NewPunFromConfig

func NewPunFromConfig(other map[string]any) (api.Tariff, error)

func NewSmartEnergyFromConfig

func NewSmartEnergyFromConfig(other map[string]any) (api.Tariff, error)

func NewSolcastFromConfig

func NewSolcastFromConfig(other map[string]any) (api.Tariff, error)

func NewStekkerFromConfig

func NewStekkerFromConfig(other map[string]any) (api.Tariff, error)

NewStekkerFromConfig creates provider from config

func NewTibberFromConfig

func NewTibberFromConfig(other map[string]any) (api.Tariff, error)

func NewWrapper

func NewWrapper(typ string, other map[string]any, err error) api.Tariff

NewWrapper creates an offline tariff wrapper

func Now

func Now(t api.Tariff) (float64, error)

Now returns the price/cost/value at the given time

func Rates

func Rates(t api.Tariff) api.Rates

Rates returns the tariffs rates if not nil

func Types

func Types() []string

Types returns the list of types

Types

type Amber

type Amber struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (Amber) Features

func (t Amber) Features() []api.Feature

func (*Amber) Rates

func (t *Amber) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Amber) Type

func (t *Amber) Type() api.TariffType

Type returns the tariff type

func (*Amber) Unit

func (t *Amber) Unit() string

type Awattar

type Awattar struct {
	// contains filtered or unexported fields
}

func (Awattar) Features

func (t Awattar) Features() []api.Feature

func (*Awattar) Rates

func (t *Awattar) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Awattar) Type

func (t *Awattar) Type() api.TariffType

Type implements the api.Tariff interface

type CarbonIntensity

type CarbonIntensity struct {
	Error    string
	Zone     string
	Forecast []CarbonIntensitySlot
}

type CarbonIntensitySlot

type CarbonIntensitySlot struct {
	CarbonIntensity float64   // 626,
	Datetime        time.Time // "2022-12-12T16:00:00.000Z"
}

type EdfTempo

type EdfTempo struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (EdfTempo) Features

func (t EdfTempo) Features() []api.Feature

func (*EdfTempo) Rates

func (t *EdfTempo) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*EdfTempo) Type

func (t *EdfTempo) Type() api.TariffType

Type implements the api.Tariff interface

type ElectricityMaps

type ElectricityMaps struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (*ElectricityMaps) Rates

func (t *ElectricityMaps) Rates() (api.Rates, error)

func (*ElectricityMaps) Type

func (t *ElectricityMaps) Type() api.TariffType

Type implements the api.Tariff interface

type Elering

type Elering struct {
	// contains filtered or unexported fields
}

func (Elering) Features

func (t Elering) Features() []api.Feature

func (*Elering) Rates

func (t *Elering) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Elering) Type

func (t *Elering) Type() api.TariffType

Type implements the api.Tariff interface

type Entsoe

type Entsoe struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (Entsoe) Features

func (t Entsoe) Features() []api.Feature

func (*Entsoe) Rates

func (t *Entsoe) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Entsoe) Type

func (t *Entsoe) Type() api.TariffType

Type implements the api.Tariff interface

type Fixed

type Fixed struct {
	// contains filtered or unexported fields
}

func (*Fixed) Rates

func (t *Fixed) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Fixed) Type

func (t *Fixed) Type() api.TariffType

Type implements the api.Tariff interface

type FromTo

type FromTo struct {
	From, To int
}

func (FromTo) IsActive

func (ft FromTo) IsActive(hour int) bool

type GrünStromIndex

type GrünStromIndex struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (*GrünStromIndex) Rates

func (t *GrünStromIndex) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*GrünStromIndex) Type

func (t *GrünStromIndex) Type() api.TariffType

Type implements the api.Tariff interface

type Merged

type Merged struct {
	// contains filtered or unexported fields
}

Merged combines a primary tariff with a secondary (forecast) tariff. Primary rates are used where available, secondary fills gaps after primary ends.

func (*Merged) Rates

func (t *Merged) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Merged) Type

func (t *Merged) Type() api.TariffType

Type implements the api.Tariff interface

type NewDataSet

type NewDataSet struct {
	XMLName xml.Name `xml:"NewDataSet"`
	Prezzi  []Prezzo `xml:"Prezzi"`
}

type Ngeso

type Ngeso struct {
	// contains filtered or unexported fields
}

func (*Ngeso) Rates

func (t *Ngeso) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Ngeso) Type

func (t *Ngeso) Type() api.TariffType

Type implements the api.Tariff interface

type Octopus

type Octopus struct {
	// contains filtered or unexported fields
}

func (*Octopus) Rates

func (t *Octopus) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Octopus) Type

func (t *Octopus) Type() api.TariffType

Type implements the api.Tariff interface

type OctopusDe

type OctopusDe struct {
	// contains filtered or unexported fields
}

func (*OctopusDe) Rates

func (t *OctopusDe) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*OctopusDe) Type

func (t *OctopusDe) Type() api.TariffType

Type implements the api.Tariff interface

type Ostrom

type Ostrom struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (Ostrom) Features

func (t Ostrom) Features() []api.Feature

func (*Ostrom) Rates

func (t *Ostrom) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Ostrom) Type

func (t *Ostrom) Type() api.TariffType

Type implements the api.Tariff interface

type Prezzo

type Prezzo struct {
	Data string `xml:"Data"`
	Ora  string `xml:"Ora"`
	PUN  string `xml:"PUN"`
}

type Pun

type Pun struct {
	// contains filtered or unexported fields
}

func (Pun) Features

func (t Pun) Features() []api.Feature

func (*Pun) Rates

func (t *Pun) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Pun) Type

func (t *Pun) Type() api.TariffType

Type implements the api.Tariff interface

type Rate

type Rate struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	Price float64   `json:"price"`
}

type SlotWrapper

type SlotWrapper struct {
	api.Tariff
}

func (*SlotWrapper) Rates

func (t *SlotWrapper) Rates() (api.Rates, error)

Rates converts arbitrary slot lengths (e.g. 1h, 30m) to 15m slots. Slot length must be multiple of SlotDuration. For price tariffs, the value is constant over all sub-slots. For solar/co2, linear interpolation is used between slot boundaries.

type SmartEnergy

type SmartEnergy struct {
	// contains filtered or unexported fields
}

func (SmartEnergy) Features

func (t SmartEnergy) Features() []api.Feature

func (*SmartEnergy) Rates

func (t *SmartEnergy) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*SmartEnergy) Type

func (t *SmartEnergy) Type() api.TariffType

Type implements the api.Tariff interface

type Solcast

type Solcast struct {
	*request.Helper
	// contains filtered or unexported fields
}

func (*Solcast) Rates

func (t *Solcast) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Solcast) Type

func (t *Solcast) Type() api.TariffType

Type implements the api.Tariff interface

type Stekker

type Stekker struct {
	// contains filtered or unexported fields
}

Stekker provider

func (Stekker) Features

func (t Stekker) Features() []api.Feature

func (*Stekker) Rates

func (t *Stekker) Rates() (api.Rates, error)

Rates implements api.Tariff

func (*Stekker) Type

func (t *Stekker) Type() api.TariffType

Type implements api.Tariff

type Tariff

type Tariff struct {
	// contains filtered or unexported fields
}

func (Tariff) Features

func (t Tariff) Features() []api.Feature

func (*Tariff) Rates

func (t *Tariff) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Tariff) Type

func (t *Tariff) Type() api.TariffType

Type implements the api.Tariff interface

type Tariffs

type Tariffs struct {
	Currency                          currency.Unit
	Grid, FeedIn, Co2, Planner, Solar api.Tariff
}

func (*Tariffs) Get

func (t *Tariffs) Get(u api.TariffUsage) api.Tariff

type Tibber

type Tibber struct {
	// contains filtered or unexported fields
}

func (Tibber) Features

func (t Tibber) Features() []api.Feature

func (*Tibber) Rates

func (t *Tibber) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Tibber) Type

func (t *Tibber) Type() api.TariffType

Type implements the api.Tariff interface

type Typed

type Typed struct {
	Type   string         `json:"type"`
	Tariff string         `json:"tariff"`
	Other  map[string]any `mapstructure:",remain" yaml:",inline"`
}

func (Typed) Name

func (t Typed) Name() string

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

Wrapper wraps an api.Tariff to capture initialization errors

func (*Wrapper) Rates

func (t *Wrapper) Rates() (api.Rates, error)

Rates implements the api.Tariff interface

func (*Wrapper) Type

func (t *Wrapper) Type() api.TariffType

Type implements the api.Tariff interface

func (*Wrapper) WrappedConfig

func (v *Wrapper) WrappedConfig() (string, map[string]any)

WrappedConfig indicates a device with wrapped configuration

Directories

Path Synopsis
Package entsoe implements a minimalized version of the European Network of Transmission System Operators for Electricity's Transparency Platform API (https://transparency.entsoe.eu)
Package entsoe implements a minimalized version of the European Network of Transmission System Operators for Electricity's Transparency Platform API (https://transparency.entsoe.eu)
Package ngeso implements the carbonintensity.org.uk Grid CO2 tracking service, which provides CO2 forecasting for the UK at a national and regional level.
Package ngeso implements the carbonintensity.org.uk Grid CO2 tracking service, which provides CO2 forecasting for the UK at a national and regional level.
octopus
octopusde

Jump to

Keyboard shortcuts

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