Archives

All posts for the day February 8th, 2008

Temperature graph

All I had to do was come up with a quick and dirty bash script to export the right information and mrtg does the rest. Here is the script:

#!/bin/bash
TEMP=`owread -F /10.8889C7000800/temperature`
echo $TEMP
echo $TEMP
echo "as long as I can remember"
echo "Basement Temperature Sensor"

And the output:

$ ./tempmrtg.sh
59
59
as long as I can remember
Basement Temperature Sensor

For the most part, you can graph just about anything with mrtg as long as your script outputs 4 things. In, Out, uptime, and a name. Since mrtg was designed mainly to be used with traffic monitoring, you need to specify input and output. But for something simple like temperature, those can both be the same number.

Yes it is 59 degrees in the basement. Whatever.

I’ve been using IPcop for years. I use it as a secondary router/firewall at work and it has been my main firewall at home for years. At home it used to run on the first computer I personally ever purchased. It was an IBM Aptiva AMD K6-2 233MHz system with about 128MB of RAM and an upgraded 20GB hard drive. After years of faithful service, I ran into some “trouble.” I walked into the basement to hear quite a loud whirring and whining from the corner where the computer was installed. The router was amazingly still working, I assume everything was running from memory and not the disk. I started searching for parts but realized that I no longer had an old ATA hard disk in my parts bin; Everything I had was SATA or too large to be wasted on a small home firewall. Luckily my main wireless access point is a more then capable Linksys WRT54GS. It took a bit of conversion, but now I am running with the Linksys alone. IPcop was really nice, I just no longer see the need for it at home. It’s served me well and I continue to use it at work and can say nothing but good things about it.

I’ve also been messing with some Dallas 1-Wire temperature sensors. They are pretty simple to mess with and get working as most of the drivers are already in the Linux kernel. There are a few software packages that allow you to interface them directly. Some work rather well, some not so well. I’ve been messing with owfs and that seemed to work the best for me. Each sensor has a hardware address and owfs allows you to query it directly to get the current temperature:

$ owread -F /10.8889C7000800/temperature
61.5875

That’s the current temperature in our basement. I have to do a little wiring to move the sensor away from our pellet stove, otherwise when that is turned on the thing will jump up to an inaccurate temperature. I’ve also been working with a few different programs to help graph the temperature trends. Once that is all working, I can get sensors for all over the house. Why? Really, why not. Because I can.