Documentation ¶
Index ¶
- type Client
- type Report
- func (r *Report) Copy() (*Report, error)
- func (r *Report) Decode(payload []byte) error
- func (r *Report) Encode() []byte
- func (r *Report) JSON() []byte
- func (r *Report) UpdateHTTP(new *parser.ConditionsHTTP) error
- func (r *Report) UpdateJSON(payload []byte) error
- func (r *Report) UpdateUDP(new *parser.ConditionsUDP) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Notify <-chan bool // Notify emits a bool when a new weather report is generated // contains filtered or unexported fields }
Client is the Davis weather client.
func Managed ¶
Managed returns a managed Davis weather client. It accepts a context for cancelling the Client. It automatically discovers the WeatherLink Live (WLL) unit on the local network. If multicast DNS is disabled on the network, use the unmanaged client. It returns a new client for consuming weather data. Verbose enables Client logging.
func Unmanaged ¶
Unmanaged returns an unmanaged Davis weather client. It accepts a context for cancelling the Client and a hostname (IP or domain) and port of the WeatherLink Live (WLL) unit. It returns a new client for consuming weather data. It returns an error if no hostname is provided. Verbose enables Client logging.
type Report ¶
type Report struct { DeviceID string `json:"deviceID"` // DeviceID is unique device ID Timestamp time.Time `json:"timestamp"` // Timestamp is the time the Report was last modified Temperature *float64 `json:"temperature"` // Temperature (°F) Humidity *float64 `json:"humidity"` // Humidity (%RH) Dewpoint *float64 `json:"dewpoint"` // Dewpoint (°F) Wetbulb *float64 `json:"wetbulb"` // Wetbulb (°F) HeatIndex *float64 `json:"heatindex"` // HeatIndex (°F) WindChill *float64 `json:"windchill"` // WindChill (°F) THWIndex *float64 `json:"thwIndex"` // THWIndex is "feels like" (°F) THSWIndex *float64 `json:"thswIndex"` // THWSIndex is "feels like" including solar (°F) WindSpeedLast *float64 `json:"windSpeedLast"` // WindSpeedLast is most recent wind speed (mph) WindDirLast *float64 `json:"windDirLast"` // WindDirLast is most recent wind direction (°) WindSpeedAvgLast1Min *float64 `json:"windSpeedAvg1Min"` // WindSpeedAvgLast1Min is average wind over last minute (mph) WindDirAvgLast1Min *float64 `json:"windDirAvg1Min"` // WindDirAvgLast1Min is average wind direction over last minute (°) WindSpeedAvgLast2Min *float64 `json:"windSpeedAvg2Min"` // WindSpeedAvgLast2Min is average wind over last 2 minutes (mph) WindDirAvgLast2Min *float64 `json:"windDirAvg2Min"` // WindDirAvgLast2Min is average wind direction over last 2 minutes (°) WindSpeedHighLast2Min *float64 `json:"windGustSpeedLast2Min"` // WindSpeedHighLast2Min is max gust over last 2 minutes (mph) WindDirAtHighLast2Min *float64 `json:"windGustDirLast2Min"` // WindDirAtHighLast2Min is max gust direction over last 2 minutes (°) WindSpeedAvgLast10Min *float64 `json:"windSpeedAvg10Min"` // WindSpeedAvgLast10Min is average wind over last 10 minutes (mph) WindDirAvgLast10Min *float64 `json:"windDirAvg10Min"` // WindDirAvgLast10Min is average wind dir over last 10 minutes (°) WindSpeedHighLast10Min *float64 `json:"windGustSpeedLast10Min"` // WindSpeedHighLast10Min is max gust over last 10 minutes (mph) WindDirAtHighLast10Min *float64 `json:"windGustDirLast10Min"` // WindDirAtHighLast10Min is max gust direction over last 10 minutes (°) RainSize *float64 `json:"rainSize"` // RainSize is size of rain collector (1: 0.01", 2: 0.2mm) RainRateLast *float64 `json:"rainRateLast"` // RainRateLast is most recent rain rate (count/hour) RainRateHigh *float64 `json:"rainRateHigh"` // RainRateHigh is highest rain rate over last minute (count/hour) RainLast15Min *float64 `json:"rainLast15Min"` // RainLast15Min is rain count in last 15 minutes (count) RainRateHighLast15Min *float64 `json:"rainRateHighLast15Min"` // RainRateHighLast15Min is highest rain count rate over last 15 minutes (count/hour) RainLast60Min *float64 `json:"rainLast60Min"` // RainLast60Min is rain count over last 60 minutes (count) RainLast24Hour *float64 `json:"rainLast24Hour"` // RainLast24Hour is rain count over last 24 hours (count) RainStorm *float64 `json:"rainStorm"` // RainStorm is rain since last 24 hour break in rain (count) RainStormStartAt *time.Time `json:"rainStormStart"` // RainStormStartAt is time of rain storm start SolarRad *float64 `json:"solarRad"` // SolarRad is solar radiation (W/m²) UVIndex *float64 `json:"uvIndex"` // UVIndex is solar UV index RXState string `json:"signal"` // RXState is ISS receiver status TransBatteryFlag string `json:"battery"` // TransBatteryFlag is ISS battery status RainfallDaily *float64 `json:"rainDaily"` // RainfallDaily is total rain since midnight (count) RainfallMonthly *float64 `json:"rainMonthly"` // RainfallMonthly is total rain since first of month (count) RainfallYear *float64 `json:"rainYear"` // RainfallYear is total rain since first of year (count) RainStormLast *float64 `json:"rainStormLast"` // RainStormLast is rain since last 24 hour break in rain (count) RainStormLastStartAt *time.Time `json:"rainStormLastStart"` // RainStormLastStartAt is time of last rain storm start RainStormLastEndAt *time.Time `json:"rainStormLastEnd"` // rainStormLastEndAt is time of last rain storm end BarometerSeaLevel *float64 `json:"barometerSeaLevel"` // BarometerSeaLevel is barometer reading with elevation adjustment (inches) BarometerTrend *float64 `json:"barometerTrend"` // BarometerTrend is 3 hour barometric trend (inches) BarometerAbsolute *float64 `json:"barometerAbsolute"` // BarometerAbsolute is barometer reading at current elevation (inches) TemperatureIndoor *float64 `json:"indoorTemperature"` // TemperatureIndoor is indoor temp (°F) HumidityIndoor *float64 `json:"indoorHumidity"` // HumidityIndoor is indoor humidity (%) DewPointIndoor *float64 `json:"indoorDewpoint"` // DewPointIndoor is indoor dewpoint (°F) HeatIndexIndoor *float64 `json:"indoorHeatIndex"` // HeatIndexIndoor is indoor heat index (°F) // contains filtered or unexported fields }
Report is the latest weather report.
func NewReport ¶
NewReport returns a new Report state and a notification channel. The channel emits a bool when the Report contents have been modified. Verbose enables Report logging.
func (*Report) Copy ¶
Copy generates and returns a new deep copy of the Report state. It returns an error if the copy operation fails.
func (*Report) Decode ¶
Decode updates the Report using a zlib encoded weather report. It returns an error if the provided payload is not valid.
func (*Report) JSON ¶
JSON returns the JSON representation of the Report state and the Report was last updated.
func (*Report) UpdateHTTP ¶
func (r *Report) UpdateHTTP(new *parser.ConditionsHTTP) error
UpdateHTTP atomically updates the Report state using weather conditions retrieved over HTTP. It returns an error if the atomic update action fails.
func (*Report) UpdateJSON ¶
UpdateJSON atomically updates the Report state using a provided JSON payload. It returns an error if the JSON does not match the Report structure or if the atomic update action fails.