LinuxMCE Forums

General => Developers => Topic started by: derailed on February 15, 2009, 07:21:47 PM

Title: Registering a Message Interceptor....
Post by: derailed on February 15, 2009, 07:21:47 PM
Hi,

   I am trying to register an exec to catch various events. I have put a shell script in /usr/pluto/bin and was hoping for this exec to be invoked when in this case lighting events occurs. I am following the post on the wiki to set up my interceptor, which was added as a child device (#43) of core with a generic#1 template.

   I register my interceptor using the following command:

MessageSend localhost 43 -1000 8 0 5 2 4 73 6 192

DCE log says

Device 43 registered Message interceptor 0/0/0/73/2/192 <0x6d8c7b90>

all good so far... ( I think ? )

Then I issue the following cmd to turn the light on

MessageSend localhost -r 0 42 1 192

Now the dce log says

The target device 43 (routed to 43) has not registered. <0x6d8c7b90>

Any ideas ?

The just of it: I would like to trap device events and have some custom code run when specific events take place. I am hoping I could register an interceptor to get callbacks when certain events get trigger on adhoc devices with some info for which device fired the event and which event occurred....

Is this achievable ? Is so can someone shed some light ?


Many Thanks !!
Title: Re: Registering a Message Interceptor....
Post by: chrisbirkinshaw on February 20, 2009, 06:26:46 PM
You have registered an interceptor and then tried to send a command to it. This is not what interceptors are for. The idea is that you set up an interceptor to catch all lighting plugin messages, then when a message is sent to a light they are also sent to the target in your interceptor.

My wiki page may be of some use, as I hacked something together which does what you are trying to achieve.

http://wiki.linuxmce.org/index.php/User:Chrisbirkinshaw

BTW why do you want to do this? If you just want to run code on events then you can already do this through the web admin respond to events pages. If you have a case for which this does not work I am interested as I am trying to collect all such cases and propose some changes.

Chris
Title: Re: Registering a Message Interceptor....
Post by: ddamron on February 24, 2009, 11:35:45 PM
Agreed.

If you really are stuck, do a wiki search for some of my code.
Insteon, PLCBUS, and ThreadedRuby.

All of those implement Lighting.

Good Luck.

Dan
Title: Re: Registering a Message Interceptor....
Post by: derailed on February 25, 2009, 01:37:13 AM
Hi Chris, Dan,

   Thanks so much for the response. Very useful insights....

-F