Jump to content

2.4.15: short Wait gets stuck if there is nothing after it


evarsanyi

Recommended Posts

I'm trying to build a cascade of 3 programs that cycle based on X10 events (ie: I want to have the state of 3 programs reflect if an X10 ADDR+ON was received once, twice, or 3 times in a short time span). I don't know if this will work at all yet (I don't really understand how to set a program status explicitly), but I ran into this minor issue:

 

If I run the program below and it is triggered it gets stuck in 'Running Then' (apparently forever) unless another L9/On is received at this point it stops. After this each L9/On causes it to very briefly flash to Running Then and back to Idle again (it does not wait 5 seconds). If I put a 'Notify All' after the Wait 5 seconds it runs exactly 5 seconds every time I get an L9/On.

 

If
       X10 'L9/On (3)' is Received
Then
       Wait  5 seconds
Else
  - No Actions - (To add one, press 'Action')

Link to comment
  • 4 weeks later...

evarsanyi,

 

I am not sure why you would even add the wait in the "Then". The status of a program is independent of it performing any action.

 

With kind regards,

Michel

No word. I haven't really been able to build any sort of state machines with this thing yet unless I use device state as a variable. I'm not keen on buying a bunch of LampLinc's to use as program variables so I gave on this tack for now.
Link to comment

Yeah, I think that's what I was up to here. The idea was this program would provide a condition to help detect (in another program) a double button press (2 L9 on's in a short time span). My plan was to have 2 other program that did things, one based on a second press within the 5 seconds and one that would occur if a 2nd press wasn't received in 5 seconds.

 

I think I also wanted to use a program as a simple state variable (with a very long wait), it would start when I wanted to set the variable and would be stopped when I wanted to clear it. I never went down that path because there didn't seem to be a way to keep it stuck in a state I wanted easily (using wait, maybe there's another good way).

 

My attempt here is clearly not using it the way it was intended, I'm happy enough to wait for a future release with actual state variables that can be set/cleared/tested and maybe some way to do edge triggering (events) rather than level triggering on states (the level triggering doesn't mesh well with some of the events, like time or X10 which are discreet).

Link to comment

evarsanyi,

 

Now I understand! We shall be working on Trigger 2.0 and some X10 enhancements in the next releases!

 

Thanks so very much,

With kind regards,

Michel

 

Yeah, I think that's what I was up to here. The idea was this program would provide a condition to help detect (in another program) a double button press (2 L9 on's in a short time span). My plan was to have 2 other program that did things, one based on a second press within the 5 seconds and one that would occur if a 2nd press wasn't received in 5 seconds.

 

I think I also wanted to use a program as a simple state variable (with a very long wait), it would start when I wanted to set the variable and would be stopped when I wanted to clear it. I never went down that path because there didn't seem to be a way to keep it stuck in a state I wanted easily (using wait, maybe there's another good way).

 

My attempt here is clearly not using it the way it was intended, I'm happy enough to wait for a future release with actual state variables that can be set/cleared/tested and maybe some way to do edge triggering (events) rather than level triggering on states (the level triggering doesn't mesh well with some of the events, like time or X10 which are discreet).

Link to comment
Hello evarsanyi,

 

So, you want the status of the program to be true only for 5 seconds?

 

With kind regards,

Michel

I was trying to use the program itself (its status) as a state variable that was true for 5 seconds (and could be tested from other programs).

 

The program you have posted will remain True because the last thing it ran was the 'Then'. To make it False after 5 seconds, add one more line:

 

Program: ThisProgram

If 
       X10 'L9/On (3)' is Received 
Then 
       Wait  5 seconds 
       Run program 'ThisProgram' (Else Path)

Else 
  - No Actions - (To add one, press 'Action')

Link to comment
The program you have posted will remain True because the last thing it ran was the 'Then'. To make it False after 5 seconds, add one more line:

 

Program: ThisProgram

If 
       X10 'L9/On (3)' is Received 
Then 
       Wait  5 seconds 
       Run program 'ThisProgram' (Else Path)

Else 
  - No Actions - (To add one, press 'Action')

 

Chris, thanks so much! I was just getting ready to ask whether a program could call itself, and you've answered that. I am assuming that one with no condition would also work:

 

Program: ThisProgram

If 
  - No Conditions -
Then 
       Wait  5 seconds 
       Run program 'ThisProgram' (Else Path)

Else 
  - No Actions - (To add one, press 'Action')

 

Just out of curiosity, would the following loop work:

 

Program: ThisProgram

If 
  - No Conditions -
Then 
       Wait  5 seconds 
       Run program 'ThisProgram' (Else Path)

Else 
       Wait  5 seconds 
       Run program 'ThisProgram'

 

I would probably never do that without a terminating condition, but wonder whether it would work?

Link to comment

Your first example will work as you have described, but unfortunately due to a bug, your second program will not loop as you described. You could use two programs as a workaround to this bug.

 

The bug is that if you run a program from itself, it will continue running the current actions even though the program true/false may have changed.

 

I have logged this bug and it will be fixed in the next release.

 

Here's the workaround for your second program:

Program: ThisProgram 

If 
  - No Conditions - 
Then 
       Wait  5 seconds 
       Run program 'RunThisProgram' (Else Path) 

Else 
       Wait  5 seconds 
       Run program 'RunThisProgram' 

Program: RunThisProgram

If 
  - No Conditions - 
Then 
       Run program 'ThisProgram'  

Else 
       Run program 'ThisProgram' (Else Path)

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...