Refrigerator monitoring is a big thing, especially for commercial reasons. So i thought this is perfect raspberry pi territory.
A $50 raspberry pi, a $3 USB extension cable and a $10 USB temp monitor is all it takes. Commercial products that perform the same task cost $500+
So lets start off by updating the OS and installing all the applications we’ll need.
1 2 3 |
apt-get update apt-get upgrade apt-get install puppet vim screen nmap git python-usb python-setuptools snmpd |
Lets check that the USB temp sensor is connected and online.
1 2 3 4 5 6 |
root@hostname:~# lsusb <strong>Bus 001 Device 005: ID 0c45:7401 Microdia</strong> Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS] Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub |
Lets download the source for the temp sensor.
1 2 3 4 5 |
git clone git://github.com/padelt/temper-python.git cd temper-python/temperusb/ python setup.py install |
The is how you get a reading.
1 2 3 |
/usr/local/bin/temper-poll Found 1 devices Device #0: -14.0°C 6.8°F |
I wrote a script which just grabs the Celsius reading and logs it in a log file, I have this running every minute. This is just for testing purposes, ultimately we’ll get Nagios to monitor the reading and alert based on their outcome.
1 2 3 4 5 |
#!/bin/bash temp=`/usr/local/bin/temper-poll | grep Device | awk '{print $3}' | sed 's/°C//'` echo "`date` - $temp" >> temp.log |