Here's what I've got at the moment. By replacing the [a-z0-9 ] with a
single . it is now possible to send any command including those that need
punctuation.
:0 Bi
* ^^BR\/.+
|/root/bottlerocket-0.04c/br $MATCH
Here are some example of lines in the message body and what they do:
BR a1 on # turn on device a1
BR -d1,1 # increase dim level (brighten) on device 1 by 1 incriment
BR -d-1,1 # decrease the dim level on device 1 by 1 incriment
BR -D # turn all devices off
===== Original Message from Philip Guenther <guenther(_at_)gac(_dot_)edu> at
1/07/00
1:18 am
Jerry Shenk <jas(_at_)dect(_dot_)com> writes:
I've developed a REALLY simple procmail rule to enable me to control some of
the X10 devices in my house from my SMS phone. My first attempt was to turn
on my Christmas tree lights from my phone (my wife wonders why!).
# This works - case IS significant
:0B
* ^^A1 off
| /root/bottlerocket-0.04c/br A1 off
:0B
* ^^A1 on
| /root/bottlerocket-0.04c/br A1 on
It seems rather inefficient to specify every rule that needs to be run.
Someday, I might want to do a '-d512,1,2,3' to turn on 3 separate strings of
lights. I think I ought to be able to have a keyword at the beginning of a
line (BR perhaps) so that anything after that would be sent as the
command-line parameter to br.
Just capture the rest of the line into the MATCH variable using the \/
regexp token:
:0 Bi
* ^^BR\/[a-z0-9 ]+
|/root/bottlerocket-0.04c/br $MATCH
Everything matched after the \/ token is saved into the MATCH variable.
The 'i' flag on the recipe tells procmail to not complain if the 'br'
program doesn't read in the entire mail message (which I doubt it does).
Philip Guenther
-- Jerry Shenk, Master CNE -
D&E Computer Networking Services, formerly Com Tech Technical Services (717)
569-5800, http://www.dect.com/jas
Snail Mail: 248 Granite Run Drive * Lancaster, PA 17601
Internet E-mail: jas(_at_)dect(_dot_)com
Office Fax (don't fax me here): (717) 560-1682
Personal Fax via www.efax.com: (603) 250-1453