tim2u Posted November 16, 2010 Posted November 16, 2010 I am fairley new to ISY, but understanding most of it pretty well. However, I am trying to create a program that can respond to a down-down-up-down pattern of a controller (togglelinc). I want to fire an action if this pattern is detected in the controller within a 3 sec time frame (that is the pattern must be toggled within 3 sec). This is going to act as a panic switch to turn on a siren. I am pretty sure I will need 4 programs to detect the pattern, but how can I ensure the pattern is entered within 3 secs?
oberkc Posted November 16, 2010 Posted November 16, 2010 I am just throwing out ideas....I have not tried anything like this. I would first create a "status" program (I am thinking others have called this a flag program). I don't think it needs to have anything in it. if then else I would then create a program to monitor the trigger, and change the condition of the status program. if control "togglelinc" set fast off <<then run program "status" (then path) <<wait 3 seconds run program else path <<else You could then create a third, panic, program: if status of program "status" is true and control "toggleinc" set on then do whatever you want in response else Please forgive the syntax. This was done purely by memory of ISY verbage. Hopefully, the intent is clear.
tim2u Posted November 16, 2010 Author Posted November 16, 2010 Thanks for the reply. I think I have a handle on the 'status' program aspect. I've found some more postings that have been helpful, such as the one by ergodic at link below. The hard part for me was how to figure out the 'successive clicks' or ensure all were done within 5 secs or so. I believe the method below will work for me (including the time constraint). If any other ideas, let me know as I am just starting with the ISY programming. http://forum.universal-devices.com/view ... sc&start=0
Goose66 Posted November 17, 2010 Posted November 17, 2010 If you want the originally posted sequence, then you are going to have to have two or more status programs, e.g. PanicStage1, PanicStage2, etc. You will have to set each to true with sucessive commands. The other problem that you have, as pointed out by the first responder, is that the first down-down may be two sucessive offs, or a fast-off, depending on how quick they are done, so that adds at least one additional program. So, in pseudo-code, you have: Three status programs with no conditions or code: 'PanicStep1', 'PanicStep2', and 'PanicStep3' Program 'PanicSeqTimer' with the following: If - No Condidtions - Then Wait 5 seconds Run Program 'PanicStep1' (Else Path) Run Program 'PanicStep2' (Else Path) Run Program 'PanicStep3' (Else Path) Else - No Actions - Program 'PanicSeq1' with the following: If Control 'ToggleLinc' is switched off And Program 'PanicStep1' is false Then Run Program 'PanicStep1' (Then Path) Run Program 'PanicSeqTimer' (Then Path) Else - No Actions - Program 'PanicSeq2' with the following: If Control 'ToggleLinc' is switched off And Program 'PanicStep1' is true And Program 'PanicStep2' is false Then Run Program 'PanicStep2' (Then Path) Else - No Actions - Program 'PanicSeq2a' with the following: If Control 'ToggleLinc' is switched fast off And Program 'PanicStep1' is false Then Run Program 'PanicStep1' (Then Path) Run Program 'PanicStep2' (Then Path) Run Program 'PanicSeqTimer' (Then Path) Else - No Actions - Program 'PanicSeq3' with the following: If Control 'ToggleLinc' is switched on And Program 'PanicStep1' is true And Program 'PanicStep2' is true And Program 'PanicStep3' is false Then Run Program 'PanicStep3' (Then Path) Else - No Actions - And finally program 'PanicSeq4' with the following: If Control 'ToggleLinc' is switched off And Program 'PanicStep1' is true And Program 'PanicStep2' is true And Program 'PanicStep3' is true Then - Panic! - Else - No Actions - Not my cup of tea, but it should work. Note that this will detect any 2 downs followed by an up and then a down in the 5 seconds, regardless of other interspersed commands. For example, down, up, down, down, up, up, down in 5 seconds will trigger the panic. You would think the way to remedy this would be to put Else branches in the programs to clear all the status programs if something is out of sequence, but this would introduce a horrendous circular logic issue since you cannot seperate trigger events of a program from IF statement conditions in the ISY programming model.
Recommended Posts