Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TargetMeasurements = []string{"Temperature", "CO2", "Humidity", "Pressure", "Noise", "WindStrength", "WindAngle",
"GustStrength", "GustAngle"}
TargetMeasurements defines list of target measurement attributes.
Functions ¶
This section is empty.
Types ¶
type Administrative ¶
type Administrative struct { Language string `json:"lang"` // user locale DisplayLocale string `json:"reg_locale"` // user regional preferences (used for displaying date) Country string `json:"country"` // user country Unit int `json:"unit"` // 0 -> metric system, 1 -> imperial system WindUnit int `json:"windunit"` // 0 -> kph, 1 -> mph, 2 -> ms, 3 -> beaufort, 4 -> knot PressureUnit int `json:"pressureunit"` // 0 -> mbar, 1 -> inHg, 2 -> mmHg FeelLikeAlgorithm int `json:"feel_like_algo"` // algorithm used to compute feel like temperature, 0 -> humidex, 1 -> heat-index }
Administrative defines user administrative attributes.
func (*Administrative) DescribeFeelLikeAlgorithm ¶
func (a *Administrative) DescribeFeelLikeAlgorithm() string
DescribeFeelLikeAlgorithm describes identifier of algorithm used to compute feel like temperature.
func (*Administrative) DescribePressureUnit ¶
func (a *Administrative) DescribePressureUnit() string
DescribePressureUnit describes pressure unit identifier.
func (*Administrative) DescribeUnit ¶
func (a *Administrative) DescribeUnit() string
DescribeUnit describes unit identifier.
func (*Administrative) DescribeWindUnit ¶
func (a *Administrative) DescribeWindUnit() string
DescribeWindUnit describes wind unit identifier.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements Netatmo API client.
func NewClient ¶
func NewClient(ctx context.Context, clientID, clientSecret, username, password string) (*Client, error)
NewClient will creates Netatmo client object.
func (*Client) GetMeasureByNewest ¶
GetMeasureByNewest gathers newest measure data. Reference: https://dev.netatmo.com/en-US/resources/technical/reference/common/getmeasure
func (*Client) GetMeasureByTimeRange ¶
func (c *Client) GetMeasureByTimeRange(deviceID, moduleID string, begin, end int64) ([]Measure, error)
GetMeasureByTimeRange gathers measure data by specified time window. Reference: https://dev.netatmo.com/en-US/resources/technical/reference/common/getmeasure
func (*Client) GetStationsData ¶
GetStationsData gathers station data from Netatmo API. Reference: https://dev.netatmo.com/en-US/resources/technical/reference/weather/getstationsdata
type DashboardData ¶
type DashboardData struct { UTCTime int64 `json:"time_utc"` Temperature *float64 // Nullable MinTemperature *float64 `json:"min_temp"` // Nullable MaxTemperature *float64 `json:"max_temp"` // Nullable MinTemperatureTime *int64 `json:"date_min_temp"` // Nullable MaxTemperatureTime *int64 `json:"date_max_temp"` // Nullable TemperatureTrend *string `json:"temp_trend"` // Nullable CO2 *int // Nullable Humidity *int // Nullable Noise *int // Nullable Pressure *float64 // Nullable AbsolutePressure *float64 // Nullable PressureTrend *string `json:"pressure_trend"` // Nullable Rain *float64 // Nullable RainPerHour *float64 `json:"sum_rain_1"` // Nullable RainPerDay *float64 `json:"sum_rain_24"` // Nullable GustAngle *int // Nullable GustStrength *int // Nullable WindAngle *int // Nullable WindStrength *int // Nullable MaxWindStrength *int `json:"max_wind_str"` // Nullable MaxWindStrengthTime *int64 `json:"date_max_wind_str"` // Nullable HealthIndex *int `json:"health_idx"` // Nullable }
DashboardData defines newest measured data gathered by device or module.
type Device ¶
type Device struct { ID string `json:"_id"` CipherID string `json:"cipher_id"` SetupTime int64 `json:"date_setup"` LastSetupTime int64 `json:"last_setup"` Type string `json:"type"` LastStatusStoreTime int64 `json:"last_status_store"` ModuleName string `json:"module_name"` Firmware int `json:"firmware"` LastUpgradeTime int64 `json:"last_upgrade"` WiFiStatus int `json:"wifi_status"` Reachable bool `json:"reachable"` CO2Calibrating bool `json:"co2_calibrating"` StationName string `json:"station_name"` DataTypes []string `json:"data_type"` Place Place `json:"place"` DashboardData *DashboardData `json:"dashboard_data"` // Nullable Modules []Module `json:"modules"` }
Device defines netatmo device attributes.
type Measure ¶
type Measure struct { DeviceID string ModuleID string Timestamp int64 Temperature *float64 // Nullable CO2 *int // Nullable Humidity *int // Nullable Pressure *float64 // Nullable Noise *int // Nullable WindStrength *int // Nullable WindAngle *int // Nullable GustStrength *int // Nullable GustAngle *int // Nullable }
Measure defines each measurable series.
type Module ¶
type Module struct { ID string `json:"_id"` Type string `json:"type"` ModuleName string `json:"module_name"` DataTypes []string `json:"data_type"` LastSetupTime int64 `json:"last_setup"` Reachable bool `json:"reachable"` Firmware int `json:"firmware"` LastMessageTime int64 `json:"last_message"` LastSeenTime int64 `json:"last_seen"` RFStatus int `json:"rf_status"` BatteryVP int `json:"battery_vp"` BatteryPercent int `json:"battery_percent"` DashboardData *DashboardData `json:"dashboard_data"` // Nullable }
Module defines netatmo module attributes.
type Place ¶
type Place struct { Altitude int `json:"altitude"` City string `json:"city"` // Name of city (ex. 千代田区) Country string `json:"country"` // Country code (ex. JP) Timezone string `json:"timezone"` // TZ Database name (ex. Asia/Tokyo) Location []float64 `json:"location"` // Lat, Lon (ex. 139.752778, 35.682500) }
Place defines place attributes.
type User ¶
type User struct { Mail string `json:"mail"` Administrative Administrative `json:"administrative"` }
User defines user attributes.