HOWTO Install FreshWDL onto a Pi

From WeatherWiki

HOWTO: Install FreshWDL on a Raspberry Pi

If you've set up a Raspberry Pi to grab data from your weather station using consolewd and push the data to your Internet web site for the world to see then you might be wondering what else you can do with the Raspberry Pi. They're clever little computers that are more powerful than you might imagine for their size. How about turning it into a web server that runs FreshWDL that you can access across your local network? Here's how to do that...

0) Introduction

I've only tested this with a Raspberry Pi Model 3B+. It should work on a Model 4 and will probably work on other Model 3 Pi's but I'm not sure whether it will work on Model 1/2 Pi's. The instruction also has two placeholders that you will need to replace with your own settings. They are:

  • <consolewd_dir> - The directory where the consolewd and clientraw data files are located on your Raspberry Pi
  • <RPiAddress> - The IP address of your Raspberry Pi on your home network. Probably something like 192.168.0.nnn.

The steps below are all carried out on your Raspberry Pi. Log into it using SSH and do the following...

1) Install Apache web server

sudo apt update

sudo apt install apache2 -y

This will install the Apache web server software and run it. It should also set it to run automatically on reboot. You can test that Apache has installed correctly by browsing to "http://<RPiAddress>", e.g. "http://192.168.0.nnn"

2) Make a web directory for FreshWDL

sudo mkdir /var/www/html/fresh

You can choose another directory, or even make it the default web page for the Raspberry Pi, but I'll leave that for you to work out if you want to do it.

3) Download and install FreshWDL

wget https://github.com/Yerren/FreshWDL/archive/master.zip

unzip master.zip

cd FreshWDL-master

sudo cp FreshWDLmaster.html /var/www/html/fresh/index.html

sudo cp config.js /var/www/html/fresh

This downloads the latest version of FreshWDL into the current directory on your Pi (I assume a directory that you can write files to), then unzips the master.zip file into a sub-directory of your current directory called FreshWDL-master. Then changes into the FreshWDL-master directory and copies the two files needed for FreshWDL into your 'fresh' web server directory.

4) Create links to the clientraw data files

cd /var/www/html/fresh

sudo ln -s <consolewd_dir>/clientraw.txt clientraw.txt

sudo ln -s <consolewd_dir>/clientrawextra.txt clientrawextra.txt

sudo ln -s <consolewd_dir>/clientrawhour.txt clientrawhour.txt

sudo ln -s <consolewd_dir>/clientrawdaily.txt clientrawdaily.txt

This creates links to the 4 clientraw data files used by FreshWDL in the 'fresh' web server directory. This allows FreshWDL in the web browser to see the clientraw files that consolewd is creating.

5) Modify the FreshWDL config to suit your own requirements

sudo nano /var/www/html/config.js

Edit the /var/www/html/fresh/config.js file. Don't change the filename settings at the top of the file and make sure that customBaseURL is set to false (the default). The other settings can be modified as you require. You can also edit the /var/www/html/fresh/index.html file to show your station name. See the FreshWDL documentation for the changes you can make to these files.

6) Test your new copy of FreshWDL

Browse to "http://<RPiAddress>/fresh" and you should see your station data displayed and updating in a FreshWDL page.

Finally - I would only recommend that you make FreshWDL accessible across your local (house) network. Whilst the Pi can be configured to run a full operating system it doesn't have a firewall enabled by default. So making it accessible to the Internet could give you a big security headache. If you really must expose it to the Internet make sure you deploy appropriate cyber-security protections and that you update the Pi regularly to make sure that security patches are installed as soon as possible after they are launched.