CM15A\CM11A pause/delay

Post Reply
Message
Author
User avatar
dbemowsk
Posts: 442
Joined: Sun Jan 01, 2012 12:28 pm
Location: Wisconsin
Contact:

CM15A\CM11A pause/delay

#1 Post by dbemowsk » Mon Jan 21, 2013 11:38 pm

OK, here is my scenario, at certain times of the day I have scripts that turn on or off multiple X10 controllers in a string of events. My best example is at 11:00 at night I have the system shutting my garage door, turning off my kitchen fish tank, turning off my living room fish tank, and turning off my basement fish tank. Sometimes in the middle to end of this string of shutdown events, some controllers do not shut off. I am guessing that this is possibly from signal collisions on the power line from everything being sent at once or at least so close together. In the past when I ran ActiveHome Pro, there was a pause feature that you could include in a macro, so what I did was add 1 second pauses between commands to give the system time to catch up. Here is a post in the X10 frums that discusses this very thing. OSA does not have this kind of feature, and I believe that others in here and possibly even myself a ways back have inquired about something like this. I think I have come up with a solution at least for the X10 side of OSA with the CM15A and CM11A plugins.

The solution would involve command queueing. Basically you would have a user property for the delay in seconds. If set to 0, which would be the default, the plugin should basically run the way it does now. Any value greater than 0 would cause all received commands to be put into a queue. A timer thread can run in the background that runs each command in the queue placing the desired pause/delay between each one until all items in the queue are executed. With the timer thread running in the background, other OSA proceses should be able to run normally. The timer does not have to be running at all times. When a command comes in, it will add the command to the queue array and start the timer if it is not already running.

I think that adding this kind of thing to the plugin would greatly improve some of the glitchiness I have with my system at times. I think others that have full X10 systems can also attest to this. I am interested to hear others thoughts on this topic also.

Dan

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: CM15A\CM11A pause/delay

#2 Post by bwoodworth » Tue Jan 22, 2013 9:42 am

I think there may be a better way to do this globally. We can create a command on the SYSTEM object called PAUSE with a parameter of an integer to represent seconds. When the service sees that command it will pause for the specified number of seconds before continuing to query the command queue. Only downside is it would affect all methods, not just the ones in the script, but this is probably not a big deal.
Brian

Datahead
Posts: 710
Joined: Fri Jan 27, 2012 6:50 am
Location: San Marcos, Ca.

Re: CM15A\CM11A pause/delay

#3 Post by Datahead » Tue Jan 22, 2013 12:49 pm

If I read you right Brian you are talking about a pause command in the script editor? If so yes that would be a cool feature. As I am using X-10 also I to have run into the issue that Dan was speaking of.

User avatar
dbemowsk
Posts: 442
Joined: Sun Jan 01, 2012 12:28 pm
Location: Wisconsin
Contact:

Re: CM15A\CM11A pause/delay

#4 Post by dbemowsk » Tue Jan 22, 2013 1:13 pm

Brian,

I figured that since this affects mostly X10 equipment, that it could be kept to those modules. No sense in wasting precious CPU cycles for things that do not need the delay. The command you are talking about on the SYSTEM object, would that just be something that could be inserted into a script like;

Living room light.Run Method.On
SYSTEM.PAUSE.2 (this would pause for 2 seconds)
Garage door.Run Method.On
SYSTEM.PAUSE.1 (1 second)

Datahead, Just for a second opinion, does the option that I outlined initially sound like a workable solution for the X10 side of things?

Dan

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: CM15A\CM11A pause/delay

#5 Post by bwoodworth » Tue Jan 22, 2013 1:53 pm

Yes, that is exactly the kind of thing I was thinking of. Another option would be to actually just create syntax into the script processor to pause between putting commands into the queue. That might be better since it wouldn't affect other commands that originate elsewhere.
Brian

User avatar
dbemowsk
Posts: 442
Joined: Sun Jan 01, 2012 12:28 pm
Location: Wisconsin
Contact:

Re: CM15A\CM11A pause/delay

#6 Post by dbemowsk » Tue Jan 22, 2013 3:27 pm

bwoodworth wrote:Yes, that is exactly the kind of thing I was thinking of. Another option would be to actually just create syntax into the script processor to pause between putting commands into the queue. That might be better since it wouldn't affect other commands that originate elsewhere.
Good point. I suppose that would be better than my original suggestion, because then the delay times could be varied and used in many other ways. I am guessing that being the script processor that this would be up Vaughn's alley?

Dan

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: CM15A\CM11A pause/delay

#7 Post by bwoodworth » Tue Jan 22, 2013 4:30 pm

Yeah, Vaughn would probably be the one to add that in. He has been trying to get back up to speed with gitHub, so he might be able to get to this soon
Brian

Post Reply