How to set alarm-0L threshold from alarm-0H script


Tony L-Iowa

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):


# 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`  
  echo "$sp" > /tmp/original_setpoint

#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"; ;;

lmclient LMST,sp,$NEWSP
al_set $NEWAL

#Send Alarm Event Notification to Push Bullet
PB_KEY="<filtered out>"
PB_MSG="{\"type\": \"link\", \"title\": \"$pn Alert: $pcurr @ $(date +"%r")\", \"body\": \"$msg\", \"url\": \"\"}"
curl -k -o /dev/null -s -H "Content-Type: application/json" -u "$PB_KEY": -d "$PB_MSG" $PB_HOST

Bryan Mayland

TVWBB Hall of Fame
It's lmclient LMST,al,100. Break it down:
lmclient <- the executable
 <- space between the executable and the command string
LMST, <- command "set" followed by a comma
al, <- set what? alarm followed by a comma
100 <- value low0 is the first item, to set another add more commas low0,high0,low1,high1,etc

Bryan Mayland

TVWBB Hall of Fame
Yeah the variables you have available are a bit different than how you set them, because they are normally packed into strings with multiple variables per string which aren't easy to work with. I split them off into individual items, only the config page knows how to pack them back together to make the right strings to send to HeaterMeter. How it does this you can find in HeaterMeter Set Parameters.

Glad you got it working!