DeadFlanders Posted February 7, 2020 Posted February 7, 2020 Hey All! Long time reader, first time poster.. I have a test program for my Insteon Motion Sensor that should turn on my lights and turn them back off after a period of inactivity. And it does, MOSTLY, but I'm having a bit of an inconsistency. The one I list here is just a test program that I'm using while sitting in my office. The real program will use a motion sensor out on my driveway that will trigger all the lights on the outside of my house whenever someone drives up. Attached is an image of my program, and of the current settings on my motion sensor. (This is a version 1 motion sensor, and it is jumpered for pins 5 and nothing else.) I believe I know how it should work, and I think I have an idea of what is going on, but I want to post it here to see if you guys agree, or if you see something that I'm missing here.. Basically I have the program set to run during the day right now because that is when I'm working on it. Once it goes to production, I'll flip the sunrise/sunset so that it works during the evening. So, IF it is during the day, AND the motion sensor sends an On Signal, AND the status of the switch is off OR the switch is at 99% (Already triggered by the motion sensor before.) Then it will turn the switch on to 99%, wait 15 seconds and turn it back off.. (The 15 seconds is just for testing, in production I usually do about 5 minutes.) This mostly works as expected.. I know and see that the first time this program runs (when the light is off), it changes the switch status from off to 99%, which immediately causes an event, which interupts the program and it starts again at the IF. And watching the Programs Summary page seems to support this, on that page I see the program start and the activity shows that is "Running Then" for a brief second, then it goes to "Idle", and then goes back to "Running Then" until the timer runs out. The brief bump to "idle" tells me that the THEN statement got interrupted when the state of the switch changed from off to 99% and so it goes back through again. The second time through the switch is already at 99%, so when I set it to 99% again in the THEN section it is no longer a state change, so the program completes like normal.. Do I have that right? Now the problem that I'm having is that every once in a while, the program goes through and turns the switch to 99%, then goes back to the IF statement, but instead of seeing the IF statement as true and continuing the program again it just stops right there.. When this happens, the light just stays on.. Basically, the first pass through the program, the light is turned on, but the WAIT is interrupted, and the second pass through the IF statement fails so the program never goes back to the wait, and never turns the light off. On the Programs Status page, I see the program go from "Running Then" for a half a second, and then just goes and sits at IDLE. I can't see why the program would ever fail on the second IF.. Maybe its a bug, or something. Not sure. Any ideas?? Now this isn't really a problem in my office where I am testing because if I generate another movement, then the IF statement re-evaluates again and it is fine. The problem is in production, out on my driveway.. In the driveway it works 95% of the time, but every once in a while, someone will come home, trigger the motion sensor once as they drive by it, and it will get in this funky state.. Then we find ourselves sitting inside the house wondering why the lights didn't go off.. Our driveway is off the road enough that we tend to be the only ones tripping the motion sensor.. So the solution is to either manually turn off all the lights, or go out and trigger the motion sensor again.. I believe my fix is to take the conditions in my THEN statement and move them to another program that doesn't have its own IF statements.. I then just call the second program from the first program, and that way it will keep running (meaning the wait timer will keep going), even if the IF statement in the first program gets re-evaluated and fails.. And if the IF statement gets re-evaluated and succeeds it will just restart the second program like I want. (And I can't remember why, but I think I'm supposed to have this second program disabled?) What is everyone's thoughts? Any ideas why the IF statement would fail on the second pass? And any thoughts as to the program in general, and my proposed fix? Thanks All!! I really tried to go through as much documentation and experimentation as I could before posting here, but I'm still a bit unsure.
kclenden Posted February 7, 2020 Posted February 7, 2020 Breaking the program up as you outlined should fix the problem. I don't think you need to disable the program (since it won't have any conditions in the IF) but disabling it won't hurt anything.
DeadFlanders Posted February 7, 2020 Author Posted February 7, 2020 Ok, thanks! I thought I remembered that there was some reason to disable programs that only served to be called as actions for other programs, but couldn't find anything when I searched.
dbwarner5 Posted February 21, 2020 Posted February 21, 2020 On 2/7/2020 at 5:44 PM, DeadFlanders said: Ok, thanks! I thought I remembered that there was some reason to disable programs that only served to be called as actions for other programs, but couldn't find anything when I searched. Disabling a program makes it so that the IF statement won't run UNLESS it is called specifically to run. This is handy when you only want a condition to be tested based upon the condition of another program and hence "the call". Since your program won't have any IF statement, there is no need to disable it as it will ONLY run if called to run the THEN or the ELSE from another program. Disabling it won't hurt it either, so basically since you dont have an IF, its irrelevant.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.