procmail
[Top] [All Lists]

Re: X10 control via procmail

2000-01-06 23:21:55
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

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