Email Temp Script for Heatermeter


 

NateSebold

TVWBB Member
I wanted to give something back to community that has given me so much and I haven't seen anything like this anywhere in great depth so here it is.

I wrote a script that would email me the temperature on a recurring basis.

Here is what the email looks like when I receive it:

email%20report.PNG


Here is the script that I wrote:

#!/bin/sh

Pittemp=$(lmclient LMGT,pcurr0)
Probe1name=$(lmclient LMGT,pn1)
Probe1temp=$(lmclient LMGT,pcurr1)
Probe2name=$(lmclient LMGT,pn2)
Probe2temp=$(lmclient LMGT,pcurr2)
AirTemp=$(lmclient LMGT,pcurr3)
Setpoint=$(lmclient LMGT,sp)
logfile="/mnt/scripts/temp_report.tmp"
email="*************@gmail.com"
subject="[HM] Temp Report"
Currenttime=$(date +%T)

######### Set email headers #####
(
echo "To: ${email}"
echo "Subject: ${subject}"
echo "Content-Type: text/html"
echo "MIME-Version: 1.0"
echo -e "\r\n"
) > "$logfile"

############# Set Email Body ####
echo "<pre style="font-size:8px">" >> "$logfile"

######## Report ########
(
echo ""
echo "########## HeaterMeter Temperature Report ##########"
echo ""
echo "The Set Point is: $Setpoint "
echo "The Pit is Currently: $Pittemp "
echo ""
echo "$Probe1name is currently $Probe1temp "
echo "$Probe2name is currently $Probe2temp "
echo ""
echo "Time of Report: $Currenttime "
echo "The Air Temperature is: $AirTemp "
echo ""
echo "##################################################"

) >> "$logfile"
echo "</pre>" >> "$logfile"

######## Send report #######

sendmail -t < "$logfile"

rm "$logfile"

To get it working:

SSH in to the Heatermeter
put script in /mnt/scripts
make it executable
goto Heatermeter GUI and the System/Scheduled Tasks page (crontab)
add this line to crontab: 25,55 * * * * /mnt/scripts/emailscript.sh
Profit!

Hope this helps someone out there!

Cheers!
 
A good thing to keep in mind is that you can easily turn this into a text message instead of an email too. Google search to find what you cell phone provider uses to send email as a text. Example, verizon uses "yourphonenumber@vtext.com"
 

 

Back
Top