Skip to content

Influx exporter for EasyWeather weather stations.

License

Notifications You must be signed in to change notification settings

koesie10/ws-upload

Repository files navigation

ws-upload

Influx/MQTT exporter for weather stations running EasyWeather software.

Influenced by Domoticz-PWS-Plugin.

Prerequisites

WSView Plus

You can use the WSView Plus app to set up your weather station to upload data to ws-upload. Follow the instructions below.

  1. Install the WSView Plus app.
  2. Open the app and connect to your weather station.
  3. Select Customized in the menu.
  4. Select Enable.
  5. Select Wunderground for Protocol Type Same As.
  6. Enter the server IP/hostname where ws-upload is running.
  7. Enter the path /api/v1/observe? (including the final question mark).
  8. Enter a station ID. This is an arbitrary string that identifies your weather station. It is used to create the measurement name in InfluxDB. You can use the name of your weather station, for example.
  9. Enter a station key. This is an arbitrary string that is used to authenticate your weather station. This should be as secure as a password. You can use a password generator to create a random string. You will need this key later to configure ws-upload.
  10. Enter the port where ws-upload is running. The default port is 9108.
  11. Set an upload interval
  12. Click on Save.
Older instructions for WS View or WS Tool

See this section on the Domoticz-PWS-Plugin page.

Installation

Docker

The easiest way to run ws-upload is by using Docker. You can use the following command to run ws-upload:

docker run -d \
  --name ws-upload \
  -p 9108:9108 \
  -e STATION_PASSWORD=your_station_key \
  --restart unless-stopped \
  ghcr.io/koesie10/ws-upload:latest \
  server

Replace your_station_key with the station key you entered in the WSView Plus app.

Manual

Binaries are available on the releases page.

Configuration

All options are available as environment variables and as flags. Flags take precedence over environment variables.

Usage:
  ws-upload server [flags]

Flags:
      --addr string                                       the address for the HTTP server to listen on (environment ADDR) (default ":9108")
      --enable-influx-debug                               enable influx debug output (environment ENABLE_INFLUX_DEBUG)
      --enable-json-debug                                 enable json debug output (environment ENABLE_JSON_DEBUG)
  -h, --help                                              help for server
      --influx-addr string                                InfluxDB HTTP address, set empty to disable (environment INFLUX_ADDR) (default "http:https://localhost:8086")
      --influx-auth-token string                          InfluxDB auth token, use username:password for InfluxDB 1.8 (environment INFLUX_AUTH_TOKEN)
      --influx-bucket string                              InfluxDB bucket, set to database/retention-policy or database for InfluxDB 1.8 (environment INFLUX_BUCKET) (default "weather")
      --influx-measurement-name string                    InfluxDB measurement name (environment MEASUREMENT_NAME) (default "weather")
      --influx-organization string                        InfluxDB organization, do not set if using InfluxDB 1.8 (environment INFLUX_ORGANIZATION)
      --mqtt-brokers strings                              MQTT broker addresses, leave empty to disable (environment MQTT_BROKERS) (default [tcp:https://127.0.0.1:1883])
      --mqtt-client-id string                             MQTT client ID, default will be autogenerated based on the client hostname (environment MQTT_CLIENT_ID)
      --mqtt-debug                                        whether to enable debug logging (environment MQTT_DEBUG)
      --mqtt-home-assistant-device-identifiers strings    HomeAssistant identifiers (environment MQTT_HOMEASSISTANT_DEVICE_IDENTIFIERS)
      --mqtt-home-assistant-device-manufacturer string    HomeAssistant manufacturer (environment MQTT_HOMEASSISTANT_DEVICE_MANUFACTURER)
      --mqtt-home-assistant-device-model string           HomeAssistant model (environment MQTT_HOMEASSISTANT_DEVICE_MODEL)
      --mqtt-home-assistant-device-name string            HomeAssistant name (environment MQTT_HOMEASSISTANT_DEVICE_NAME)
      --mqtt-home-assistant-device-prefix string          HomeAssistant device prefix (environment MQTT_HOMEASSISTANT_DEVICE_PREFIX) (default "weatherstation_")
      --mqtt-home-assistant-discovery-enabled             whether HomeAssistant MQTT discovery is enabled (environment MQTT_HOMEASSISTANT_DISCOVERY_ENABLED) (default true)
      --mqtt-home-assistant-discovery-interval duration   HomeAssistant MQTT discovery interval (environment MQTT_HOMEASSISTANT_DISCOVERY_INTERVAL) (default 30s)
      --mqtt-home-assistant-discovery-prefix string       HomeAssistant MQTT discovery prefix (environment MQTT_HOMEASSISTANT_DISCOVERY_PREFIX) (default "homeassistant")
      --mqtt-home-assistant-discovery-qos int             HomeAssistant MQTT discovery QoS (environment MQTT_HOMEASSISTANT_DISCOVERY_QOS) (default 1)
      --mqtt-home-assistant-unique-id string              HomeAssistant unique ID prefix (environment MQTT_HOMEASSISTANT_UNIQUE_ID_PREFIX)
      --mqtt-password string                              MQTT password (environment MQTT_PASSWORD)
      --mqtt-qos int                                      the QoS to send the messages at (environment MQTT_QOS)
      --mqtt-topic string                                 topic to publish to (environment MQTT_TOPIC) (default "homeassistant/sensor/sensorWeatherStation/state")
      --mqtt-username string                              MQTT username (environment MQTT_USERNAME)
  -p, --station-password string                           the station password that will be accepted (environment STATION_PASSWORD)

Typical configuration

A typical configuration using environment variables when publishing to both InfluxDB and Home Assistant (via MQTT) might look like this:

INFLUX_ADDR=http:https://influxdb:8086
INFLUX_BUCKET=weather
MQTT_BROKERS=tcp:https://192.168.123.132:1883
MQTT_HOMEASSISTANT_DEVICE_IDENTIFIERS=C2:ED:6C:F6:D5:D0
MQTT_HOMEASSISTANT_DEVICE_MANUFACTURER=Eurochron
MQTT_HOMEASSISTANT_DEVICE_MODEL=WH2900
MQTT_HOMEASSISTANT_DEVICE_NAME=Weather Station
MQTT_HOMEASSISTANT_DISCOVERY_INTERVAL=5m
MQTT_HOMEASSISTANT_UNIQUE_ID_PREFIX=wh2900_
MQTT_USERNAME=your_mqtt_username
MQTT_PASSWORD=your_mqtt_password
STATION_PASSWORD=your_station_key