Get-WeatherLinkData.ps1

We’ve had a Davis Instruments Vantage Vue weather station on the roof for some time now, and with the addition of the “WeatherLinkIP datalogger” its data is uploaded to the greater Davis WeatherLink platform automatically.

Their service is subscription-based, and we’ve not seen sufficient value in giving them ~AUD5/month to have access to the historical data, so we’re stuck on the quasi “real-time only” free tier.

We happen to use the free version of Paessler’s PRTG Network Monitor to monitor all we have here, and it recently occurred to Rocky to see if we could capture the weather station’s data as well. Turns out that’s a YES.

“Get-WeatherLinkData.ps1”

Features

  • It reports in Imperial measurements by default. Add the ‘-metric’ switch for km/h and ℃
  • The output format defaults to PRTG. Add the ‘-OutputFormat’ switch followed by either ‘csv’ or ‘object’ for those formats instead
  • Want to see the output saved to a file? Add the ‘-Filename’ switch followed by a filename
  • Just in case the network connection to the weather station is a bit iffy, it makes 5 attempts per run of the script to get a good read. Run the script with a ‘-retries <n>’ value to set a different value
  • The output data from the weather station has a CRC value. The script tests this and only reports success=true if it decodes correctly.


Here’s what it looks like on screen. This image shows 3 runs with the different output formats.

Add it to PRTG

First, download the script and copy it to the Custom Sensors directory on your PRTG Server. (C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML) The Github link to the script is at the bottom of this page.

Then in the PRTG Web Interface, right-click where you want to add the Weather Station and select “Add Device”. You only need to fill in the “Device Name” and “IPv4 Address/DNS Name” of your weather station.

Now add a sensor to your new device. The sensor type is “EXE/Script Advanced”.

Give your sensor a name and select the script from the EXE/Script dropdown.

In the Parameters field, add whatever parameters are relevant for your environment. At the very least, you will need the IP address for your weather station. Most of the civilised world will also need to add the -Metric parameter.

You can leave all the other settings as they are and click “Create”.

It will take a minute before the script fires and collects its first set of data.

The Question Mark Icon will turn to a green tick once it has some data.

Now you can click on your new sensor and view your data.

Making it pretty

The system is now fully functional, but looking at the chart the weather is looking a little bit wild, with Armageddon striking at about 1pm. In reality, the weather was actually very stable. Auto scaling is making the graph is a bit misleading. I made a few changes within PRTG in order to stop the graphs auto-scaling and make them a little easier to interpret.

On the “Sensor Overview” page, click on each of the channels in turn to edit the channel settings. The settings we are after are at the bottom of this screen. We will change “Decimal Places” and “Vertical Axis Scaling”.

These are the numbers that I came up with that seem to work here in Sydney. Of course, the best numbers to use may differ, depending on your climate. Consider these a starting point.

Metric Imperial
Decimal Vert Min Vert Max Decimal Vert Min Vert Max
Temperature 1 0°C 50°C 1 20°F 120°F
Humidity 0 0% 100% 0 0% 100%
Wind 0 0 km/h 100 km/h 0 0 mph 60 mph
Barometer 2 1000 hPa 1030 hPa 3 29 inches Hg 30 inches Hg
Rain 1 0 mm/h 100 mm/h 2 0 inches/h 4 inches/h

You should now end up with a relatively neat chart tracking your weather conditions. Now when the wild weather hits, you will definitely know about it.

 

References

Download

The script lives at GitHub: https://github.com/greiginsydney/Get-WeatherLinkData

Revision History

12th February 2020: this is the initial release.

– G & R.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.