Documentation
¶
Index ¶
- Constants
- type Address
- type Client
- type CurrentPriceInfo
- type CurrentSubscription
- type Data
- type Features
- type Home
- type HomeResponse
- type HomeViewer
- type HomesResponse
- type HomesViewer
- type LiveMeasurement
- type MeteringPointData
- type MsgChan
- type Payload
- type PreviousMeterData
- type PriceInfo
- type PushInput
- type PushResponse
- type SendPushNotification
- type Stream
- type StreamMsg
- type StreamState
Constants ¶
const ( StreamStateConnected = "CONNECTED" StreamStateConnecting = "CONNECTING" StreamStateDisconnected = "DISCONNECTED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Token string // contains filtered or unexported fields }
Client for requests and streams
func (*Client) GetCurrentPrice ¶ added in v0.0.5
func (t *Client) GetCurrentPrice(homeId string) (CurrentPriceInfo, error)
func (*Client) GetHomeById ¶ added in v0.0.4
GetHomeById get a home with information
type CurrentPriceInfo ¶ added in v0.0.5
type CurrentSubscription ¶ added in v0.0.5
type CurrentSubscription struct {
PriceInfo PriceInfo `json:"priceInfo"`
}
type Data ¶
type Data struct {
LiveMeasurement LiveMeasurement `json:"liveMeasurement"`
}
Data in Payload
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 HomeResponse ¶ added in v0.0.4
type HomeResponse struct {
Viewer HomeViewer `json:"viewer"`
}
type HomeViewer ¶
type HomeViewer struct {
Home Home `json:"home"`
}
type HomesResponse ¶
type HomesResponse struct {
Viewer HomesViewer `json:"viewer"`
}
HomesResponse response from homes
type HomesViewer ¶ added in v0.0.4
type HomesViewer struct {
Homes []Home `json:"homes"`
}
HomeViewer list of homes
type LiveMeasurement ¶
type LiveMeasurement struct { Timestamp time.Time `json:"timestamp"` Power float64 `json:"power"` LastMeterConsumption float64 `json:"lastMeterConsumption"` LastMeterProduction float64 `json:"lastMeterProduction"` AccumulatedConsumption float64 `json:"accumulatedConsumption"` AccumulatedCost float64 `json:"accumulatedCost"` AccumulatedProduction float64 `json:"accumulatedProduction"` AccumulatedReward float64 `json:"accumulatedReward"` MinPower float64 `json:"minPower"` AveragePower float64 `json:"averagePower"` MaxPower float64 `json:"maxPower"` PowerProduction float64 `json:"powerProduction"` MinPowerProduction float64 `json:"minPowerProduction"` MaxPowerProduction float64 `json:"maxPowerProduction"` VoltagePhase1 float64 `json:"voltagePhase1"` VoltagePhase2 float64 `json:"voltagePhase2"` VoltagePhase3 float64 `json:"voltagePhase3"` CurrentPhase1 float64 `json:"currentPhase1"` CurrentPhase2 float64 `json:"currentPhase2"` CurrentPhase3 float64 `json:"currentPhase3"` }
LiveMeasurement in data payload
func (*LiveMeasurement) AsFloatMap ¶ added in v0.1.1
func (m *LiveMeasurement) AsFloatMap() map[string]float64
AsFloatMap returns the LiveMeasurement struct as a float map
func (*LiveMeasurement) HasPower ¶ added in v0.2.0
func (m *LiveMeasurement) HasPower() bool
HasPower returns true if the report contains power measurement
func (*LiveMeasurement) HasProductionOrConsumptionPower ¶ added in v0.2.1
func (m *LiveMeasurement) HasProductionOrConsumptionPower() bool
HasProductionOrConsumptionPower return true if measurement contains values
func (*LiveMeasurement) IsExtended ¶ added in v0.1.1
func (m *LiveMeasurement) IsExtended() bool
IsExtended returns whether the report is normal or extended. In an extended report we would have at least one phase information
type MeteringPointData ¶
type MeteringPointData struct {
ConsumptionEan string `json:"consumptionEan"`
}
MeteringPointData - meter number
type PreviousMeterData ¶ added in v0.2.0
type PriceInfo ¶ added in v0.0.5
type PriceInfo struct {
CurrentPriceInfo CurrentPriceInfo `json:"current"`
}
type PushInput ¶
type PushInput struct { Title string `json:"title"` Message string `json:"message"` ScreenToOpen string `json:"screenToOpen"` }
PushInput push message
type PushResponse ¶
type PushResponse struct {
SendPushNotification SendPushNotification `json:"sendPushNotification"`
}
PushResponse respons from notification api
type SendPushNotification ¶
type SendPushNotification struct { Successful bool `json:"successful"` PushedToNumberOfDevices int `json:"pushedToNumberOfDevices"` }
SendPushNotification data in push response
type Stream ¶
Stream for subscribing to Tibber pulse
func (*Stream) StartSubscription ¶
StartSubscription init connection and subscribes to home id
func (*Stream) StateReportChan ¶ added in v0.2.0
func (ts *Stream) StateReportChan() chan StreamState
type StreamMsg ¶
type StreamMsg struct { HomeID string `json:"homeId"` Type string `json:"type"` ID int `json:"id"` Payload Payload `json:"payload"` }
StreamMsg for streams