Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = http.DefaultClient
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is used to interact with Netatmo API
func NewClient ¶
NewClient creates a new Netatmo API client from configuration If StationID is not provided, StationName is used to get it from the API If RainModuleID is not provided, RainModuleName is used to get it from the API For Authentication, AccessToken, RefreshToken, ClientID and ClientSecret are required
func (*Client) GetAverageHighTemperature ¶
GetAverageHighTemperature returns the average daily high temperature between the given time and the end of yesterday (since daily high can be misleading if queried mid-day)
type Config ¶
type Config struct {
StationID string `json:"station_id,omitempty" yaml:"station_id,omitempty" mapstructure:"station_id,omitempty"`
StationName string `json:"station_name,omitempty" yaml:"station_name,omitempty" mapstructure:"station_name,omitempty"`
RainModuleID string `json:"rain_module_id,omitempty" yaml:"rain_module_id,omitempty" mapstructure:"rain_module_id,omitempty"`
RainModuleName string `json:"rain_module_name,omitempty" yaml:"rain_module_name,omitempty" mapstructure:"rain_module_name,omitempty"`
OutdoorModuleID string `json:"outdoor_module_id,omitempty" yaml:"outdoor_module_id,omitempty" mapstructure:"outdoor_module_id,omitempty"`
OutdoorModuleName string `json:"outdoor_module_name,omitempty" yaml:"outdoor_module_name,omitempty" mapstructure:"outdoor_module_name,omitempty"`
Authentication *TokenData `json:"authentication,omitempty" yaml:"authentication,omitempty" mapstructure:"authentication,omitempty"`
ClientID string `json:"client_id,omitempty" yaml:"client_id,omitempty" mapstructure:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty" yaml:"client_secret,omitempty" mapstructure:"client_secret,omitempty"`
}
Config is specific to the Netatmo API and holds all of the necessary fields for interacting with the API. If StationID is not provided, StationName is used to get it from the API If RainModuleID is not provided, RainModuleName is used to get it from the API For Authentication, AccessToken, RefreshToken, ClientID and ClientSecret are required
type TokenData ¶
type TokenData struct {
AccessToken string `json:"access_token,omitempty" yaml:"access_token,omitempty" mapstructure:"access_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty" yaml:"refresh_token,omitempty" mapstructure:"refresh_token,omitempty"`
ExpiresIn int `json:"expires_in,omitempty" yaml:"expires_in,omitempty" mapstructure:"expires_in,omitempty"`
ExpirationDate string `json:"expiration_date,omitempty" yaml:"expiration_date,omitempty" mapstructure:"expiration_date,omitempty"`
}
TokenData contains information returned by Netatmo auth API