[arm-allstar] Feature request
Justin Reed
celltech161 at gmail.com
Wed Nov 28 23:07:54 EST 2018
I've almost got this running. It sets the fob output low when there is
an alert, (when the file size is greater than 0 bytes), but when the
alert clears (file size is zero) the script hangs, or doesn't do
anything, doesn't clear the fob bit. I flipped the logic the opposite
way from the original, so a ground on the fob pin indicates an active
alert. I've checked for typos or syntax and it looks OK to me. Here is
the script:
#!/bin/bash
FOB_BIT=1
# Set node to operate on
if [ -z $1 ]
then
node="46259"
else
node=$2
fi
# Clear bit to start
Current_state=1
while :
do
if [ -s /tmp/AUTOSKY/warnings.txt ]
then
if [ $Current_state = 1 ]
then
/bin/asterisk -rx "rpt cmd $node cop 62 GPIO$FOB_BIT=0"
echo "Alert Active - sending 0 to FOB GPIO$FOB_BIT"
Current_state=0
fi
else
Alert_set=0
if [ $Current_state = 0 ]
then
echo "No Active Alert - sending 1 to FOB GPIO$FOB_BIT"
/bin/asterisk -rx "rpt cmd $node cop 62 GPIO$FOB_BIT=1"
Current_state=1
fi
fi
sleep 5
done
On 11/16/2018 1:42 AM, "Doug Crompton via ARM-allstar" wrote:
> I actually modified the script again after thinking it. I am attaching a
> better updated script. This should work fine. Assuming you are using a
> DMK-URI or other FOB where you can pick up bit 5 hang an LED with a 330 ohm
> or so resistor in series to ground. It should light when there is an alert.
> You can simulate this by doing the following -
>
> echo "test" > /tmp/AUTOSKY/warnings.txt # to turn it on - alert
> echo > /tmp/AUTOSKY/warnings.txt # To turn it off - no alert
>
> See the script for info on changing bits if required. The script assume the
> first node. If you are using a second node you would need to specify it in
> the first parameter to the script - test_alert.sh <node>
>
> Run it in the background after testing - test_alert.sh <node> &
> Best to copy to /etc/asterisk/local and run from there if you are changing
> anything.
> could be called at boot in /etc/rc.local - add line at end.
More information about the ARM-allstar
mailing list