Tony L-Iowa
TVWBB Fan
I'm doing some scripting with the alarms and I cannot seem to get alarm-0L threshold set without manually doing it on the alarms page. I've tried some lmclient variations such as "lmclient LMST,pall0,100" and "lmclient LMST,al,,,100". But nothing seems to work? What I am trying to do is when my first run of the alarm-0H script fires I want it to discover the desired setpoint and make a low alarm (i.e. alarm-0L) that is 10 degrees below the desired setpoint. The point is to ensure notifications get sent out if for any reason the pit temp drops 10 degrees after reaching setpoint. Below is my alarm-0H code (search <need help here> for my problem area):
Code:
#!/bin/sh
# Silence this alarm, it will ring again if re-armed
al_set 0
#Find original setpoint for final ramping value
if [ -s /tmp/original_setpoint ] ; then
orig_sp=`cat /tmp/original_setpoint`
else
orig_sp="$sp"
echo "$sp" > /tmp/original_setpoint
fi
#Enable the Smoker Temp Low Threshold and enable it's alarm
<need help here>
lmclient LMST,pall0,50
#Ramp up temperature to avoid combustion of wood
case $al_thresh in
100) NEWSP=140; NEWAL=142; msg="$pn Initial Threshold $al_thresh reached, next alarm @ $NEWAL. Currently $pcurr"; ;;
142) NEWSP=$orig_sp; NEWAL=$orig_sp; msg="$pn Intermediate Threshold $al_thresh reached, next alarm @ $NEWAL. Currently $pcurr"; ;;
$orig_sp) NEWSP=$orig_sp; NEWAL=100; msg="$pn Setpoint: $al_thresh reached, holding. Currently $pcurr"; ;;
esac
lmclient LMST,sp,$NEWSP
al_set $NEWAL
#Send Alarm Event Notification to Push Bullet
PB_KEY="<filtered out>"
PB_HOST="https://api.pushbullet.com/v2/pushes"
PB_MSG="{\"type\": \"link\", \"title\": \"$pn Alert: $pcurr @ $(date +"%r")\", \"body\": \"$msg\", \"url\": \"my.bbq-url.com\"}"
curl -k -o /dev/null -s -H "Content-Type: application/json" -u "$PB_KEY": -d "$PB_MSG" $PB_HOST