azzurro

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(apiAuth string, clientID string) *Client

NewClient creates a new client with the given API key, client ID and default base URL

func NewClientWithBaseURL

func NewClientWithBaseURL(apiAuth string, clientID string, baseURL string) *Client

NewClientWithBaseURL creates a new client with the given API key and base URL

func (*Client) FetchRealtimeData

func (c *Client) FetchRealtimeData(thingID string) (RealtimeDataResponse, error)

FetchRealtimeData fetches the realtime data for the thing with the given ID

type Params

type Params struct {
	ThingKey       string `json:"thingKey"`
	RequiredValues string `json:"requiredValues"`
}

type RealtimeData

type RealtimeData struct {
	Command string `json:"command"`
	Params  Params `json:"params"`
}

type RealtimeDataRequest

type RealtimeDataRequest struct {
	RealtimeData RealtimeData `json:"realtimeData"`
}

type RealtimeDataResponse

type RealtimeDataResponse struct {
	RealtimeData struct {
		Params struct {
			Value []map[string]struct {
				EnergyDischargingTotal   float64   `json:"energyDischargingTotal"`
				PowerExporting           float64   `json:"powerExporting"`
				EnergyExportingTotal     float64   `json:"energyExportingTotal"`
				EnergyDischarging        float64   `json:"energyDischarging"`
				BatteryCycletime         int       `json:"batteryCycletime"`
				LastUpdate               time.Time `json:"lastUpdate"`
				EnergyGenerating         float64   `json:"energyGenerating"`
				EnergyAutoconsumingTotal float64   `json:"energyAutoconsumingTotal"`
				EnergyImporting          float64   `json:"energyImporting"`
				EnergyCharging           float64   `json:"energyCharging"`
				PowerImporting           float64   `json:"powerImporting"`
				EnergyChargingTotal      float64   `json:"energyChargingTotal"`
				EnergyConsumingTotal     float64   `json:"energyConsumingTotal"`
				EnergyAutoconsuming      float64   `json:"energyAutoconsuming"`
				PowerConsuming           float64   `json:"powerConsuming"`
				EnergyConsuming          float64   `json:"energyConsuming"`
				PowerGenerating          float64   `json:"powerGenerating"`
				EnergyImportingTotal     float64   `json:"energyImportingTotal"`
				EnergyExporting          float64   `json:"energyExporting"`
				BatterySoC               int       `json:"batterySoC"`
				ThingFind                string    `json:"thingFind"`
				PowerAutoconsuming       float64   `json:"powerAutoconsuming"`
				PowerCharging            float64   `json:"powerCharging"`
				EnergyGeneratingTotal    float64   `json:"energyGeneratingTotal"`
				PowerDischarging         float64   `json:"powerDischarging"`
			} `json:"value"`
		} `json:"params"`
		Success bool `json:"success"`
	} `json:"realtimeData"`
}

Jump to

Keyboard shortcuts

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