C Martin Posted November 7, 2011 Posted November 7, 2011 I have been seeing some inconsistency with the wait command whenever it is greater than 30 seconds. I had programs fail to execute the next command after the wait command in my programs whenever the wait is avbve 30 seconds. Sometimes the commands happen as they are supposed to and other time after a prolonged period of time and sometimes, not at all. Could this this be caused by program changes with the firing of threads that has been modified? Clarence PS. I will revert to an earlier version later to test this if necessary.
C Martin Posted November 7, 2011 Author Posted November 7, 2011 Update: the reason that I suspect the wait command is because the times are not consistent and I am using a program to control a Scene. The scene works manually so communication issues should not be the problem. I moved back to 3.1.9 and the problem still is still there. SO, I am currently at a loss as to what is happening. I did do a series of test starting with a 5 second wait all the way to 60 seconds. Failures would start at 35 second waits. The wait of 25 seconds seems to be better but not always consistent. Clarence
C Martin Posted November 7, 2011 Author Posted November 7, 2011 More Info: this is the program that I am using: If ( Status 'Motion Sensors / Closet / Closet Motion Sensor-Sensor' is On And $s_Is.SleepTime is 0 And $s_ClosetOveride is 0 ) Then Set Scene 'Scenes / Closet Motion' On Wait 45 seconds Else - No Actions - (To add one, press 'Action') Checking the program status, the program actually runs through the whole process, as checked in the program status tab, and with the correct delay. The last command "Set Scene 'Scenes / Closet Motion' Off" is not executed.
C Martin Posted November 7, 2011 Author Posted November 7, 2011 this is the event log: Mon 11/07/2011 10:52:41 AM : [ 14 60 DF 1] CLIHUM 71 Mon 11/07/2011 10:52:50 AM : [ 13 F4 BC 1] DON 1 Mon 11/07/2011 10:52:50 AM : [ 13 F4 BC 1] ST 255 Mon 11/07/2011 10:52:51 AM : [ E E0 F8 1] ST 216 Mon 11/07/2011 10:52:51 AM : [ X10] M9 Mon 11/07/2011 10:52:51 AM : [ X10] M9/On (3) Mon 11/07/2011 10:53:05 AM : [ X10] A1 Mon 11/07/2011 10:53:05 AM : [ X10] A1/On (3) Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 1] 565000.000000 Weather - Temperature = 56.5 °F Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 5] 23000.000000 Weather - Temperature Rate = 2.3 °F/h Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 6] 510000.000000 Weather - Humidity = 51 % Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 11] 30000.000000 Weather - Wind Speed = 3 mph Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 13] 100000.000000 Weather - Wind Direction = SSW Mon 11/07/2011 10:53:14 AM : [MOD 2 2 1 19] 0.000000 Weather - Light Rate = 0 %/h Mon 11/07/2011 10:53:19 AM : [ 13 F4 BC 1] DOF 1 Mon 11/07/2011 10:53:19 AM : [ 13 F4 BC 1] ST 0
apostolakisl Posted November 7, 2011 Posted November 7, 2011 First, not to state the obvious, but your program doesn't have any commands after the "wait". Perhaps this is a cut/paste oversight. Generally, the reason "wait" commands don't work is becuase something in the "if" section got triggered. You have 3 "status" items in the "if" section. I assume the variables are state variable judging by the "s" you used in naming. If the status of any of those 3 things changes, your program will terminate and the "if" clause will re-eval. If it evaluates to "false" then your "else" clause will run. For example, you trip your motion detector. The state turns turns to "on". The motion detector has a built in time-out function I assume. After so many seconds it reverts to "off". If the "wait" wasn't done, then the stuff after the wait will never happen. The program would have terminated (cancelling the wait) when the motion detector reverted to "off" and the else would run (which is blank). The command to turn off the scene never is sent becuase the program terminated prior to the 45 sec wait period. The best way to fix this is with two programs. If Status 'Motion Sensors / Closet / Closet Motion Sensor-Sensor' is On And $s_Is.SleepTime is 0 And $s_ClosetOveride is 0 Then Run 'program 2' then Else - No Actions - (To add one, press 'Action') Program 2 If - - (leave it blank) Then Set Scene 'Scenes / Closet Motion' On Wait 45 seconds Set Scene 'Scenes / Closet Motion' Off Else - No Actions - (To add one, press 'Action') With this setup, the timer will get reset in the event that the first program triggers to true before the 45 seconds is up, but if it turns false, the second program will still finish the timer. I also should note, that you could use "control" instead of status to avoid this problem. I do not own any insteon motion detectors, so I don't know if "control" is allowable. Control is only a trigger when it actually happens. Like "control on" only terminates a program for re-eval if the thing is actually turned on. All other actions are ignored. (Also, you don't need those parenthesis)
LeeG Posted November 7, 2011 Posted November 7, 2011 C Martin I don't understand why the Wait is coded in the Program as it serves no function. The Program will be retriggered regardless of the Wait. The If Status may by the source of variance. The Status must change before the Program is triggered again. This means the Motion Sensor MUST timeout and issue an Off command to change the Status to Off before a Status change to On will trigger the Program Then clause again. The Motion Sensor resets its timeout value each time it detects motion so the time to the next Off and therefore the possibility of the next Status On will vary based on what the Motion Sensor is seeing in it field of view. Lee
C Martin Posted November 7, 2011 Author Posted November 7, 2011 Sorry, I did something stupid with my copy /paste This is the program My motion sensor is set up to not trigger on the "off" so there is nothing that will re-trigger the program and change the if Status, other than the s_ClosetOveride. If ( Status 'Motion Sensors / Closet / Closet Motion Sensor-Sensor' is On And $s_Is.SleepTime is 0 And $s_ClosetOveride is 0 ) Then Set Scene 'Scenes / Closet Motion' On Wait 45 seconds Set Scene 'Scenes / Closet Motion' Off Else - No Actions - (To add one, press 'Action') Sorry for the mis-leading paste. Clarence
LeeG Posted November 7, 2011 Posted November 7, 2011 If the Motion Sensor is configured for On Only, remove that part of the If statement as it only adds confusion to how the Program works. Post all Programs which affect the two state variables. Same basic cause, just variable related rather than Motion Sensor commands.
C Martin Posted November 7, 2011 Author Posted November 7, 2011 Lee G, the motion sensor "on" is the trigger for the scene. Sleep_Time If From 9:00:00PM To Sunrise (next day) Then $s_Is.SleepTime = 1 Else $s_Is.SleepTime = 0 Closet Over_Ride If Status 'Interior Lights / Closet Lights / Closet Companion Switch' is On Then Set 'Interior Lights / Closet Lights / Closet Dimmer' 90% $s_ClosetOveride = 1 Wait 45 minutes Set 'Interior Lights / Closet Lights / Closet Dimmer' Off Set 'Interior Lights / Closet Lights / Closet Companion Switch' Off $s_ClosetOveride = 0 Else - No Actions - (To add one, press 'Action')
C Martin Posted November 7, 2011 Author Posted November 7, 2011 Lee G, this program use to work flawlessly. I can't understand what could have changed. I triggered the MS in order for the program to run and watched my 2 variables to make sure that their state didn't change. for some reason, the command after the wait is not triggered as shown in the event log.
LeeG Posted November 7, 2011 Posted November 7, 2011 This line indicates the Motion Sensor turns On Mon 11/07/2011 10:52:50 AM : [ 13 F4 BC 1] ST 255 This line nominally 30 seconds later indicates the Motion Sensor turns Off Mon 11/07/2011 10:53:19 AM : [ 13 F4 BC 1] DOF 1 First, this means the Motion Sensor is NOT operating in On Only mode. Second this means the Program was triggered at On +30 seconds with the Off command, interrupting the Wait 45 seconds, running the Else clause because the IF is now False. The statements after the Wait 45 NEVER run. The variation is if the Motion Sensor “sees†more motion the Motion Off will be delayed because the MS timeout value is reset to a full timeout value for every motion sensed. If enough motion is sensed such that the Motion Off message occurs after the Wait 45 expires the statements after the Wait 45 execute,
C Martin Posted November 8, 2011 Author Posted November 8, 2011 Lee G, Thanks for the review. I thought that I disabled the Off for the MS. I'll take another look and make sure that the "Off" Trigger is disabled. Clarence
apostolakisl Posted November 8, 2011 Posted November 8, 2011 Lee G,Thanks for the review. I thought that I disabled the Off for the MS. I'll take another look and make sure that the "Off" Trigger is disabled. Clarence Excuse my ignorance here, not owning an insteon motion sensor. But how does it only trigger on "on". Do you mean that it only sends out an "on" PLC command and never anything else? In ISY, a program with an if clause containing "status", will only trigger when the status changes. So, if the sensor only sends "on" commands, it would never trigger the program since it only receives repeat "on" messages. For the program to trigger, you would need it to be a control statement ("if switched on"). But again, I don't know how ISY motion sensors do their com. Your variables being state variables will also trigger the program if they change while the program is running. I don't know what could change them or when, but that is a possibility. Integer variables would not have that problem. I still would bet your motion sensor is changing state during the 45 seconds and causing the program to terminate prematurely. EDIT: OK, I just saw that you included what sets your two variables. I would suggest that you change those to integer variables since I don't see that you ever want them to be triggers.
LeeG Posted November 8, 2011 Posted November 8, 2011 apostolakisl “Excuse my ignorance here, not owning an insteon motion sensor. But how does it only trigger on "on". Do you mean that it only sends out an "on" PLC command and never anything else?†Yes. Known as On Only mode. MS never sends an Off command. Useful when the Motion On turns Responders On directly with a Scene and automation is used to turn the Responders Off based on more than an absolute MS timeout interval if Off commands were allowed to flow. “In ISY, a program with an if clause containing "status", will only trigger when the status changes. So, if the sensor only sends "on" commands, it would never trigger the program since it only receives repeat "on" messages. For the program to trigger, you would need it to be a control statement ("if switched on"). But again, I don't know how ISY motion sensors do their com.†Agree completely. I think the Program was always exposed to the timing issue. If the Motion Sensor was ever in On Only mode the If Status would never trigger the Program (except for the first Motion ON following an ISY boot). “I still would bet your motion sensor is changing state during the 45 seconds and causing the program to terminate prematurely.†Also agree as the posted event trace shows the Motion Off being received Motion On + 30 seconds (default MS timeout interval) which is before the Wait 45 time expired. Lee
polexian Posted November 8, 2011 Posted November 8, 2011 When you use the wait command when the wait is over it reevaluates the if command. If it is now false the program stops. To fix do this Make a program that doesn't have an if statement then in the then put the wait statement the. Turn off the scene. Disable program so it doesn't run unless called and save In your old program instead of the wait statement just call the new program. It will run the wait then turn off the scene Sent from my iPhone using Tapatalk
apostolakisl Posted November 8, 2011 Posted November 8, 2011 apostolakisl Yes. Known as On Only mode. MS never sends an Off command. Useful when the Motion On turns Responders On directly with a Scene and automation is used to turn the Responders Off based on more than an absolute MS timeout interval if Off commands were allowed to flow. Lee, So, again not owning one of these devices, when it sends an "on" statement, is it equivalent to pushing an "on" on a switchlinc? In other words, would simply replacing "status on" to "control switched on" be recognized? This would avoid needing two programs and would keep resetting the 45 sec timer every time it picks up movement and then finish the 45 sec's once 45 seconds with no motion detected passes. Plus the "state variables" need to be changed to integer or else that will mess things up on one of those random days where the variable happens to change state within 45 seconds of motion detection.
LeeG Posted November 8, 2011 Posted November 8, 2011 apostolakisl “So, again not owning one of these devices, when it sends an "on" statement, is it equivalent to pushing an "on" on a switchlinc?†Exactly. The basic message flow is identical. There are some redundant Group Broadcast messages because it is an RF only device but other than that a SwitchLinc On and Motion Sensor On look identical. “In other words, would simply replacing "status on" to "control switched on" be recognized? This would avoid needing two programs and would keep resetting the 45 sec timer every time it picks up movement and then finish the 45 sec's once 45 seconds with no motion detected passes.†Yes, I think that will work if the Motion Sensor timeout interval remains at 30 seconds or it is put into On Only mode. If the Motion Sensor timeout expires and sends an Off message it would not retrigger the Program because Control triggers only on the condition specified and If Control On triggers on each On message (if using On Only mode). The combination of either would allow a single Program to work (I think without benefit of an actual test to confirm). Also your original suggestion to use two Programs works. Lee
C Martin Posted November 8, 2011 Author Posted November 8, 2011 thanks to All. I am re-evaluating my next step. I appreciate all of the Great Input. Clarence
C Martin Posted November 8, 2011 Author Posted November 8, 2011 OK, I changed my programs. I actually added a separate Delay Program that is fired from the Control Change rather than the Status. If ( Control 'Motion Sensors / Closet / Closet Motion Sensor-Sensor' is switched On And $s_Is.SleepTime is 0 And $s_ClosetOveride is 0 ) Then Run Program 'Closet Day Motion Delay' (Then Path) Else - No Actions - (To add one, press 'Action') If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set Scene 'Scenes / Closet Motion' On Wait 1 minute Set Scene 'Scenes / Closet Motion' Off Else - No Actions - (To add one, press 'Action') This seems to work well. I guess I need to stop trying to consolidate too many programs into a single program.
apostolakisl Posted November 8, 2011 Posted November 8, 2011 OK, I changed my programs.I actually added a separate Delay Program that is fired from the Control Change rather than the Status. If ( Control 'Motion Sensors / Closet / Closet Motion Sensor-Sensor' is switched On And $s_Is.SleepTime is 0 And $s_ClosetOveride is 0 ) Then Run Program 'Closet Day Motion Delay' (Then Path) Else - No Actions - (To add one, press 'Action') If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set Scene 'Scenes / Closet Motion' On Wait 1 minute Set Scene 'Scenes / Closet Motion' Off Else - No Actions - (To add one, press 'Action') This seems to work well. I guess I need to stop trying to consolidate too many programs into a single program. If you changed your state variables to integer variables, you could turn it into one program. Or just leave well enough alone
C Martin Posted November 8, 2011 Author Posted November 8, 2011 I may change some of my state variables to integers. I need to evaluate all of them. I do use some state changes as triggers so I guess that if they are Integers, I will also assign their respective State variables also. Thanks, Clarence
Recommended Posts