How to listen to an old boiler

At work we have an old steam boiler heating system that was original to the building. A short time back, I installed a cheap IP camera (30 bucks) to watch the steam gauge (the main air handlers run on steam while the radiators run on just hot water) to monitor when we could ‘dump heat’ into the building. It’s old and sometimes has trouble getting started for whatever reason. This camera also has a microphone that I could listen to using something such as MPlayer. I made a script to ‘listen’ to the boiler room every minute for 4 seconds and analyze the audio to determine if the boiler is on or off. Since its old and fairly loud, it has been pretty reliable so far… Check out the script below that runs in cron every minute:

Cron-job:

* * * * * /path/to/boiler-audio > /dev/null 2>&

boiler-audio file:

#!/bin/bash

DUMPFILE=/var/tmp/boiler.wav
BOILERFILE=/var/tmp/boiler.txt
BOILERAMP=/var/tmp/boileramp.txt
BOILERTIME=/var/tmp/boilertime.txt
TIME=4
shift

/usr/bin/mplayer -quiet -dumpstream -dumpfile $DUMPFILE http://192.168.x.x/audio.cgi &
PID=$!
sleep $TIME
kill $PID
wait

AMP=`/usr/bin/sox -t .wav $DUMPFILE -n stat 2>&1 | grep "Maximum amp" | cut -d"." -f2`
FIRE="off"

if [ "$AMP" -gt "300000" ]
then
 FIRE="on"
fi

echo $FIRE > $BOILERFILE
echo $AMP > $BOILERAMP
echo `date +%r` > $BOILERTIME