netatgo

package module
v0.0.0-...-f61ca24 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 7 Imported by: 0

README

Netatgo

An unofficial (and incomplete) client for the Netatmo API

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

func (APIError) Error

func (err APIError) Error() string

type Administrative

type Administrative struct {
	Lang         string `json:"lang"`
	RegLocale    string `json:"reg_locale"`
	Country      string `json:"country"`
	Unit         int64  `json:"unit"`
	Windunit     int64  `json:"windunit"`
	Pressureunit int64  `json:"pressureunit"`
	FeelLikeAlgo int64  `json:"feel_like_algo"`
}

type Body

type Body struct {
	Devices []Device `json:"devices"`
	User    User     `json:"user"`
}

type Client

type Client struct {
	HTTPClient *http.Client
}

func NewClientCredentialsClient

func NewClientCredentialsClient(cfg ClientCredentialsConfig) Client

func (Client) GetStationData

func (c Client) GetStationData(ctx context.Context, deviceID string, favorites bool) (GetStationsDataResponse, error)

type ClientCredentialsConfig

type ClientCredentialsConfig struct {
	// ClientID is the application's ID.
	ClientID string

	// ClientSecret is the application's secret.
	ClientSecret string

	Username string

	Password string

	// Scope specifies optional requested permissions.
	Scopes []Scope
}

type Device

type Device struct {
	ID              string              `json:"_id"`
	StationName     string              `json:"station_name"`
	DateSetup       int64               `json:"date_setup"`
	LastSetup       int64               `json:"last_setup"`
	Type            string              `json:"type"`
	LastStatusStore int64               `json:"last_status_store"`
	ModuleName      string              `json:"module_name"`
	Firmware        int64               `json:"firmware"`
	LastUpgrade     int64               `json:"last_upgrade"`
	WifiStatus      int64               `json:"wifi_status"`
	Reachable       bool                `json:"reachable"`
	Co2Calibrating  bool                `json:"co2_calibrating"`
	DataType        []string            `json:"data_type"`
	Place           Place               `json:"place"`
	HomeID          string              `json:"home_id"`
	HomeName        string              `json:"home_name"`
	DashboardData   DeviceDashboardData `json:"dashboard_data"`
	Modules         []Module            `json:"modules"`
}

type DeviceDashboardData

type DeviceDashboardData struct {
	TimeUTC          int64   `json:"time_utc"`
	Temperature      float64 `json:"Temperature"`
	Co2              int64   `json:"CO2"`
	Humidity         int64   `json:"Humidity"`
	Noise            int64   `json:"Noise"`
	Pressure         float64 `json:"Pressure"`
	AbsolutePressure float64 `json:"AbsolutePressure"`
	MinTemp          float64 `json:"min_temp"`
	MaxTemp          int64   `json:"max_temp"`
	DateMaxTemp      int64   `json:"date_max_temp"`
	DateMinTemp      int64   `json:"date_min_temp"`
	TempTrend        string  `json:"temp_trend"`
	PressureTrend    string  `json:"pressure_trend"`
}

type ErrorResponse

type ErrorResponse struct {
	Err APIError `json:"error"`
}

func (ErrorResponse) Error

func (err ErrorResponse) Error() string

type GetStationsDataResponse

type GetStationsDataResponse struct {
	Body       Body    `json:"body"`
	Status     string  `json:"status"`
	TimeExec   float64 `json:"time_exec"`
	TimeServer int64   `json:"time_server"`
}

type Module

type Module struct {
	ID             string              `json:"_id"`
	Type           string              `json:"type"`
	ModuleName     string              `json:"module_name"`
	LastSetup      int64               `json:"last_setup"`
	DataType       []string            `json:"data_type"`
	BatteryPercent int64               `json:"battery_percent"`
	Reachable      bool                `json:"reachable"`
	Firmware       int64               `json:"firmware"`
	LastMessage    int64               `json:"last_message"`
	LastSeen       int64               `json:"last_seen"`
	RFStatus       int64               `json:"rf_status"`
	BatteryVp      int64               `json:"battery_vp"`
	DashboardData  ModuleDashboardData `json:"dashboard_data"`
}

type ModuleDashboardData

type ModuleDashboardData struct {
	TimeUTC        int64    `json:"time_utc"`
	Temperature    *float64 `json:"Temperature,omitempty"`
	Humidity       *int64   `json:"Humidity,omitempty"`
	MinTemp        *float64 `json:"min_temp,omitempty"`
	MaxTemp        *float64 `json:"max_temp,omitempty"`
	DateMaxTemp    *int64   `json:"date_max_temp,omitempty"`
	DateMinTemp    *int64   `json:"date_min_temp,omitempty"`
	TempTrend      *string  `json:"temp_trend,omitempty"`
	Rain           *int64   `json:"Rain,omitempty"`
	SumRain1       *int64   `json:"sum_rain_1,omitempty"`
	SumRain24      *float64 `json:"sum_rain_24,omitempty"`
	Co2            *int64   `json:"CO2,omitempty"`
	WindStrength   *int64   `json:"WindStrength,omitempty"`
	WindAngle      *int64   `json:"WindAngle,omitempty"`
	GustStrength   *int64   `json:"GustStrength,omitempty"`
	GustAngle      *int64   `json:"GustAngle,omitempty"`
	MaxWindStr     *int64   `json:"max_wind_str,omitempty"`
	MaxWindAngle   *int64   `json:"max_wind_angle,omitempty"`
	DateMaxWindStr *int64   `json:"date_max_wind_str,omitempty"`
}

type Place

type Place struct {
	Altitude int64     `json:"altitude"`
	City     string    `json:"city"`
	Country  string    `json:"country"`
	Timezone string    `json:"timezone"`
	Location []float64 `json:"location"`
}

type Scope

type Scope = string
const (
	ReadStation Scope = "read_station" //: to retrieve weather station data (Getstationsdata, Getmeasure)

	ReadThermostats Scope = "read_thermostat" //: to retrieve thermostat data ( Homestatus, Getroommeasure...)

	WriteSThermostat Scope = "write_thermostat" //: to set up the thermostat (Synchomeschedule, Setroomthermpoint...)

	ReadCamera Scope = "read_camera" //: to retrieve Smart Indoor Cameradata (Gethomedata, Getcamerapicture...)

	WriteCamera Scope = "write_camera" //: to inform the Smart Indoor Camera that a specific person or everybody has left the Home (Setpersonsaway, Setpersonshome)

	AccessCamera Scope = "access_camera" //: to access the camera, the videos and the live stream *

	ReadPrescene Scope = "read_presence" //: to retrieve Smart Outdoor Camera data (Gethomedata, Getcamerapicture...)

	AccessPresence Scope = "access_presence" //: to access the camera, the videos and the live stream *

	ReadSmokedetector Scope = "read_smokedetector " //: to retrieve the Smart Smoke Alarm informations and events (Gethomedata, Geteventsuntil...)

	ReadHomecoach Scope = "read_homecoach" //: to read data coming from Smart Indoor Air Quality Monitor (gethomecoachsdata)

)

type User

type User struct {
	Mail           string         `json:"mail"`
	Administrative Administrative `json:"administrative"`
}

Jump to

Keyboard shortcuts

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