WeatherUnderground to InfluxDB exporter
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.goreleaser.yml
.travis.yml
LICENSE.txt
README.md
influxdb.go
main.go
reflect.go
wu.go

README.md

wu2influxdb

GitHub license GitHub release Build Status codebeat badge Go Report Card

About

Wu2influxdb is a small open source software to periodically pull PWS (Personal WeatherStation) data from Weather Underground and save into InfluxDB time series database.

Typically it is possible to export any data that Weather Underground API provides for any PWS and save into InfluxDB database, optionally charting it in Grafana later on.

JSON attributes that can be polled and saved are (not all make sense to save in InfluxDB however):

  • UV
  • city
  • city
  • conditions
  • country
  • country
  • country_iso3166
  • country_iso3166
  • current_observation
  • dewpoint_c
  • dewpoint_f
  • dewpoint_string
  • display_location
  • elevation
  • elevation
  • estimated
  • features
  • feelslike_c
  • feelslike_f
  • feelslike_string
  • forecast_url
  • full
  • full
  • heat_index_c
  • heat_index_f
  • heat_index_string
  • history_url
  • icon
  • icon_url
  • image
  • latitude
  • latitude
  • link
  • local_epoch
  • local_time_rfc822
  • local_tz_long
  • local_tz_offset
  • local_tz_short
  • longitude
  • longitude
  • magic
  • nowcast
  • ob_url
  • observation_epoch
  • observation_location
  • observation_time
  • observation_time_rfc822
  • precip_1hr_in
  • precip_1hr_metric
  • precip_1hr_string
  • precip_today_in
  • precip_today_metric
  • precip_today_string
  • pressure_in
  • pressure_mb
  • pressure_trend
  • relative_humidity
  • response
  • solarradiation
  • state
  • state
  • state_name
  • station_id
  • temp_c
  • temp_f
  • temperature_string
  • termsofService
  • title
  • url
  • version
  • visibility_km
  • visibility_mi
  • weather
  • wind_degrees
  • wind_dir
  • wind_gust_kph
  • wind_gust_mph
  • wind_kph
  • wind_mph
  • wind_string
  • windchill_c
  • windchill_f
  • windchill_string
  • wmo
  • zip

It is possible to use both native Weather Underground JSON attribute naming and naming from the Golang code. It is also possible to export data with WU JSON attributes field naming or with pretty Golang naming.

Requirements

  • InfluxDB database access with r/w privileges (database name, username, password): use InfluxDBHost, InfluxDBName and InfluxDBPassword parameters
  • Weather Underground API key: APIKey parameter
  • Weather Underground PWS name: PWSName parameter
  • list of WU attributes to import: FieldList parameter

Installation

There are two ways of installing wu2influxdb:

Manual

Download your preferred flavor from the releases page and install manually.

Using go get

go get https://github.com/dkorunic/wu2influxdb

Usage

Usage of wu2influxdb:
  -APIKey string
    	WeatherUnderground API key
  -Debug
    	Dump all WU API responses
  -FieldList string
    	List of WU attributes
  -InfluxDBHost string
    	InfluxDB host name (default "http://localhost:8086")
  -InfluxDBName string
    	InfluxDB database name
  -InfluxDBPassword string
    	InfluxDB password
  -InfluxDBUser string
    	InfluxDB username
  -JsonTags
    	Use WU JSON names for InfluxDB fields (default true)
  -PWSName string
    	PWS Name

Typical use example to poll IZAGREB51 PWS data and import some of the data into InfluxDB weather database is:

wu2influxdb -APIKey XXXXXXXXXXXXXXXX \
  -PWSName IZAGREB51 \
  -FieldList temp_c,dewpoint_c,relative_humidity,pressure_mb,wind_kph,solarradiation,precip_today_metric,precip_1hr_metric \
  -InfluxDBName weather

To debug remote responses, we can use Debug parameter:

wu2influxdb -Debug \
  -APIKey XXXXXXXXXXXXXXXX \
  -PWSName IZAGREB51 \
  -FieldList temp_c,dewpoint_c,relative_humidity,pressure_mb,wind_kph,solarradiation,precip_today_metric,precip_1hr_metric