beater

package
v7.6.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

* API documentation: https://dev.netatmo.com/resources/technical/reference/weatherstation/getstationsdata

Index

Constants

View Source
const (
	UriPathPublicData = "/api/getpublicdata"
)
View Source
const (
	UriPathStation = "/api/getstationsdata"
)

Variables

This section is empty.

Functions

func New

func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error)

Creates beater

Types

type Dashboard_data

type Dashboard_data struct {
	AbsolutePressure float32 `json:"AbsolutePressure"`
	Time_utc         int64   `json:"time_utc"`
	Noise            float32 `json:"Noise"`
	Temperature      float32 `json:"Temperature"`
	Temp_trend       string  `json:"temp_trend"`
	Humidity         float32 `json:"Humidity"`
	Pressure         float32 `json:"Pressure"`
	Pressure_trend   string  `json:"pressure_trend"`
	CO2              float32 `json:"CO2"`
	Date_max_temp    int     `json:"date_max_temp"`
	Date_min_temp    int     `json:"date_min_temp"`
	Min_temp         float32 `json:"min_temp"`
	Max_temp         float32 `json:"max_temp"`
}

type Device

type Device struct {
	Device_id         string         `json:"_id"`
	Cipher_id         string         `json:"cipher_id"`
	Last_status_store int            `json:"last_status_store"`
	Modules           []Module       `json:"modules"`
	Place             Place          `json:"place"`
	Station_name      string         `json:"station_name"`
	Type              string         `json:"type"`
	Dashboard_data    Dashboard_data `json:"dashboard_data"`
	Data_type         []string       `json:"data_type"`
	Co2_calibrating   bool           `json:"co_2_calibrating"`
	Date_setup        int            `json:"date_setup"`
	Last_setup        int            `json:"last_setup"`
	Module_name       string         `json:"module_name"`
	Firmware          int            `json:"firmware"`
	Last_upgrade      int            `json:"last_upgrade"`
	Wifi_status       int            `json:"wifi_status"`
}

type Measure

type Measure struct {
	Res            map[string][]float32 `json:"res"`
	Mes_type       []string             `json:"type"`
	Rain_60min     float32              `json:"rain_60min"`    //"rain_60min": 0
	Rain_24h       float32              `json:"rain_24h"`      //"rain_24h": 1.515
	Rain_live      float32              `json:"rain_live"`     //"rain_live": 0
	Rain_timestamp int                  `json:"rain_timeutc"`  //"rain_timeutc": 1504796338
	Wind_strength  float32              `json:"wind_strength"` //"wind_strength": 18
	Wind_angle     int                  `json:"wind_angle"`    //"wind_angle": 335
	Gust_strength  int                  `json:"gust_strength"` //"gust_strength": 33
	Gust_angle     int                  `json:"gust_angle"`    //"gust_angle": 341
	Wind_timestamp int                  `json:"wind_timeutc"`  //"wind_timeutc": 1504796344
}

type Module

type Module struct {
	Module_id            string               `json:"_id"`
	Type                 string               `json:"type"`
	Last_message         int64                `json:"last_message"`
	Last_seen            int64                `json:"last_seen"`
	ModuleDashboard_data ModuleDashboard_data `json:"dashboard_data"`
	Data_type            []string             `json:"data_type"`
	Module_name          string               `json:"module_name"`
	Last_setup           int                  `json:"last_setup"`
	Battery_vp           int                  `json:"battery_vp"`
	Battery_percent      int                  `json:"battery_percent"`
	Rf_status            int                  `json:"rf_status"`
	Firmware             int                  `json:"firmware"`
}

type ModuleDashboard_data

type ModuleDashboard_data struct {
	Time_utc      int     `json:"time_utc"`
	Temperature   float32 `json:"Temperature"`
	Temp_trend    string  `json:"temp_trend"`
	Humidity      float32 `json:"Humidity"`
	Date_max_temp int64   `json:"date_max_temp"`
	Date_min_temp int64   `json:"date_min_temp"`
	Min_temp      float32 `json:"min_temp"`
	Max_temp      float32 `json:"max_temp"`
}

type Netatmobeat

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

func (*Netatmobeat) GetAccessToken

func (bt *Netatmobeat) GetAccessToken() error

func (*Netatmobeat) GetRegionData

func (bt *Netatmobeat) GetRegionData(region config.Region) error

* access_token yes * lat_ne yes 15 latitude of the north east corner of the requested area. -85 <= lat_ne <= 85 and lat_ne>lat_sw * lon_ne yes 20 Longitude of the north east corner of the requested area. -180 <= lon_ne <= 180 and lon_ne>lon_sw * lat_sw yes -15 latitude of the south west corner of the requested area. -85 <= lat_sw <= 85 * lon_sw yes -20 Longitude of the south west corner of the requested area. -180 <= lon_sw <= 180 * required_data no rain, humidity To filter stations based on relevant measurements you want (e.g. rain will only return stations with rain gauges). Default is no filter. You can find all measurements available on the Thermostat page. * filter no true True to exclude station with abnormal temperature measures. Default is false.

func (*Netatmobeat) GetStationsData

func (bt *Netatmobeat) GetStationsData(stationID string) error

func (*Netatmobeat) RefreshAccessToken

func (bt *Netatmobeat) RefreshAccessToken() error

Endpoint: https://api.netatmo.com/oauth2/token

func (*Netatmobeat) Run

func (bt *Netatmobeat) Run(b *beat.Beat) error

func (*Netatmobeat) Stop

func (bt *Netatmobeat) Stop()

func (*Netatmobeat) TransformPublicData

func (bt *Netatmobeat) TransformPublicData(data PublicData, regionName string, regionDescription string) []common.MapStr

func (*Netatmobeat) TransformStationData

func (bt *Netatmobeat) TransformStationData(data StationsData) []common.MapStr

type Place

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

type PublicData

type PublicData struct {
	Stations   []PublicStation `json:"body"`
	Status     string          `json:"status"`
	TimeExec   float32         `json:"time_exec"`
	TimeServer int             `json:"time_server"`
}

type PublicStation

type PublicStation struct {
	StationId string             `json:"_id"`
	Place     Place              `json:"place"`
	Mark      int                `json:"mark"`
	Measures  map[string]Measure `json:"measures"`
	Modules   []string           `json:"modules"`
}

type ResponseOauth2Token

type ResponseOauth2Token struct {
	Access_token  string   `json:"access_token"`
	Refresh_token string   `json:"refresh_token"`
	Scope         []string `json:"scope"`
	Expires_in    int      `json:"expires_in"`
	Expire_in     int      `json:"expire_in"`
	LastAuthTime  int64
}

type StationsData

type StationsData struct {
	Body struct {
		Devices     []Device `json:"devices"`
		User        User     `json:"user"`
		Status      string   `json:"status"`
		Time_exec   float32  `json:"time_exec"`
		Time_server int64    `json:"time_server"`
	}
}

type User

type User struct {
	Mail           string `json:"mail"`
	Administrative struct {
		Lang           string `json:"lang"`
		Reg_locale     string `json:"reg_locale"`
		Country        string `json:"country"`
		Unit           int    `json:"unit"`
		Windunit       int    `json:"windunit"`
		Pressureunit   int    `json:"pressureunit"`
		Feel_like_algo int    `json:"feel_like_algo"`
	}
}

Jump to

Keyboard shortcuts

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