FarmerGeek Posted July 17, 2021 Posted July 17, 2021 Have a 994i and noticed recently that the wait function is not working. have it in several scripts and everyone stops when it gets to the wait command. Any suggestions?
MrBill Posted July 17, 2021 Posted July 17, 2021 3 minutes ago, FarmerGeek said: Have a 994i and noticed recently that the wait function is not working. have it in several scripts and everyone stops when it gets to the wait command. Any suggestions? Have you tried restarting the ISY? Next suggestion would be to check the error log (Tools > Error Log) and see if there are any clues there. Another question is what does the program do? Post examples... If any of the conditions change during the wait state, it will end the wait state. This is by design and not a bug.
apostolakisl Posted July 17, 2021 Posted July 17, 2021 Did the "wait" used to work? Typically, when people say the "wait" isn't working, it is because the program starts over because of a condition being met within the "if". 2
FarmerGeek Posted July 18, 2021 Author Posted July 18, 2021 Yes the wait command used to work. reset, disconnected power and left off for 10 min Can't figure out how to copy/past code. but here is the basic idea if door violated (signal I get from my elk) Than turn on entry light turn on garage light $GarageEntry=2 want 10 minutes $GarageEntry = 3 turn off garage light turn off entry light $GarageEntry=0 else (no else) GarageEntry gets set to 2 and never changes. here is the error log Time User Code Message Sun 2021/07/18 09:10:52 AM System -5012 53 Sun 2021/07/18 04:21:43 PM System -5006 uuid:53 Sun 2021/07/18 04:21:44 PM System -5006 uuid:53 Sun 2021/07/18 04:21:50 PM System -5006 uuid:55 Sun 2021/07/18 04:21:50 PM System -5006 uuid:55 Sun 2021/07/18 04:21:50 PM System -5006 uuid:55
MrBill Posted July 18, 2021 Posted July 18, 2021 to paste code, right click the program name in the program tree, and select Copy to Clipboard. Then click into a post and either just hit Ctrl-V (paste) or click the "<>" symbol in the toolbar first, and then Paste into the 'code' window that pops up. I believe your problem is as I alluded to here: On 7/17/2021 at 2:16 PM, MrBill said: Another question is what does the program do? Post examples... If any of the conditions change during the wait state, it will end the wait state. This is by design and not a bug. and apostolakisl also mentioned On 7/17/2021 at 4:49 PM, apostolakisl said: Did the "wait" used to work? Typically, when people say the "wait" isn't working, it is because the program starts over because of a condition being met within the "if". If the status of the door changes during the wait, then the program will stop and not finish. The method to get around it is to use two programs (and there is two choices there as well) Program checkfrontdoor If frontdoor is violated then run program frontdoorviolated (then) else (nothing) Program frontdoorviolated (disabled) If (nothing) then turn on entry light turn on garage light $GarageEntry=2 wait 10 minutes $GarageEntry = 3 turn off garage light turn off entry light $GarageEntry=0 else (no else) In this program, the end will be reached if the door becomes no longer violated while the waits are running. However if the door is re-violated during the wait the program will start again from the top. One more version: Program checkfrontdoor If frontdoor is violated then run program frontdoorviolated (then) else (nothing) Program frontdoorviolated (disabled) If (nothing) then Disable checkfrontdoor turn on entry light turn on garage light $GarageEntry=2 wait 10 minutes $GarageEntry = 3 turn off garage light turn off entry light $GarageEntry=0 Enable checkfrontdoor else (no else) In this version we added the disable and enable to the then body, this will cause the first program to ignore more violations until the second program finishes. The second program should be always disabled, disabled programs still run when told to by another program, but not because the condition in the IF statement became true. 1
FarmerGeek Posted July 19, 2021 Author Posted July 19, 2021 what is the (than)? wrote a script that has no if just than. turns on a light, sets a bar. waits 2 min than turns the light off and sets the bar back to 0. disabled it than ran. works. tks.
apostolakisl Posted July 20, 2021 Posted July 20, 2021 @FarmerGeek It appears that your program doesn't work because the door that is violated is then restored prior to 10 minutes. This re-triggers the program and is now false and the "else" clause is empty. If you moved your "wait" and everything after it to the "else" clause it would probably work as you intend, though I'm not 100% sure on that since I don't fully understand the intent. It is easy to see what is happening by simply watching the status of the program in the program tree in ISY console while you violate and then restore the zone. You will see the program go from inactive (half red or half green . . . in your case half red), to solid green (running then) when the zone is violated. It will stay this way as long as the zone is violated or until 10 minutes expires (at which time it will turn half green if the zone is left violated). As soon as you restore the zone, the solid green (indicating the wait is running) will turn half red (indicating the program just evaluated to false and terminated. If you put the wait etc in the else, the wait won't start until you restore the zone, at which point it will turn solid red for 10 minutes and then half red (unless you violate the zone again prior to 10 minutes at which point the process starts over. 1
larryllix Posted August 8, 2021 Posted August 8, 2021 (edited) Also, you may want to note: You are disabling the IF section of a program with no IF lines in the section. There is nothing to disable. Edited August 8, 2021 by larryllix
Recommended Posts