davis-wx
Real time consumption of weather data from Davis WeatherLink
Live.
Table of Contents
About
davis-wx is used to consume from a WeatherLink Live (WLL) unit located on a LAN
(local area network). It takes advantage of Davis' live transmission protocol
allowing for updates every 2.5 seconds. It also uses an adaptive protocol by
only sending data when changes have been detected. This minimizes the amount of
data usage while still keeping a fast end-to-end response time.
davis-wx captures live weather data from a WLL unit and pushes it to a Websocket
server.
Building
davis-wx may be fetched using Go get:
go get github.com/thetannerryan/davis-wx
If you prefer to build the application manually, clone this repository and run
go build -o davis-wx
.
Usage
The command below shows the usage of davis-wx:
davis-wx --davis 172.16.0.2 --host websocket.example.com --endpoint /weather --passphrase mysecurepassphrase --secure
Parameters:
davis
: IP address or domain of WLL unit
host
: IP address or domain of receiving Websocket server
endpoint
: URL path/route to Websocket server
passphrase
: Websocket authentication passphrase
secure
: force websocket connection over TLS (WSS)
Running the command will connect this client to the Websocket server (e.g.
wss://websocket.example.com/weather
for example above) and begin uploading
weather data as it is captured from the WLL unit.
Some operating systems may require root/admin privileges to open the UDP socket.
If UDP errors are displayed in the program log, please ensure the program has
appropriate permissions to open a Websocket.
Websocket Protocol
davis-wx does not come with a Websocket server. The Websocket server must
implement a simple protocol:
- Send a Websocket ping control message every 10 seconds.
- The first message sent by davis-wx is the client passphrase. If the server
implements authentication and the passphrase is incorrect, the server must
disconnect the client (davis-wx client). If the server does not implement
authentication, this first message may be ignored.
- Every following message sent is a JSON weather report. The format of the
report may be viewed
here.
- Set a client read deadline (recommended value of 30 seconds). A client
(davis-wx client) must be disconnected if no messages are received by the
server within the read deadline.
License
Copyright (c) 2020 Tanner Ryan. All rights reserved. Use of this source code is
governed by a BSD-style license that can be found in the LICENSE file.
The Gorilla Websocket package is under a BSD 2-clause license. Cenk Alti's Go
exponential backoff package is under an MIT license. Once again, all rights
reserved.