https://github.com/tris/weatherflow
Go module for streaming observations from the WeatherFlow Tempest API
https://github.com/tris/weatherflow
Last synced: about 1 year ago
JSON representation
Go module for streaming observations from the WeatherFlow Tempest API
- Host: GitHub
- URL: https://github.com/tris/weatherflow
- Owner: tris
- License: mit
- Created: 2023-04-18T00:52:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T01:05:22.000Z (over 1 year ago)
- Last Synced: 2025-04-02T14:25:26.903Z (about 1 year ago)
- Language: Go
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# weatherflow
weatherflow is a Go module for streaming rapid observations from the
[WeatherFlow Tempest API](https://weatherflow.github.io/Tempest/).
## Installation
```
go get -u github.com/tris/weatherflow
```
## Example
```go
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:
- [ ] Acknowledgement (ack)
- [ ] Rain Start Event (evt_precip)
- [ ] Lightning Strike Event (evt_strike)
- [ ] Device Online Event (evt_device_online)
- [ ] Device Offline Event (evt_device_offline)
- [ ] Station Online Event (evt_station_online)
- [ ] Station Offline Event (evt_station_online)
- [x] Rapid Wind (3 sec) (rapid_wind)
- [ ] Observation (Air) (obs_air)
- [ ] Observation (Sky) (obs_sky)
- [x] Observation (Tempest) (obs_st)
## 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](https://github.com/gregorosaurus/goweatherflow) module, which
you should use instead if your Tempest is on the same LAN.