Weather warnings from the German Weather Service as a beacon with APRX 2.9 on the RasPi-iGate

When reinstalling the APRS gateway DA9X, I stumbled across the option documented by Jens, DL2AJB to send the DWD's regional weather warnings via WX bulletin beacon. Since this PHP script is relatively rudimentary, I have adapted and expanded it to our needs.


I do not guarantee the correctness and compatibility of this manual and I do NOT assume any liability for damage, system failures or data loss. Everyone acts at their own risk and the information I provide is based solely on experience!


Since I only use a headless minimal image from Raspbian on the older RasPi Model B + and want to avoid everything that runs unnecessarily, I deliberately avoided using a web server and only installed the PHP scripting language. I do not provide instructions on how to operate the SSH console e.g. via putty or the editor "nano" - who wants to implement this should be able to handle it rudimentary.


But now for the canned stuff... ;) If you try to install PHP from the repositories via apt-get it tries to install the apache2 web server with all associated packages. If you look at the package dependencies at debian.org it quickly becomes clear why this happens - php requires either libapache2-mod-php, libapache2-mod-phpfilter, php-cgi, or php-fpm. APT does not care which package is installed - it selects the first package of all that meets the dependency - and these are the apache2 packages.


You can work around this by installing one of the other dependencies before PHP, e.g. php-cgi:


Code
sudo apt-get update
sudo apt-get install php-cgi php


When you are ready, create the appropriate folder structure in the home directory of the regular user "pi" (or the respective user, not under ROOT!) and change to the corresponding directory:


Code
mkdir /home/pi/dwdwarn
mkdir /home/pi/dwdwarn/warnings
cd /home/pi/dwdwarn


Then you can first create the configuration file in the directory "/home/pi/dwdwarn":


Code
nano config-json.php


You can theoretically use any number of entries here, but the DWD only takes into account key numbers at district level (cities that form their own district can be recognized by the key number that also begins with 1), keys at city or community level (or below) are ignored, at least I didn't get any data back from the DWD. However, you should only select keys that are within your own range, right? ;)


It is important that the comma after the last entry is NOT continued. If you comment out individual lines, you have to pay attention to them.


Then the actual script file follows, which usually has to be NOT to be customized:


Code
nano json_warn.php



The script deliberately removes the word "Official" from the beacon text and replaces it with "DWD", since official warnings may only be given by such agencies! The transmission via APRX Gateway is not such an official act.




If you have finished both you can test the script:


Code
php json-warn.php


Es sollten nun wenn Warnungen vorliegen entsprechende Meldungen erscheinen, z.B.:



So the script works. If there are any weather-warnings, the appropriate beacon files that can be processed in APRX are now stored in the "/home/pi/dwdwarn/warnings" folder.


The next step is to create the cronjob, the time-controlled task. This ensures that the warning messages are automatically reloaded.


Code
crontab -e

It is important here that the call is NOT made with the operand "-u" (e.g. "crontab -e -u www-data"), this will inevitably lead to access problems (ownership rights).

If cron jobs have already been created under line 23, the entry must be inserted in a new line under these entries. Here the script call is set to 10 min, i.e. the warning data is automatically reloaded every 10 minutes and beacon files are created if necessary.


Now only the beacon entry for the files in the "aprx.conf" is missing. To do this, open the APRX config file:


Code
sudo nano /etc/aprx.conf


Add the beacon-section :



Of course, "tx-ok" must be set to "true" in the <interface> section for radio transmission. Sending weather warnings via "aprsis" is expressly NOT recommended. Of course, you can also combine the beacons of the different regions in one beacon section (see above), but in my opinion this makes little sense because you should adjust the cycle-size to the really expected number of beacons and you never know exactly how many beacons actually come together.


If you have e.g. 6 beacons preconfigured and the cycle size set to 60 minutes, in the best case you get a transmission every 10 minutes. But if, for example, only one warning is active there is only ONE transmission per hour. Experience has shown that 1, a maximum of 2, in the extreme cases 3 warnings per region are active at the DWD, so you can adapt to them.


For our area, specifying WIDE1-1 for forwarding via digipeater makes little sense too, some of the accessible Digis are more than 80 km away and would carry the message far into areas for which the messages are not intended.

Comments