Perl Script to put Weather on your Polycom Microbrowser

Getting started

Here’s a quick little perl script to create a static html/xml file that can be displayed on your Polycom’s microbrowser. The script uses the Google weather API to check the weather based on a given zip code.

The install should be pretty quick. Ok, next for the perl script (weather.pl):

How does it work?

Google has a nice little weather API which will provide a weather forecast for a given zip code via xml.
The perl script scrolls through the xml, parsing for the requested data and making a little webpage.
To call the script, you would run something such as:

perl weather.pl 90210

Now, for the perl script. First, if you don’t have the XML::TreePP module, you’ll need to install it. Which is as easy as:

# perl -MCPAN -e shellcpan> install XML::TreePP

Create a folder to store your Apps. I used polyApps, so copy weather.pl and all the images to /usr/share/www/doc/polyApps/ It will help to have a SMB share setup so you can copy your files.

Schedule Crontab

Setup a Crontab schedule to run the weather.pl script; for example, twice a day every day.

To edit a crontab entry, use crontab -e By default this will edit the current logged-in users crontab.
Save the file with :wq

By default crontab sends the job output to the user who scheduled the job. If you want to redirect the output to a specific user, add or update the MAIL variable in the crontab.
If you want the mail not to be sent to anywhere, add or update the MAIL variable in the crontab as: MAIL=""

Point the phones MicroBrowser - idleDisplay - home field to the url: http://sipx.domain.com/polyweather550.html and set the refresh period (in seconds).

If cron isn't running or you don't see any updates to polyweather550.html, check out the log file at/var/log/cron