Documentation ¶
Overview ¶
Package weatherflow provides a client for accessing WeatherFlow's Smart Weather API over a WebSocket connection.
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
}
Client represents a client for the WeatherFlow Smart Weather API.
func NewClient ¶
NewClient creates a new Client with the given API token, optional connection timeout, and an optional log function (if nil, logs will be discarded).
func (*Client) DeviceCount ¶ added in v0.2.0
DeviceCount returns a count of monitored devices.
func (*Client) RemoveDevice ¶ added in v0.2.0
RemoveDevice unsubscribes from wind events for a device ID.
type Logf ¶
type Logf func(format string, args ...interface{})
Logf is a function type for logging messages in the WeatherFlowClient. This is compatible with e.g. log.Printf.
type Message ¶
func UnmarshalMessage ¶
type MessageAck ¶ added in v0.3.0
func (*MessageAck) GetDeviceID ¶ added in v0.3.1
func (w *MessageAck) GetDeviceID() (int, bool)
func (*MessageAck) GetType ¶ added in v0.3.0
func (w *MessageAck) GetType() string
type MessageConnectionOpened ¶ added in v0.3.0
type MessageConnectionOpened struct {
Type string `json:"type"`
}
func (*MessageConnectionOpened) GetDeviceID ¶ added in v0.3.1
func (w *MessageConnectionOpened) GetDeviceID() (int, bool)
func (*MessageConnectionOpened) GetType ¶ added in v0.3.0
func (w *MessageConnectionOpened) GetType() string
type MessageObsSt ¶
type MessageObsSt struct { Status ObsStStatus `json:"status"` DeviceID int `json:"device_id"` Type string `json:"type"` Source string `json:"source"` Summary ObsStSummary `json:"summary"` Obs []ObsStData `json:"obs"` }
func (*MessageObsSt) GetDeviceID ¶
func (w *MessageObsSt) GetDeviceID() (int, bool)
func (*MessageObsSt) GetType ¶
func (w *MessageObsSt) GetType() string
type MessageRapidWind ¶
type MessageRapidWind struct { DeviceID int `json:"device_id"` SerialNumber string `json:"serial_number"` Type string `json:"type"` HubSN string `json:"hub_sn"` Ob RapidWindData `json:"ob"` }
func (*MessageRapidWind) GetDeviceID ¶
func (w *MessageRapidWind) GetDeviceID() (int, bool)
func (*MessageRapidWind) GetType ¶
func (w *MessageRapidWind) GetType() string
type ObsStData ¶
type ObsStData struct { TimeEpoch int `json:"time_epoch"` WindLull float64 `json:"wind_lull"` WindAvg float64 `json:"wind_avg"` WindGust float64 `json:"wind_gust"` WindDirection int `json:"wind_direction"` WindSampleInterval int `json:"wind_sample_interval"` StationPressure float64 `json:"station_pressure"` AirTemperature *float64 `json:"air_temperature"` RelativeHumidity *float64 `json:"relative_humidity"` Illuminance int `json:"illuminance"` UV int `json:"uv"` SolarRadiation int `json:"solar_radiation"` RainAccumulated float64 `json:"rain_accumulated"` PrecipitationType int `json:"precipitation_type"` LightningStrikeAvgDistance int `json:"lightning_strike_avg_distance"` LightningStrikeCount int `json:"lightning_strike_count"` Battery float64 `json:"battery"` ReportInterval int `json:"report_interval"` LocalDailyRainAccumulation float64 `json:"local_daily_rain_accumulation"` RainAccumulatedFinal float64 `json:"rain_accumulated_final"` LocalDailyRainAccumulationFinal float64 `json:"local_daily_rain_accumulation_final"` PrecipitationAnalysisType int `json:"precipitation_analysis_type"` }
func (*ObsStData) UnmarshalJSON ¶
type ObsStStatus ¶
type ObsStSummary ¶
type ObsStSummary struct { PressureTrend string `json:"pressure_trend"` StrikeCount1h int `json:"strike_count_1h"` StrikeCount3h int `json:"strike_count_3h"` PrecipTotal1h float64 `json:"precip_total_1h"` StrikeLastDist int `json:"strike_last_dist"` StrikeLastEpoch int `json:"strike_last_epoch"` PrecipAccumLocalYesterday float64 `json:"precip_accum_local_yesterday"` PrecipAccumLocalYesterdayFinal float64 `json:"precip_accum_local_yesterday_final"` PrecipAnalysisTypeYesterday int `json:"precip_analysis_type_yesterday"` RainingMinutes []int `json:"raining_minutes"` PrecipMinutesLocalDay int `json:"precip_minutes_local_day"` PrecipMinutesLocalYesterday int `json:"precip_minutes_local_yesterday"` }
type RapidWindData ¶
type RapidWindData struct { TimeEpoch int `json:"time_epoch"` WindSpeed float64 `json:"wind_speed"` WindDirection int `json:"wind_direction"` }
func (*RapidWindData) UnmarshalJSON ¶
func (rw *RapidWindData) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.