LinuxMCE Forums

General => Users => Topic started by: toko on February 23, 2008, 05:05:27 PM

Title: delay secenario or ruby-code more than 20sec
Post by: toko on February 23, 2008, 05:05:27 PM
what I want to get as result:
put GO status for channel 1 via GSD -> wait 60sec -> remove the GO status from channel 1

I control blinds via GSD and ruby-codes. When I click DOWN ("go" status is set) function it starts moving downl the blinds but this task needs about 1min. time. So what I want is to give the command DOWN, wait 60sec and then call STOP ("go" status is set to off) function.

problem:
I can use ruby function "sleep 60" but from linuxmce there's timeout of 20sec and then I get in my logs something like
QuoteRuby was unable to handle the command in reasonable amount of time

how can I handle that - is there any function in scenario-edit I could use (I put it under lightning-scenario)?
can I increase the ruby timeout to 2 min. maybe manually... where?

Thank You!
thomas
Title: Re: delay secenario or ruby-code more than 20sec
Post by: bulek on February 23, 2008, 08:10:36 PM
Hi,

you can also register and run Ruby program outside GSD mechanism. You can register with DCERouter through 2 tcp ports and then it's all up to you what to do and when to do ....

http://wiki.linuxmce.org/index.php/Message_Interceptors (http://wiki.linuxmce.org/index.php/Message_Interceptors)
http://wiki.linuxmce.org/index.php/Plain_Text_DCE_Messages (http://wiki.linuxmce.org/index.php/Plain_Text_DCE_Messages)

HTH,

regards,

Bulek.
Title: Re: delay secenario or ruby-code more than 20sec
Post by: ddamron on February 23, 2008, 09:14:04 PM
Toko,
create yourself a Global variable to hold the time.  Don't sleep, as you need to return control back to linuxmce.

Then , in Process IDLE, you can compare that global time variable with the current time...
and stop it when it gets close to 60 seconds..

The Process IDLE command is fired at your code about every 3-4 seconds.  I use that to check for timeouts.

HTH, and good luck!

Dan