weatherflow
weatherflow is a Go module for streaming rapid observations from the
WeatherFlow Tempest API.
Installation
go get -u github.com/tris/weatherflow
Example
import (
"fmt"
"log"
"github.com/tris/weatherflow"
)
func main() {
client := weatherflow.NewClient("your-token-here", nil, log.Printf)
client.AddDevice(12345)
client.Start(func(msg weatherflow.Message) {
switch m := msg.(type) {
case *weatherflow.MessageObsSt:
fmt.Printf("Observation: %+v\n", m)
case *weatherflow.MessageRapidWind:
fmt.Printf("Rapid wind: %+v\n", m)
}
})
time.Sleep(30 * time.Second)
client.Stop()
}
Limitations
- Only Tempest and Rapid Wind observations are passed:
TODO
- Track delayed observations (occasionally the API will emit several
obs_st
in a batch which are up to 10 minutes old)
- Track missing observations
- Track duplicate observations (occasionally the API will emit up to four rapid observations for the same timestamp)
Credit
I took a bit of inspiration from the excellent
goweatherflow module, which
you should use instead if your Tempest is on the same LAN.