I’m having trouble figuring out my garage safety as it appears at the new house the garage door is sometimes not closing. My goal is to have the door check itself after each attempt to close and if it fails 2 times (notated by garagefails variable) it will notify me to figure out what is going on. Any help or pointers would be great. I have some programming experience but I’m still getting used to how WebC goes through its operations.
Garage Door Safety has me confused
From your piston, it looks like “Contact Sensor 2” is your garage door sensor. Is your sensor the type that has two separate magnetic pieces that show as “closed” when they are brought close to each other? -OR- is that sensor the type that is all in one unit that keeps track of the tilt to determine if the door is open or closed?
I have the Samsung version, also with two parts. For garage doors, they recommend only using the larger unit and the tilt sensor inside to determine if the door is open or close.
I think I know what your issue is, and how to fix it, but I need to know first if your sensor is using the magnetic contacts or tilt sensor to determine if the door is open or closed.
The reason I ask is, if you are using the tilt only (like I am) then where you install that sensor has a HUGE impact on when your smart home thinks the door is open or close. (plus the piston code will be a bit different)
Not sure about Lowes brand, but with Samsung door sensors, they use either tilt or contact… but not both. (user must pick one or the other during installation)
I see. This one is definitely a tilt sensor. The actual unit just creates the connection for the open and close while the tilt tells whether it is open or not.
This one: https://www.nortekcontrol.com/pdf/manuals/GD00Z_Install.pdf
Thanks for the clarification. From the PDF file, it looks like there is no magnetic connection for the door. (this is normal on a garage door sensor) What this means is, the tilt sensor is there to determine if the sensor is vertical (closed) or horizontal (open). What they don’t tell you is when exactly does horizontal switch to vertical.
I am not sure about the Lowes brand, but on my Samsung sensor, it switches from vertical to horizontal at about the 45 degree mark. What this means is my smart home will think the door is closed when the door is still open about 12-18 inches. (it is also why it is imperative to install it on the very top panel of the door. If you have it on any other panel, the results are much worse. It could actually show the door closed when it is still open 3 or 4 feet!!)
So what this means for you is line 29-60 are ONLY done while the door is somewhere between fully open, and partially closed. That section is no longer true when the door is about 18 inches away from being fully closed. Or another way to say this: With a tilt sensor, you should rarely (if ever) use the command:
While door is open
(Or at least be aware that it stops being true long BEFORE the door fully closes)
I would recommend a simple test to see where your sensor thinks the door is open or closed. A temporary piston such as this would quickly let you know:
Contact Sensor 3 = Garage Tilt sensor
Dimmer 1 = Light bulb visible from the garage
To run this test, simply import and save the above piston. Then head to the garage and pull the ‘chain release’ so you can manually open the door extremely slowly. Take note of where the door is when the light flashes… Then very slowly close the door and take note once again. Somewhere between those two tests is the threshold where your smart home thinks the door has changed.
The test above does not solve the issue you are having, but it lets you understand the limitations of the sensor. What I did for mine was, after running the test a few times, and noticing the change at approximately the 45 degree mark, I installed a small wedge under my tilt sensor (about 35 degree angle), so my door now shows being closed within two inches of being fully closed. (much better than 18")
Also, another issue that I think you are experiencing is using global variables and referring to them in the same piston. (Lines 37, 39, 73, 75 & 108… and also lines 32, 47 & 95… ) These will cause issues. You can do that with local variables, but not globals. The only variable in your piston that I would keep global is @MikesNumber, since that rarely changes.
In case you didn’t know, global variables are only modified after the piston stops running. So for instance, if global variable @test = true, and my piston says to set variable @test to false, it will remain true all the way thru the piston, and will only change at the end. (so the change would not be seen until the piston is run the next time - or in your case, the door closes and opens again)
Sooo, long story short:
- Make sure the tilt sensor is installed on the top panel of the door
- Run the test above to understand your sensor’s threshold
- Rethink lines 29-60 without using
While contact is open
- Make most variables local instead of global
Interesting. I did not know about local variables in the context of webcore. I dont see how to add them so I’ll have to look that up. Since my OP I’ve done some tweaking and removed the while look and utilized purely open and close to simplify the process. I’ll give the local variables a shot and see how it affects the operation.
Alright,local variables are set and improved. Now I need to see how to pause the pistons midway and have it check if the door indeed closed. That I believe will bolster my garage fail checker.
Uploaded pics are not clickable (stuck as a thumbnail)
For some reason I cannot view your last piston picture. It is a small thumbnail, and I cannot click on it to look closely at your code.
Neither are clickable… although your original post was. Are you clicking the green camera, and saving the popup pic that appears?
Yes. Though my popup has trouble staying up on the screen. Even with a different browser.
Strange. If they were all thumbnails, I would suspect a browser plugin giving you issues, but the first pic worked perfectly, so I am confused. I will keep an eye on this thread for when a full size pic shows up…