Thursday, April 17, 2014

Weather Station data displayed on public website (Custom Xively-rickshaw/plot.y and Google Gauges displays)

Last post I highlighted getting all my weather sensor data available on Xively for my RPi hosting sensors accessible remotely over an RF link.

While I think Xively is great, it is really not designed to be the final stop for sharing or exchanging data. My weather station data is now consolidated at Displaying the data on my own site allows for more customization, and presentation of the displays, and easier access for my fellow gardeners. The page is broken up into three sections right now, current garden conditions (what most care about), hardware status (how I keep an eye on my equipment running), and historical data.

The skeleton of the site (I'm not a web developer) pardon my naivety, is Twitter Bootstrap.  I'm just a general fan of that toolkit, to include the documentation. Their templates seem fairly easy to grab and modify. Also looks decent on desktops and smartphones.

Current Conditions 

I originally had high hopes of uses a wide range of current  Google Charts but had a tough time figuring out how to use the Xively JSON. Seemed like I might be fording new territory, not entirely a productive activity for someone with limited web experience.

Luckily I came across a great blog that had figured this out for the Google Gauges, so I used this extensively (on both the Current conditions, and Hardware Status.) If you want to check out my derived work, check my github.

The line graph seen below the Gauges is actually a image retrieved from Xively (for simplicity). Discussed in my last post  But also here is the basics of the html again. 

 Graph can be adjusted by following the Xively API.

For the historical data page I wanted something interactive. I came across this post about plotting Xively data with RickShaw. Was exactly what I needed, and well documented at the xively-rickshaw github. I use Xively-Rickshaw for nearly all my historical displays, both line graph and bar charts. Here is what I implemented from extensively referencing (mostly copying) xively-rickshaw example. Although the Xively feed does restrict the number of points that can be pulled, that model fit well into my various historical data view options.

On the RPi side my various scripts to pull the data are started on boot and otherwise controlled via supervisord I found its control and logging, and able to background processes and control sleep withing the scripts, not under the restrictions of cron useful.

Modifying /etc/supervisord.conf Adding something like the following:


Enabling the service (or later restarting/stopping) is as easy as:
systemctl enable supervisor.service | systemctl restart supervisor.service | systemctl stop supervisor.service | systemctl start supervisor.service

I should mention, I am using Arch Linux,  so my supervisor is first called at startup by systemd:
Description=control progs

Aside from xively-rickshaw I did some experimenting with At quick glance, it might look similar, but does offer some interesting features such as zooming  in, or going into to fork (copy and analyse). I haven't explored it much, so I haven't figured out if there is an easy way to display smaller periods of data (like I do with Xively.) I use it to display all CPU data from my base station (from inception.)

For my RPi and page I came across a simple method that worked great. It relies on cron at the moment (on my RPi). There are also some examples of more advanced use of if you care to look more into this method.

My full base station CPU temp feed: 

Well, that covers it. For the all the details of the web page side of things check out

No comments:

Post a Comment