procmail
[Top] [All Lists]

RE: X10 control via procmail

2000-01-07 05:42:40
Hey, that works!!  It took me awhile to figure out that \/ was not a V - 
they look REAL similar in my mail program.  I couldn't figure out how having 
it be a V even made sense.  My next step is to get the regexp to accept the 
'-' and ',' as valid.  I've gotta hit the road now.

===== 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

<Prev in Thread] Current Thread [Next in Thread>