Environmental temperature monitoring with 1-Wire and Linux Part 2
[caption width="506" align="center"] 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.
Here is what the script sends to Carbon and to the log filie.
I like to be very precise with my data, so I put that script into /etc/crontab, to run every minute:
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.