Script Question


 

Tim McGee

New member
I'm a developer by trade.

I'd like to be able to turn the power on for X minutes at 100% and then shut off for Y minutes.
I'd like to repeat this numerous times.
I cold smoke using this routine manually.

Where should I start? I see there are fmin/fmax config variables. Are they accessible from a shell script?

EG: on at 100% for 15 minutes
off for 45
on at 100% for 15 minutes
off for 45
you get the idea
 
Here's a script I used in the probe 0 high (PIT) script area for ramping up slowly to initially entered setpoint. Set the alarm to initially trigger above 100 to activate the script. You may be able to use something like this between high/low scripts to control based on PIT temperatures rather than time. Time may not be a good variable to use because it can affect consistency with changes in weather, PIT rise/fall times, etc...

#!/bin/sh

# Silence this alarm, it will ring again if re-armed
lmclient LMST,al,,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 it's alarm
lmclient LMST,al,$(($orig_sp-10))

#Ramp up temperature to avoid combustion of wood
case $al_thresh in
100) NEWSP=140; NEWAL=139; msg="$pn Initial Threshold $al_thresh reached, next alarm @ $NEWAL."; ;;
139) NEWSP=$orig_sp; NEWAL=$orig_sp; msg="$pn Intermediate Threshold $al_thresh reached, next alarm @ $NEWAL."; ;;
$orig_sp) NEWSP=$orig_sp; NEWAL=100; msg="$pn Setpoint: $al_thresh reached, and holding."; ;;
esac

lmclient LMST,sp,$NEWSP
lmclient LMST,al,,$NEWAL
 
Last edited:
I'm a developer by trade.

I'd like to be able to turn the power on for X minutes at 100% and then shut off for Y minutes.
I'd like to repeat this numerous times.
I cold smoke using this routine manually.

Where should I start? I see there are fmin/fmax config variables. Are they accessible from a shell script?

EG: on at 100% for 15 minutes
off for 45
on at 100% for 15 minutes
off for 45
you get the idea

fmin and fmax can be set via scripts. See the Alarm Script Variables info in the wiki.

Something like:

Code:
while true
do 
lmclient LMST,fmin,100
lmclient LMST,fmax,100
sleep 900
lmclient LMST,fmin,0
lmclient LMST,fmax,0
sleep 2700
done
 
Steve pretty much nailed it. However, I wouldn't mess with fmin and fmax to just set a manual output. Setting the "setpoint" to a negative number will set it to a manual output mode, so like this
Code:
while true
do 
lmclient LMST,sp,-100
sleep 900
lmclient LMST,sp,-0
sleep 2700
done

I think the easiest way to activate this would be to put a script in System -> Custom Commands to spawn this script with the fork / run in background suffix (&). You can also have a second command to killall the script, or simply pull the plug on the HeaterMeter to stop the cycling.

As far as if the fmin and fmax variables being available in scripts, if you still want to use those for something, they are available. However, outside of alarm scripts they may be a bit difficult to parse as the data is in JSON format. Retrieve the config object with `lmclient LMCF`
 

 

Back
Top