wx200

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 11 Imported by: 0

README

Radio Shack WX-200 Electronic Weather Station

Build ReportCard GoDoc License

This project contains the following:

  • Prometheus exporter for WX200 readings (amd64/arm/Docker)
  • Golang library for interfacing with the WX200 via serial communication

Credits

This project could not have been completed without the work of Mike Wingstrom, Glynne Tolar and Tim Witham at wx200.planetfall.com. Their serial protocol mapping (also located here) was invaluable to parsing out the data in a timely manner.

Using the Prometheus exporter

To use the Prometheus exporter, simply download the latest binary from the releases page and run it

./wx200

The following arguments are available

Argument Default Description
--listen-port, -p 9041 Port that metrics server listens on. Metrics available at (<host>:<listen-port>/metrics)
--com-port, -c /dev/ttyUSB0 COM port that the WX200 device is attached
--verbosity, -v info Log level (debug, info, warn)

The exporter can also be run in Docker like so

docker run -d -p 9041:9041 --privileged bartlettc/wx200:v0.1.0 -c /dev/ttyUSB0

The following Grafana dashboard utilizing the Prometheus data can be imported from grafana-dashboard.json

WX200 Grafana Dashboard

Using the WX200 library

Basic example of using the WX200 golang library

import github.com/bartlettc22/wx200/pkg/wx200

...

    // Temperature data will be pushed to this channel
    temperatureDataChan := make(chan wx200.Temperature, 1)
    wx = wx200.New(&wx200.Config{
        ComPortName:         "/dev/ttyUSB0",
        TemperatureDataChan: temperatureDataChan,
    })

    // Starts async reading of serial data from the WX200
    go wx.Go()

    // Process incoming data
    for d := range temperatureDataChan {
        fmt.Printf("Indoor Temp: %d, Outdoor Temp: %d\n", d.Indoor, d.Outdoor)
    }

...

Channels are available for all sensors (see main.go for an more extensive example of how to use it). Also, see the godocs for more information on library.

Notes

  • Only some basic metrics are exposed via the Prometheus exporter but the library can read all of them in
  • There seems to be a mistake in the serial mapping around dew point out of range values. These are hard to reproduce so they may be wrong currently

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL