LinHES Forums
http://forums.linhes.org/

HOWTO: Install and Run RRDWeather-Mod on KM R5.5
http://forums.linhes.org/viewtopic.php?f=11&t=18894
Page 1 of 3

Author:  graysky [ Sat Aug 30, 2008 6:54 am ]
Post subject:  HOWTO: Install and Run RRDWeather-Mod on KM R5.5

Install RRDWeather-Mod

If you leave your KM box up 24/7 and have an interest in weather data, you might want to consider running RRDWeather-Mod. This is a modified version of Sébastien Wains' RRDWeather and it will work with KM5.5 out-of-the-box since KM R5.5 contains all the dependencies fully configured!

Basically, it will get weather data (temps, dew point, wind speed, uv index, moon phases, etc.) from weather.com and a few other source via an xml feed for any number of cities and place the data into rrd databases which it then displays graphically via rrdgraph when you browse to the url of the included .cgi script. It's just like the included rrd logging features in KM R5.5. You'll get nice graphs of various weather data for your city/cities on a daily, weekly, monthly, and yearly basis.

Frank Helak modified rrdweather to be even better in my opinion. In addition to the list data logged in the standard version, the notable enhancements are:
    * Forecasted high/low temps (area graph range, very slick)
    * Forecasted percent precipitation
    * Sunrise/sunset times
    * Wind direction

I further modified his original adding the following:
    * Novel and bandwidth friendly data update paradigm (cron invoked flag scripts/one main data harvester script)
    * Historical temperature data
    - Record high temp and the year it was set
    - Record low temp and the year it was set
    - Monthly average high and low temps
    * Precipitation graph (average monthly/amount fallen to-date)
    * Approx. Lunar cycle graph
    * Error checking which eliminates those damn zero value spikes
    * Nice installer/update/uninstaller scripts


Anyway, Frank wrote his mods on an earlier version of rrdweather (0.36) and was kind enough to send me the code he wrote which I adapted to the current version which is 0.42.

For a live demo of Frank's modified version, see this page. Note that the version at the URL above does NOT have any of my mods but it will give you a flavor for what it looks like.

I pre-configured the modified version for KM R5.5 so you just untar, add your zipcode(s) and run the installer!

Download the tarball (19 kb) here.
The md5sum for the tarball is: 6e245df6d5d86810d34ff49a02b8e075

Untar the file like this:
Code:
$ tar zxvf rrdweather-0.42-mod-R6.tgz ; cd rrdweather-0.42-mod-R6


Then enter your zipcode(s) in the files/rrdweather.conf and if you want to use metric units, edit the setting in the same file as well as in the file/weather.cgi file. Now just run the install.sh script like this:

Code:
# ./install.sh


I included a README with more detailed instructions.

If you have an existing rrdweather-mod, and wanna keep the data, you can copy the db's to another dir, run the install.sh, then copy them back after you make new databases.

For example, let's say I have data for zipcode 90210 and 80303 I want to save them.

1) Move the current db's to a safe place:

# mv /myth/rrdweather/db /home/mythtv

2) Run the uninstall/install as directed above and REMEMBER that the un-
installer will delete your /myth/rrdweather/db dir so be sure you did step
1 above!

3) Copy the legacy db's back overwriting any new ones that are dups

# cp /home/mythtv/db/90210/*.rrd /myth/rrdweather/db/90210
# cp /home/mythtv/db/80303/*.rrd /myth/rrdweather/db/80303

That should do it!

:!: EDIT on 27-Sep-08 - Enhancements, fixes and updates. Get the new release now (0.42-R6)!

CHANGELOG wrote:
26-Sep R6
- you will need to uninstall/reinstall for this release since new databases are required. this is very easy to do. please read the included README file which will show you how to do it keeping any current database you may have.

- totally re-wrote the backend scripts to use a novel paradigm of a single master data harvester script and three other cron-invoked flagger scripts which tell the master script when it's time to update the data source.

- made the scripts all point to vars defined in weather.conf which is nice if you wanna run this on a non-KM system (i.e you define the rrdweather-mod root dir, the user that can run the scripts, etc.)

- added two new databases and new graph for the phases of the moon
- added a few extra static vars to the graphs and also some added descriptors

Author:  mjl [ Sun Aug 31, 2008 2:39 pm ]
Post subject: 

Hi,

Rather a cool project :) Makes nice graphs too!

Would you know how to modify the scripts to use locally available data instead of some unknown source?

Thanks
Mike

Author:  graysky [ Sun Aug 31, 2008 3:55 pm ]
Post subject: 

You can use any time dependent data source with rrdtool. The catch is having a weather station that can output its data in a format you can read. A number of expensive ones do in fact export their data to a variety of formats, but most of these are pretty expensive and undoubtedly come with their own data visualization software.

If you have a data source and wanna learn rrdtool, see the tutorials and documentation on the rrdtool page.

Author:  mjl [ Sun Aug 31, 2008 4:53 pm ]
Post subject: 

Hi,

Thanks! I will poke at it a little to see what I can figure out. Here is what I currently can use:
17:03 08/31/08 E 03MPH 460F 460F 079F 036% 30.24S 00.00"D 00.75"M 34.39"T

It also runs very nicely on R5F27 except even with the m > e change I still get c labels on the temps.

Mike

Author:  graysky [ Sun Aug 31, 2008 5:04 pm ]
Post subject: 

::confused:: what is generating those data for you and how regularly will it update? Is it just a text file or..??

Author:  mjl [ Sun Aug 31, 2008 5:34 pm ]
Post subject: 

Hi,
Sorry, didn't mean to toss in a confusion factor :) It is a plain string of text that I pull every ~30 seconds or so using a RS232 connection from a Texas Weather system. Definitely not a "high end" system but ok for me. I mean does it really matter if it 92 or 93 degrees? A half mile away it probably is +/- of my readings anyway.

It is easy to separate out what data I want (tjc & Human taught me how) but I just never was able to grabbed how to make graphs and a single picture can give a lot of information in a single glance.

Something fun to do as I don't watch much TV :)
Mike

Author:  graysky [ Sun Aug 31, 2008 6:36 pm ]
Post subject: 

@mjl - cool. I think it can be done, but I don't have the know-how to do it :) If you study the structure of the rrdweather I think you can figure out what has to happen.

1) Grabber (something to read and parse the data)
2) Logger (something to feed the logged data into the rrd databases)
3) Grapher (rrdgraph)

Author:  mjl [ Sun Aug 31, 2008 6:57 pm ]
Post subject: 

Hi,

Thanks for the encouragement. Looks like the magic is in the xml file which I can recreate easily. Just not sure of what how the second "zip-fore.xml" one ties in with some of the minor stuff.

The rest is in the cgi scripts and I can mess those up too. Will let you know what works out.

Mike

Author:  graysky [ Sun Aug 31, 2008 7:00 pm ]
Post subject: 

The zip-fore.xml is just the 1-day forecast which allows it to bring in the high and low temp for the day. In your case, you'd just have the single data source.

Author:  mjl [ Sun Aug 31, 2008 7:46 pm ]
Post subject: 

Hi,

Ok, that makes sense and explains the values. Only part I have to figured out is where the script picks where to go to pull the xml so I can stop it and let it do the work locally.

I have checked in these but there seems to be an invisible pointer for the url, at least I don't see it.
/etc/cron.d/rrdweather
/usr/share/rrdweather/rrdweather_cron.sh
/usr/share/rrdweather/db_builder.sh
/etc/rrdweather.conf

Any hints?
Mike

Author:  graysky [ Mon Sep 01, 2008 5:42 am ]
Post subject: 

It's /usr/share/db_updater.sh

The /etc/cron.d/rrdweather_cron should point to it and run it every 5 min.

Author:  mjl [ Mon Sep 01, 2008 6:07 am ]
Post subject: 

Hi,

Yep, found it also :) Only problem remaining so far is that it complains about the time stamp Not sure of what it is trying to tell me but will keep poking.

Mike

Author:  mjl [ Mon Sep 01, 2008 6:58 pm ]
Post subject: 

Hi,

Just an update. It took a few little adjustments to select the data I have available and once I fixed my typos, the previous errors disappeared also. :) It works very nicely in R5F27.

The only small issue I have and it doesn't make any difference of where the source data is from, but I don't like the scaling of the barometer in inches. Maybe millibars might be ok but I have used inches so long and have no need to re-learn in mb. I was trying for an expanded fixed window of 28 to 32 as that shows trends nicely.

Thank you graysky for sharing!
Mike

Author:  graysky [ Tue Sep 02, 2008 1:18 am ]
Post subject: 

I can take a look at this for you later today (no time right now). Also, can we take this conversation into a new thread?

Author:  graysky [ Tue Sep 09, 2008 12:35 am ]
Post subject: 

I updated the rrdweather-mod (see first post) with some new features and a few bug fixes. Check it out!

Page 1 of 3 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/