larryllix Posted August 20, 2015 Posted August 20, 2015 I know v5.x alpha has a Repeat while x=x structure from the Wiki preview. Can this be extended to the Wait command? Perhaps this could be migrated to the Wait command also in future, if not already installed in v5.x. If --- Then Set $sdone = 0 Run 'flash lights' (if) Wait while $sdone is 0 Run 'flash lights' (if) Wait while $sdone is 0 Run 'flash lights' (if) Else ---- Program flash lights If whatever condition Then Set 'Lights' On Wait X seconds Set 'Lights' Off Set $sdone = 1 Else ---- This could eliminate retriggering unknown time delay sequences and insure completion. This may be very useful for door lock programming where the user wants to insure an action has taken place before proceeding further in a program. This would require triggered variables and events only due to the constant reevaluation of the condition required by the ISY engine. I believe this should be no different than the 'repeat while' implementation. Edit: Using the "Repeat while" construct the higher level "Repeat" is in control of condition re-evaluation so a state variable is not required for condition re-evaluation. With "Wait while" the ISY engine would have to cause re-evaluation of the condition. Thus only triggering elements could be used in conditions.
Michel Kohanim Posted August 21, 2015 Posted August 21, 2015 Hi larryllix, Thanks so very much for the feedback. I will consult with the team. This said we do have high priority tasks such as Z-Wave multi channel which cannot be put on hold. With kind regards, Michel
Michel Kohanim Posted August 21, 2015 Posted August 21, 2015 Hi larryllix, I know you don't want to use 1 second increments. But for now you can use something like this : New Program - [ID 001F][Parent 0001] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set '07.CF.46.1' On Repeat While $Int_1 > 0 Wait 1 seconds $Int_1 -= 1 Repeat 1 times Set '07.CF.46.1' Off Else - No Actions - (To add one, press 'Action') With kind regards Michel
larryllix Posted August 21, 2015 Author Posted August 21, 2015 Hi larryllix, I know you don't want to use 1 second increments. But for now you can use something like this : New Program - [ID 001F][Parent 0001] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set '07.CF.46.1' On Repeat While $Int_1 > 0 Wait 1 seconds $Int_1 -= 1 Repeat 1 times Set '07.CF.46.1' Off Else - No Actions - (To add one, press 'Action') With kind regardsMichel Thanks Michael. Since I don't run 5.0 alpha I hadn't thought of that yet. I don't understand how this could pass a flag from one subroutine program back to the calling program. My idea was that a calling program could sequence other programs by calling them in order and yet the execution would never overlap as the calling program would know when the sub was complete passing a semaphore back via the control variable/flag. Think "selectively block IRQ" in low-level languages? I thought this could be done with right now with 4.x -- using multiple programs not multiple calls to a subroutine. Programs would have no pecking order without multiple variable and huge complexity. My example failed in creation so I won't post it.
Michel Kohanim Posted August 23, 2015 Posted August 23, 2015 Hi larryllix, Thanks so very much for the details alas I don't understand what is being suggested. What I posted is very similar to your code. With kind regards, Michel
larryllix Posted August 23, 2015 Author Posted August 23, 2015 Hi larryllix, Thanks so very much for the details alas I don't understand what is being suggested. What I posted is very similar to your code. With kind regards, Michel Thanks Michel My construct will Wait until another program signals OK to continue or whatever condition the user wants. Your example seems based on only time. Maybe the second controlling second program was implied in your example. Below, from your program on 1 second increment idea, could possibly function equivalent, I suppose the "Wait 1 seconds" could not be eliminated as the program would not give up it's processing time to allow the other program to run then. Or maybe it could if 'Repeat While' allows time slice surrender? If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Run 'New Program2' (if) Set $Int_1 = 1 Repeat While $Int_1 > 0 <------dependent on 'New Program2' finishing Wait 1 seconds Repeat 1 times Run 'New Program2' (if) <------guaranteed not to retrigger timer in other program Set $Int_1 = 1 Repeat While $Int_1 > 0 Wait 1 seconds <-------can this be eliminated without harm? Repeat 1 times Else - No Actions - (To add one, press 'Action') New Program2 - [iD 0020][Parent 0001] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set '07.CF.46.1' On Wait some time Set '07.CF.46.1' Off Set $Int_1 = 0 <-----------give the OK to proceed elsewhere = I'm finished Else - No Actions - (To add one, press 'Action')
apostolakisl Posted August 23, 2015 Posted August 23, 2015 All repeat clauses must have something in them or they don't repeat. So your "wait 1 second" or really any command would be required. If you wanted a more instantaneous result you could put a line in there to just keep setting an otherwise unused variable. For example Repeat while $variable > 1 $otherwiseunusedvariable = 1 Repeat 1 time other stuff The above would basically translate into a "wait until $variable > 1" The "repeat 1 times" as the last line of the then clause serves no purpose since nothing is after it. But I assume you will put something there since the "repeat while" before it also would therefore also serve no purpose. EDIT: Also I should mention, there is a much easier way to do what you want. The date programs I wrote do it this way. IF whatever Then do something run then or if program 2 Program 2 IF whatever Then do something run then or if program 3 Program 3 IF whatever THEN do something run then or if program 4 ETC.
Michel Kohanim Posted August 24, 2015 Posted August 24, 2015 Hi larryllix, apostolakisl is correct! With kind regards, Michel
rlanza1054 Posted August 26, 2015 Posted August 26, 2015 How about change the request from 'wait while' to 'until' ad not make it a timed condition but a condition of state. 'wait until' itsn't that diiferent from an IF. 'WAIT UNTIL DEVICE X IS ON' Right now you have to write a seperate program to have it do the repeat of waiting until a condition is true or false. I'm a newbie, so maybe I don't yet have enough experience to make any comments about this just yet. But figured it doesn't hurt to ask. Rob
apostolakisl Posted August 26, 2015 Posted August 26, 2015 How about change the request from 'wait while' to 'until' ad not make it a timed condition but a condition of state. 'wait until' itsn't that diiferent from an IF. 'WAIT UNTIL DEVICE X IS ON' Right now you have to write a seperate program to have it do the repeat of waiting until a condition is true or false. I'm a newbie, so maybe I don't yet have enough experience to make any comments about this just yet. But figured it doesn't hurt to ask. Rob Seems reasonable, but since you can do the exact same thing with a second program, I wouldn't put this high on my list of wants. If whatever Then whatever enable program 2 Program 2 if the same condition you would have put in the "wait until" above then whatever disable program 2 It would be nice to have a "wait $variable minutes/seconds/hours" option though. I thought this was going to be part of the 5.0 firmware variable substitution additions, but it isn't there.
rlanza1054 Posted August 26, 2015 Posted August 26, 2015 That was the point, you have to build a second program? I was recommending it so you would no longer have to use a second program. Being the newbie, I am still thinking in linear terms, not this event based programming. Rob.
apostolakisl Posted August 27, 2015 Posted August 27, 2015 That was the point, you have to build a second program? I was recommending it so you would no longer have to use a second program. Being the newbie, I am still thinking in linear terms, not this event based programming. Rob. Also, wait "until" vs wait "while" (neither being available of course) are only semantically different. wait until device x is on wait while device x is not on the above 2 are the same thing. The following is actually available: repeat while device x is not on (functional equivalent to repeat until device x is on) With ISY folder structure for programs, I don't have a big problem with 2 programs that are roughly half as big as one program since I can drop them into a folder structure and consider the folder as the program. I agree, it would generally be cleaner to have one program, but UD does not have a gigantic team of coders and I tend to prefer they get features added that just don't exist at all vs making others a bit cleaner.
rlanza1054 Posted August 28, 2015 Posted August 28, 2015 but UD does not have a gigantic team of coders and I tend to prefer they get features added that just don't exist at all vs making others a bit cleane I totally agree with that! Rob
Michel Kohanim Posted August 29, 2015 Posted August 29, 2015 Thank you all! With kind regards, Michel
Recommended Posts
Archived
This topic is now archived and is closed to further replies.