tibber

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 8 Imported by: 0

README

tibber-go

Go developer module for tibber

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address    string `json:"address1"`
	PostalCode string `json:"postalCode"`
	City       string `json:"city"`
	Country    string `json:"country"`
	Latitude   string `json:"latitude"`
	Longitude  string `json:"longitude"`
}

type CurrentSubscription

type CurrentSubscription struct {
	PriceInfo PriceInfo `json:"priceInfo"`
}

type Features

type Features struct {
	RealTimeConsumptionEnabled bool `json:"realTimeConsumptionEnabled"`
}

Features - tibber pulse connected

type Home

type Home struct {
	ID                   string              `json:"id"`
	AppNickname          string              `json:"appNickname"`
	MeteringPointData    MeteringPointData   `json:"meteringPointData"`
	Features             Features            `json:"features"`
	Address              Address             `json:"address"`
	Size                 int                 `json:"size"`
	MainFuseSize         int                 `json:"mainFuseSize"`
	NumberOfResidents    int                 `json:"numberOfResidents"`
	PrimaryHeatingSource string              `json:"primaryHeatingSource"`
	HasVentilationSystem bool                `json:"hasVentilationSystem"`
	CurrentSubscription  CurrentSubscription `json:"currentSubscription"`
	PreviousMeterData    PreviousMeterData   `json:"previousMeterData"`
}

Home structure

type LiveMeasurement

type LiveMeasurement struct {
	Timestamp                      time.Time `json:"timestamp"`
	Power                          int       `json:"power"`
	MinPower                       int       `json:"minPower"`
	AveragePower                   float64   `json:"averagePower"`
	MaxPower                       float64   `json:"maxPower"`
	LastMeterConsumption           float64   `json:"lastMeterConsumption"`
	LastMeterProduction            float64   `json:"lastMeterProduction"`
	AccumulatedConsumption         float64   `json:"accumulatedConsumption"`
	AccumulatedProduction          float64   `json:"accumulatedProduction"`
	AccumulatedCost                float64   `json:"accumulatedCost"`
	AccumulatedConsumptionLastHour float64   `json:"accumulatedConsumptionLastHour"`
	AccumulatedProductionLastHour  float64   `json:"accumulatedProductionLastHour"`
	Currency                       string    `json:"currency"`
}

type MeteringPointData

type MeteringPointData struct {
	ConsumptionEan string `json:"consumptionEan"`
}

MeteringPointData - meter number

type PreviousMeterData

type PreviousMeterData struct {
	Power           float64 `json:"power"`
	PowerProduction float64 `json:"powerProduction"`
}

type Price

type Price struct {
	Level    string    `json:"level"`
	Total    float64   `json:"total"`
	Energy   float64   `json:"energy"`
	Tax      float64   `json:"tax"`
	Currency string    `json:"currency"`
	StartsAt time.Time `json:"startsAt"`
}

type PriceInfo

type PriceInfo struct {
	CurrentPriceInfo Price   `json:"current"`
	Today            []Price `json:"today"`
	Tomorrow         []Price `json:"tomorrow"`
}

type QueryResponse

type QueryResponse struct {
	Viewer Viewer
}

type SubscriptionHandler

type SubscriptionHandler func(LiveMeasurement, error) error

type TibberClient

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

func CreateTibberClient

func CreateTibberClient(token string, agent string) *TibberClient

func (*TibberClient) Close

func (ctx *TibberClient) Close()

func (*TibberClient) GetHomes

func (ctx *TibberClient) GetHomes() (QueryResponse, error)

func (*TibberClient) GetPriceInfo

func (ctx *TibberClient) GetPriceInfo(homeId string) (CurrentSubscription, error)

func (*TibberClient) StartSubscription

func (ctx *TibberClient) StartSubscription(houseId string, handler SubscriptionHandler) error

type Viewer

type Viewer struct {
	Name   string `json:"name"`
	UserId string `json:"userId"`
	Homes  []Home `json:"homes"`
	Home   Home   `json:"home"`
}

Jump to

Keyboard shortcuts

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