Introduction: Timer to Close Garage Door Opener
So the story begins after I left my garage door open, and some guys just came in and messed around.
Fortunately, there is no valuable staff lost. After this accident, I decide to make a "timer to close" feature for my garage door.
Before we start, I want to let you guys know what is my current garage door opener system.
I have a LiftMaster Garage Door Opener, which has 2 remote control, one wall control panel. link
Also, I bought a 828LM LiftMaster Internet Gateway link is here, so that I can use myQ app to remotely control my gate to open or close via WiFi.
If your system is different from what I described above then this tutorial might not fit your needs.
1. A laptop/PC, with an internet connection
- In my case, I used a Raspberry Pi, which is a low cost, low power consumption computer, about 35$
- Or if you have your own server which runs 24/7, then it is even better
2. Your LiftMaster/myQ account and password
How it works
1. We will set up the email notification feature in myQ app, so when the garage door opens, we will get an email notification in our email box.
2. We ran a piece of code to detect new incoming emails. If it is the one send from myQ app saying door just opened, we are ready to set up a timer to close the door.
3. Using a another piece of code to send close door command to myQ server asking for the door to close
- The API is https://www.npmjs.com/package/myq-api
4. The garage door opener closes the door. We are good to go.
Step 1: Install NodeJS on Your Computer/server
NodeJS is a programming language that is widely used for running service nowadays.
In this tutorial, since I feel more comfortable using this language, I will be using it.
To install NodeJS, you will need to go to https://nodejs.org/ to download and then install it.
After it is successfully installed if you go to your terminal, you can just type "node -v" to verify the version.
Step 2: Set Up Your Account in Your MyQ App
On your mobile, login to your myQ account with your account and password.
Go to "Alert" setting and create a new alert, just like the one in the picture
Enable the "Alert me when the garage door is ": Opened (even though I have selected Closed too but the Opened is what we need)
Enable "Email" notification: this is where we got the notification of the door has been opened and we then set up a timer to close the door.
Step 3: Download Source Code From GitHub
I have uploaded the source code to my GitHub:https://github.com/k5dash/myQ-timer
You can either run "git clone https://github.com/k5dash/myQ-timer.git" or manually download the source code.
After the code is downloaded, go to your terminal and navigate to the folder where you downloaded
1. Run "npm install", it will install all the dependencies
2. Open email.js and replace "YOUR_MYQ_EMAIL" with your myQ email address, replace "YOUR_EMAIL_PASSWORD" with your myQ password
3. Set up your email address and password, email host provider in "config" variable. Save.
4. Run "node email.js" and if there is no error shows up the server is now up and running!
Step 4: Verify If It's Working
Now the server is up and running, let's go test it.
1. Open the garage door.
2. Verify you can get an email notification saying your door is open, in at most 30 seconds.
3. Once you got the mail notification, on your terminal there should be saying "timer started" and after 30 seconds it will say "tryna close now" indication it is sending a command to myQ server to close your garage door
4. Verify now your garage door light is blinking and a few seconds later the door is closed.
If you get it working, hurray! You made it. Grab a beer and take a rest.