April 14, 2023

Install Weather34 with WeatherLink

Updated 2023-04-14 !! OK with Bullseye and PHP 8.x !

If You want Your Private Weather Station(PWS) Davis Vantage Pro2, or other Davis products that use WeatherLink, to provide data for the template we use at Domstens Båtklubb just follow the instructions below. 

This is made without additional software such as Cumulus, Weather display or the Meteobridge product.

This application is updated !!, to use the v2 API. Check  this post !!

An example of a WeatherLink, v2 API, dashboard with Node-Red is found here.

The template Weather34(W34) was built so it could get online data from different PWS solutions which should update their respective online files at the W34 web-server. In our case we pull JSON data direct from the WL site and update an online file, type "cumulus", on the W34 web-server. 

The data from the WL site is retrieved with the WL V1 API !!

Install W34 according to the instructions, WEB hosted installation, on a Mac or Raspberry Pi(RPi) install below.

An alternative, which Ken True recommends, is this weather dashboard which also supports other hardware than Davis. But still I think the W34 GUI is the best.

Before You start You must ensure that;
  • You have a registered account at Davis Weatherlinksite(WL)
    • PWS data is pushed to WL
    • PWS data is retrieved from WL
    • PWS data is forwarded to Weather Underground from WL
      • Register in WL "Manage devices => Share & Uploads"
  • You have a registered account at Weather Underground(WU)
    • Forecasts could be retrieved from WU
    • PWS data is pushed to WU
    • Historic PWS data is retrieved from WU
Metar aviation weather data is used for "Current conditions" module 7.
  • Register an account at Checkwx
    • Aviation weather data are retrieved from Checkwx
If you want a forecast alternativ to WU(English)
  • Register an account at "pwsweather.com" Setup here
    • Free API also available
WU API key
If You are supplying WU with Your PWS data You will get a API key for the new API without cost. You can then get a 5 days forecast and historical data, day/month, which is supported with the W34 version issued 2019-05-21.

To start up fresh on the RPi You can follow the instructions here where You install Apache2 and PHP 8.x with Raspberry Pi OS . You must have the "curl" package installed.

Dark Sky
The Dark Sky(DS) api is not available anymore so please skip all settings which refers to DS.

Source and support

The Cumulus version of W34 is supported by Ken True. There is a Forum, and a GitHub repository.

Installation is referring to a RPi with hostname "pws01".
Logged on to RPi, via ssh/terminal, and user "pi", start with an OS update

sudo apt update && sudo apt full-upgrade -y && sudo apt clean

After that download the W34 source to "pi" home folder

wget https://github.com/ktrue/CU-HWS/archive/master.zip

(Another way, if Git is installed on the RPi, is
git clone https://github.com/ktrue/CU-HWS.git)

Unzip the file "unzip master.zip"

Check that a folder with name "CU-HWS-master" is created and it contains several folders and files with the extension ".php". 

Delete the zip file, "rm master.zip", and then create a new folder

mkdir CU-HWS-master/add_on

Download from Github the program that retrieves data from WL

wget https://github.com/MatsA/weatherlink-data-pull/archive/master.zip

then unzip 

unzip master.zip  and delete the zip file "rm master.zip".

Copy 2 files to the "add_on" folder(The online file "realtime.txt" will be created by the program)

cp ~/weatherlink-data-pull-master/{cumulusdata.php,realtime.templ} ~/CU-HWS-master/add_on/

Edit the PHP file, "cumulusdata.php", "nano CU-HWS-master/add_on/cumulusdata.php" so that the 3 records in the beginning of the program

$wlink_user = "XXXX"; 
$wlink_pass = "YYYY";
$wlink_apiToken = "ZZZZ";

uses Your credentials to log on to WL. Please note that for the WL2.0 interface the
$wlink_user is changed to Device ID from former user. 

The changed application is tested against both a WL account that is still on WL1.0 and a WL2.0

Move, and rename, the folder "CU-HWS-master" to the Apache document root with 

sudo mv CU-HWS-master /var/www/html/pws

The W34 application will change local files, updates from WU, DS and WL, and therefore we have to take care of authority. The Apache servers default user/group is www-dataso the following command will handle this

sudo chown -R www-data:www-data /var/www/html/pws/

Continue with the setup, URL

http://pws01/pws/easyweathersetup.php No Password.

Set up the parameters for Your use case. (Please don't use Dark Sky(DS), mentioned as a forecast source, cause the service is terminated)

In the section "Cumulus Software Path to Data file" choose 
  • "Data Type" => "cumulus" 
  • "Your Path to data file" => "add_on/realtime.txt" 
To check that the application is getting data from WL, execute with 

sudo php /var/www/html/pws/add_on/cumulusdata.php

and check in a WEB-browser 


or via ssh/terminal

cat /var/www/html/pws/add_on/realtime.txt

The date and time in the beginning of the file will tell if You succeed

Add a crontab record, as user "pi", using, crontab -e

*/5 * * * * sudo php /var/www/html/pws/add_on/cumulusdata.php

This job will get the data, every 5 minutes, from WL and create/update the online file "realtime.txt"

You can now check the application with URL


and confirm that everything is working OK

Avoiding cron job ?  Check this

Please note;
  • Trend values, temperature and pressure, DarkSky forecast and Last Hour Rain can take up to 2 hours before they are OK.
  • Wind run, daily max wind and yesterday's rainfall will be correct after a day shift
Update W34
When You update/replace W34 to a new version, save
  • ”settings1.php” file so You don't have to register all settings with "easyweathersetup.php" again. Allways run the "easyweathersetup.php" so a conversion could be done and check if there are new settings.
  • "menu.php" file if You have added own Menu rows
Tips and tricks
  • If You have problem with the W34 application the built in diagnose feature could help. URL http://pws01/pws/diags.php?show=info
  • Show W34 settings with URL http://pws01/pws/diags.php?show=settings
  • A very easy way to check that everything is set up right at WL is to put the URL http://api.weatherlink.com/v1/NoaaExt.json?user=XXXX&pass=YYYY&apiToken=ZZZZ (WL2.0) in Your browser, changing XXXX, YYYY and ZZZZ to Your credentials, as You do in the program
  • If You don't like the translation You could edit the specific file in /var/www/html/pws/languages/
  • When registering at WL use lowercase for the "User name".
  • WL is updated once every minute so it's no use to run the Cron job more often
  • If You want to edit and change the W34 files, from Your Mac/PC, in the Apache server just add user "www-data" to Your Samba installation
  • If You want our code version please check this post
  • It could be that some of the data you are retrieving is missing due to that your source for the weather data is different than ours. (Vantage Pro2, sensor type 23, and data structure typ 2)
    At this link you can check if there are any differences and if so you have to edit "cumulus data.php" and map to correct fields. In the source search for "Direct values".
Current conditions, "
currentconditionsmetar34.php", is now updated and don't have any Dark Sky and hardware dependency.

Updated WU URL for todays historical observations 

Works with PHP V 8.x after an update by Ken

Tested and works with Bullseye.
Doesn't work with PHP V 8.x !!


New Cumulus version available, dated 2019-01-05. If upgrading and migrating Your old "settings1.php" You must run "Settings" and update the "Temperature module" part and "Sunposition Bearing" otherwise the application don't work.


New Cumulus version available, dated 2018-12-14. If upgrading and migrating Your old "settings1.php" You must run "Settings" and update the "Davis Hardware" part and "Sunposition Bearing" otherwise the application don't work.


"cumulusdata.php" is updated with calculation for field, rain last hour => $cumulus[47] and changed input for wind gust 10 minutes => $cumulus[40]  


"cumulusdata.php" is updated with field, yesterday's rainfall => $cumulus[21] 


Simplifying the installation and, inspired from Aaron, handling the authority in a better way.
"cumulusdata.php" is now updated for WL JSON data, PHP 7.2 and as said above You have to add "Curl" and "mbstring" support.


The new version, WL2.0, is migrated in this post.


The new version, WL2.0, is discussed in this post.


NOTE ! If You are updating to the new W34 version V3.4 X5(e) and migrating ”settings1.php” You have to use "easyweathersetup.php" and update new fields before You start the W34 application.
The file "homeindoor.php", showing just temperature, is updated at Github 


The program "cumulusdata.php" is updated for handling an extra temperature sensor, Davis 6372, which in our case is measuring the water temperature. To handle it, within the Cumulus file layout, the field for indoor temperature is used. "$water_temp = false;" which is default, means that the the indoor temp is used. If the field is set to "true" and there is a valid temperature in the XML answer from WL, 
field,  {'davis_current_observation'}->{'temp_extra_1'}  
the indoor temp is substituted with this value.
To display the info within W34 a changed "homeindoor.php" is available at Github which could be used in the "Top Row 4 Modules"


NOTE ! If You are updating to the new W34 version V3.4 X5 and migrating ”settings1.php” You have to use "easyweathersetup.php" and update new fields before You start the W34 application.
  • In the section "Set the Units ....." and the field "Distance unit measured miles or kilometres" choose the apropriate value (Used for windrun)
  • In the section "Some Extras....." and the part "These options are.... " choose the default "current34condtions.php"
  • In the part ”Options for Top Row 4 Modules” the value "Clock" is no longer valid for position 1

Due to changes in W34 the program "cumulusdata.php" now calculates trend values for temperature and pressure in a new way and therefore the file "realtime.templ" is extended. So if You are doing an update You must change to the new "realtime.templ" and "realtime.txt". The best way is to delete both files and download the extended "realtime.templ". Then when the program "cumulusdata.php" runs for the first time the "realtime.txt" will be recreated.


  1. everything works fine but index.php won't load. It appears common.php is killing it. Ideas?

  2. installed mbstrings - all fine tku!


Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !