[caption width="506" align="center"]Viewing 1wire sensor data in Graphite Viewing 1wire sensor data in Graphite[/caption]

Overview

This update should have happened a while ago, and isn't really part 2 anymore, but I've only just recently had time to work on my home environment monitoring solution so here is where it is at.

My original plan called for grabbing 1-wire sensor data with a script, which called digitemp and then inserted the returned data into a MySQL database. I was then going to build a PHP / Javascript webapp which used jQuery and Google Chart Tools to pull the data from MySQL and graph it. I've done all of this before, aside from using Google Chart Tools. After a couple of weeks of weeks of playing with pivot tables in MySQL (read: don't do it) and Google Chart Tools, I decided to try something else.

Enter graphite. I use graphite at work to track server metrics, and figured I could use it at home as well to track my house metrics. Graphite is neat in that it can graph anything that you throw at it, so long as that anything is numeric.

The good stuff

The first step was to rewrite my scripts which grab the sensor data; the rewrite was not huge, mainly I ripped out the MySQL stuff and added in some socket stuff. I should note that this script would be much more simple if digitemp allowed you to associate sensors with a name of some sort like you do with a hash in perl.

[github_cv url=https://github.com/kylejohnson/digitemp-1wire-carbon/blob/master/digitemp-1wire-carbon.pl]

Here is what the script sends to Carbon and to the log filie.

house.environment.temperature.Kitchen 70.250000 1359219963
house.environment.temperature.Bed_Room 71.037498 1359219965
house.environment.temperature.Workshop 60.912498 1359219966
house.environment.temperature.Weight_Room 69.349998 1359219968
house.environment.temperature.Computer_Room 68.337502 1359219970

I like to be very precise with my data, so I put that script into /etc/crontab, to run every minute:

* * * * * root perl /usr/local/bin/digitemp-1wire-carbon.pl

And that is it. The script runs every minute, grabs data from digitemp, parses it, and prints it to a socket (graphite), which you can then view in your web browser.

I have also written scripts to grab the state (on, off) of my HVAC system from my Nest Learning Thermostat, to grab the temperature of my neighborhood from the Wundergruond API, and to grab killwatt usage from my TED 5000.