[arm-allstar] New weather script test

Doug Crompton wa3dsp at gmail.com
Wed Jun 14 23:48:14 EST 2017


I have created a new weather script that will say your current local
weather from either an NWS or wunderground XML site. This may also work for
other weather xml sites. This is a work in progress and almost 500 lines of
code at this point. I am presenting it as a straight download not a
package. There obviously will be some changes fixes etc. based on your
input. Once it is proven I suspect it will appear as a package or more
likely a future update.

To get the code -

cd /usr/local/sbin
wget https://hamvoip.org/downloads/wx_condition.tar.gz
tar -xvzf wx_condition.tar.gz

The current file name  is wx_condition.sh

Here are some notes on using it -

This script Voices weather using the Alison voice from the National weather
service XML sites or wunderground stations. It says a fairly complete
current conditions based on what is available at the site you choose. Not
all sites have ALL data and there is no guarantee the data is correct. For
instance some sites have visibility, some have precipitation and some
don't. So don't expect to see everything for every site. NWS and
wunderground will also display slightly different things.

You can use this to voice your personal weather station from
wunderground.com. In that case the ID is preceded by w-  (the same as in
the weather.sh script.

Getting weather data and presenting it correctly especially in voice is a
tricky thing and I have spent some time trying to get things right. I am
sure there will be things that do not work or work incorrectly. Based on
your input I will make corrections. Please give the details of how the
error occurred and what site you were accessing.

Use the Station ID which can be found at
http://w1.weather.gov/xml/current_obs/
or w-<weatherunderground id>

At the NWS site go to your state and nearest location. It is usually an
airport or major city.

Syntax is -

wx_condition.sh w-<wunder-ID> node mode
wx_condition.sh <NWS-ID> node mode

 mode =

   'v' for display weather conditions only
   'd' for debug - display all including files used and play voice
   'p' or blank for play voice only to the node,
   'b' for both display and play

Node number must always be entered even if not playing to it.

This script requires the xml2 package which is NOT installed in the current
(6/15/17) hamvoip image

Do -

pacman -Sy xml2

at the Linux prompt and load the package.

To play using an Allstar function - add the following to the
/etc/asterisk/rpt.conf file functions stanza

820=cmd,/usr/local/sbin/wx_condition.sh <NWS-ID or -wWeatherundergroundID>
<node>

Replace 820 with any available DTMF sequence you desire, include the ID and
local node on that
server to play on. Example:

 860=cmd,/usr/local/sbin/wx_condition.sh KPHL 40000

   Play weather to node 40000 when DTMF *860 is entered.

Because of its length it would generally not be suitable to put this in a
cron

Two optional files can be user defined - /etc/asterisk/local/wx_header.gsm
and
 /etc/asterisk/local/wx_footer.gsm

The header file when present plays BEFORE the weather data and the footer
file AFTER.
These files must be in .gsm format and standalone playable as such in
Allstar

The header file could say something like "weather for philadelphia, pa"
using of
course your location. This could be in you own voice or using a quality tts
source
converted to the proper gsm allstar format.

Screen examples - 'v' mode

Weather for Station ID - KNJNORTH13
------------------------------------------------------
Temperature - 64 F / 18 C
Humidity - 93 Percent
Wind Direction - West at 0 miles per hour
Wind Gusts - 0 miles per hour
Barometric Pressure - 30.02 inches
Dew point - 62 F / 17 C
Precipitation Today - 0.00 inches

Weather for Station ID - KPHL
-------------------------------------------
Weather - Partly Cloudy
Temperature - 69 F / 21 C
Humidity - 61 Percent
Wind Direction - North at 0 miles per hour / 0 knots
Barometric Pressure - 30.03 inches
Dew point - 55 F / 13 C
Visibility - 10 Miles



*73 Doug*

*WA3DSP*

*http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*


More information about the arm-allstar mailing list