[LINUX] WeatherFlow Tempest UDP Relay

WeatherFlow Tempest UDP Relay

A fast and efficient UDP relay service designed to receive WeatherFlow Tempest locally broadcasted UDP JSON data, optionally repackage it into the Ecowitt format, and then POST it to Hubitat for consumption.

Features

  • LAN communication only, no cloud/weather service needed.
  • Entirely written in C++ with no dependencies, external libraries or additional packages to install.
  • Small, fast, efficient and highly asynchronous with non-blocking I/O and multithreaded queue.
  • Designed to leverage existing Hubitat driver infrastructure by emulating WeatherFlow REST API or Ecowitt protocols.

Installation Instructions

  • Copy the single tempest executable to your host (PC, VM, RPi etc.)

  • Make sure the file is executable. If you are using Linux run the following command:

    chmod +x tempest
    
  • If the host running the relay has a firewall, don't forget to open incoming port UPD 50222. If, for example, you are using UFW, you can use the following command:

    sudo ufw allow 50222/udp
    
  • Run the executable with the appropriate arguments:

    Usage:        tempest [OPTIONS]
    
    Commands:
    
    Start:        tempest --url=<url> [--format=<fmt>] [--interval=<min>]
                          [--log=<lev>] [--daemon]
    Trace:        tempest --trace [--format=<fmt>] [--interval=<min>]
                          [--log=<lev>]
    Stop:         tempest --stop
    Stats:        tempest --stats
    Version:      tempest --version
    Help:         tempest [--help]
    
    Options:
    
    -u | --url=<url>      full URL to relay data to
    -f | --format=<fmt>   format to which the UDP data is repackaged:
                          1) REST API, 2) Ecowitt (default if omitted: 2)
    -i | --interval=<min> interval in minutes at which data is relayed:
                          1 <= min <= 30 (default if omitted: 5)
    -l | --log=<lev>      1) only errors
                          2) errors and warnings
                          3) errors, warnings and info (default if omitted)
                          4) errors, warnings, info and debug (everything)
    -d | --daemon         run as a background daemon
    -t | --trace          relay data to the terminal standard output
                          (if both --format and --interval are omitted
                          the source UDP JSON will be traced instead)
    -s | --stop           stop the relay and exit gracefully
    -x | --stats          print relay statistics
    -v | --version        print version information
    -h | --help           print this help
    
    Examples:
    
    tempest --url=http://hubitat.local:39501 --format=2 --interval=5 --daemon
    tempest -u=192.168.1.100:39500 -l=2 -d
    tempest --stop
    

Note to Developers

This application has been developed on a Windows 10 system with Visual Studio Code connected to a WSL2 instance running vanilla Debian 10.5 with the following development packages installed:

sudo apt install build-essential gdb git libcurl4-openssl-dev

To build your own executable from source, clone the repository and run one of the following:

make release

or

make debug

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3 Likes

:loudspeaker:

v0.1.1-alpha pushed to github :

  • very very early release just for testing. Only capable of capturing UDP JSON data and dumping it to the console

All the pieces are in place: argument processing, logging, async queue, multithreaded I/O, cURL and JSON parser. Just need to glue everything together now.

The current linux executable in the /bin folder, when executed with the following command line:

tempest --trace

will simply run for 5 minutes (unless you hit CTRL-C first), capture all the UDP data and print it to cout.

@dman2306 @augoisms @vreihen, I'm seeing a LOT of data coming from the tempest every few seconds. I just installed my station last week. Is this normal? Is this an indication of something wrong? Is it something that can be disabled from the app?

Some of it, like the debug stuff, is completely undocumented. Is it safe to ignore and discard it?

{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542757,20933,1801,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542757,1.03,6]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542760,21188,1813,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542760,1.88,36]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542763,21187,1801,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542763,0.00,0]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542766,21127,1813,0,0]}
{"serial_number":"HB-000XXXXX","type":"hub_status","firmware_revision":"143","uptime":309102,"rssi":-47,"timestamp":1600542766,"reset_flags":"PIN,WDG","seq":30890,"fs":[1,0,15675411,524288],"radio_stats":[22,1,0,3,56815],"mqtt_stats":[10,1]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542766,0.00,0]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542769,20615,1737,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542769,0.00,0]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542772,20488,1727,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542772,0.76,349]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542775,20586,1739,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542775,0.76,329]}
{"serial_number":"HB-000XXXXX","type":"hub_status","firmware_revision":"143","uptime":309112,"rssi":-48,"timestamp":1600542776,"reset_flags":"PIN,WDG","seq":30891,"fs":[1,0,15675411,524288],"radio_stats":[22,1,0,3,56815],"mqtt_stats":[10,1]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542778,20212,1713,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542778,0.72,271]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542781,19734,1650,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542781,3.49,348]}
{"serial_number":"ST-000XXXXX","type":"light_debug","hub_sn":"HB-000XXXXX","ob":[1600542784,19547,1636,0,0]}
{"serial_number":"ST-000XXXXX","type":"rapid_wind","hub_sn":"HB-000XXXXX","ob":[1600542784,0.98,353]}
{"serial_number":"HB-000XXXXX","type":"hub_status","firmware_revision":"143","uptime":309122,"rssi":-46,"timestamp":1600542786,"reset_flags":"PIN,WDG","seq":30892,"fs":[1,0,15675411,524288],"radio_stats":[22,1,0,3,56815],"mqtt_stats":[10,1]}

rapid_wind is sent every 3 seconds, and rapid refers to the frequency of packets and not a wind speed.

Ignore the debug stuff.

Personally, I would focus on the obs_st and forget the others. They are sent every 60 seconds, and would seem to be the best compromise between useful data and swamping the HE with too much data.....

2 Likes

Sorry, I really don’t know much about their apis. I use @augoisms driver.

:loudspeaker:

v1.0.36-beta pushed to github:

Setup:

  • copy the tempest executable to a linux host
  • make sure the file is executable:
    chmod +x tempest
  • make sure port 50222/udp is open if you have a firewall:
    sudo ufw allow 50222/udp
  • make sure your linux host is receiving Tempest UDP broadcast:
    ./tempest --trace
  • to stop tracing press:
    <CTRL> + <C>
  • to start the relay as daemon (replace the hubitat address with your own):
    ./tempest --url=http://hubitat.local:39501 --format=2 --interval=5 --daemon
  • to stop it:
    ./tempest --stop

The relay is using the linux system logging facility. If you run it as a daemon you'll find the log in /var/log/daemon.log otherwise it's logging to /var/log/syslog

Should I see anything on the console when this is running?

If you run it with "tempest --trace" you should see all the broadcasted UDP data.

If you run it with "--url", then no, it will run silently in the background.

Go to the hubitat log and confirm you see warnings of data being received, at which point you need to create a new Ecowitt device and assign it the IP/MAC address of your linux host.

Thanks, that's the part I'm missing. I see logs for the missing device found in hubitat. Thanks!

1 Like

Ok, how do I go about adding a new ecowitt device? My other ecowitt sensors just auto showed up under the gateway. Do I need to add a new gateway device?

I'm assuming you updated to the latest version of the Ecowitt drivers.

Go to Hubitat -> Devices
Upper-right corner of the page click on "Add Virtual Device"
Select "Ecowitt Gateway" from the list and save device
Now go to the newly create device, enter the IP or MAC of your linux host, save the preferences and wait a few minutes :crossed_fingers:

Do I still need my weatherflow driver that gets info from the cloud or can I remove that now? Thank you!

No. You can remove that if you want. My driver only uses local UDP data.

This is how the Tempest should look:

Nice. How did you get your dashboard tiles like that? Thanks for this! I have this running in an ubuntu container on my QNAP NAS. Just have to set it up to auto start the tempest command if the NAS reboots. I need to head out so I'll update that later. But I have it working and it's getting data! Great job! Thank you!

1 Like

See the picture above. Just enter templates: 1A, 4, 7, 8A

1 Like
  • status : Invalid attribute or template for the current sensor

Enable "summer simmer index" and "wind chill factor" in the preferences. Just like the image. Templates are using those to color the icons.

I don't believe I have the air quality sensor, but I'd love to get my rain guage sensor in this dashboard.

Yes, the air quality is coming from my Ecowitt WH41 sensor.

If you tell me which rain attributes you'd like to see in the tile (max 3 or 4) I can write a template and add it to the repository.

Download the Hubitat app