GithubHelp home page GithubHelp logo

bartlettc22 / wx200 Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.13 MB

RadioShack WX200 Weather Station golang library and Prometheus exporter

License: MIT License

Go 91.19% Shell 8.08% Dockerfile 0.73%
wx200 weatherstation radioshack

wx200's Introduction

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

wx200's People

Contributors

bartlettc22 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.