N00bs guide to ST & GD00Z (Garage Door Controller)

Current as 09/25/16
So like many of us getting started I couldn’t figure out how to REALLY get the SmartThings (ST) and Garage Door Controller to work. After help from other users I figured I’d put together a nice spoon fed thread on how to get it working.

First off we’re talking about the GD00Z Garage Door Controller, there are MANY different companies that make this device, mine is a NuTone (NGD00Z), there’s a version by GoControl, Linear, Iris (Lowes) etc. My understanding they are all Linear devices just rebranded. With the unit you should find a small sensor with an arrow.

Installation is VERY easy, tape / screw the the small sensor onto the garage door, I placed mine in the middle of the TOP garage door segment all the way to one side. Reason: I BELIEVE it will ensure that the door will show Closed only when the door is FULLY down. If I placed it on the bottom of the garage door it could give a false Closed when the door is 1/4 down. While I don’t think I’ll run into a problem, this is a little peace of mind.

Once that’s done mount the main unit close to the garage door motor, as you’ll need to run the single 2 wire strand to the motor control board. You’ll also need to make sure to place the receiver unit close to a 120v power outlet.

This is what mine looks like installed next to my Garage Door Motor.

After everything is plugged in and powered up, open your ST app and “Connect New Device”, while it’s searching press the small button on the side of the GD00Z. The unit should beep and flash a red LED, hopefully your ST app will locate a “Z-Wave Garage Door Opener”. After its found enter any information you wish to change (name, location etc) At this time do not worry about installing any SmartApps etc, just get it seen by ST.

Once you’ve got it in ST go into the Garage Door Opener menu, most likely your garage door will show as “Unknown” status. Just open your garage door as normal, this will cause the sensor to sync up with the controller. You should now see it shows your garage door as open. On the APP issue a Close command, in a few seconds your GD00Z should beep and blink for 5 seconds then start to close the door. Confirm it closes without any problems and confirm in ST that the door shows as Closed.

Note 1/30/2016 I have switched to a Ecolink Z-Wave Wireless Tilt Sensor (about $30 on Amazon) I did this back in October as I do NOT like the passive tilt sensor that comes with the GD00Z. This sensor is somewhat “active” and allows me to be sure of the current state of the garage door. To be honest I’m VERY happy that I switched to this tilt sensor, more of a peace of mind over anything else.

High Five You now can control your Garage Door from your phone.

If you’re like me that’s only 1/2 the problem solved, what you really want is it to let you know IF it’s left open and or close it when you’ve forgotten about it.

Next up is the software magic half.

Open up a tab and head to http://developer.smartthings.com/ and login.
Open up ANOTHER tab and head to https://github.com/gouldner/SmartThingsPublic/blob/master/devicetypes/gouldner/rg-linear-gd00z-garage-door-opener.src/rg-linear-gd00z-garage-door-opener.groovy - GitHub is how people build software. With a community of more than 11 million people, developers can discover, use, and contribute to over 27 million projects using a powerful collaborative development workflow. (Their words not mine) Pretty much Github is a software depot where community members write code AND they share it for others to help write, improve etc.
In this case I’m using different device handler for the Z-wave Garage Door Controller built by @Ron who has (from my understanding) enhanced code from @garyd9 [Original code located here: https://github.com/garyd9/smartthings/blob/master/my_z-wave_garage_door_opener.groovy ]

What you want to do is get the “Raw” code so you can import, when you click on the “Raw” button it will take you to the raw code (plain text), from there Control-A (Select ALL text) and copy it to memory (Control-C / Command-C for you MAC users).

Remember that other tab you have going? It’s time to jump into that tab.
1st thing we need to do is create a new Device Handler, pretty much we’re going to load an enhanced driver for the Z-Wave Garage Door Controller, just like you needed to install a new driver for a printer etc.

Click on “My Device Type” then the green box that says “+ New Device Type”

Click on “From Code”

Next paste all the text you copied from Github then click “Create” at the bottom.

Hopefully there are no errors, if so go back to the Raw code and select all / copy then select all / delete / paste and click Create again.

If everything goes correctly you’ll be taken to this new page.

Note Be careful in here, placing unneeded text could cause errors and could break this driver / Device Handler.

Next up click Save at the top, then "Publish and click on “For Me”, as long as there’s no errors you’ll get a nice friendly green box at the top of the screen.

Once that is done go and confirm that you see the new Device you just created.

Now click on “My Devices” and click on your Garage Door Controller, in my case it’s called “Garage Door Opener”

Scroll down and click on “Edit”

On the next screen change the “Type” from “Z-Wave Garage Door Opener” to your newly created Device.
From:

Select - “RG Linear GD00Z Garage Door Opener”

Your Type should now read “RG Linear GD00Z Garage Door Opener”

Click Update at the bottom, it should update the screen and show a green box at the top.

Congrats! You’re using the updated driver, not there YET but you can see the finish line!!!

Final steps are to load the the SmartApp that will allow you be text / alerted to an open garage door and / or close it for you.

Update 9-25-2016

I’ve added a github with the current code I’m using. You can find the code here: https://github.com/trinitron79/SmartThings-Garage-Door/blob/master/smartapps/smartthings/automated-garage-door-open-close.src/automated-garage-door-open-close.groovy

You should also be able to add it as a repository as well.

Click on “My SmartApps”, “Settings”, “Add new repository”, from there you should be able to enter:
Owner: Trinitron79
Name: SmartThings-Garage-Door
Branch: Master

After clicking Save you should be able to select “Update from repo” then “SmartThings-Garage-Door (Master)”
From there you should be able to add a check box next to the “New”, then click “Execute Update”.

Once that is done you should see the app under My SmartApps and should be able to go into the app and click publish, For Me.

/Update 9-25-2016

Click on My SmartApps, then on the right side the green box that says “+ New SmartApp”, from there click on “From Template”, Change the “All Categories” to “Convenience” scroll down a towards the bottom and select “Ridiculously Automated Garage Door” then click “Create” on the bottom.

Once the create completes you’ll be placed into a screen that looked just like the driver screen we saw earlier.

At this point you can Save, Publish - For Me the new SmartApp.
Auto Close setup after this next section

To load the new SmartApp go into ST, Marketplace, SmartApps and scroll to the bottom and you’ll see “+ My Apps”


Note this is how Android currently looks

Select + My Apps and you should see your published Ridiculously Automated Garage Door.

Once you select the app it will ask you a set of questions as to which Sensor, Switch, time before warning and if you want a text. After you have everything entered press Done in the top right corner. I currently just use the 1st 4 options. Sense, Switch, Minutes and text message.

Pic shows how the default Door Sensor looks

Pic shows how it looks with a 3rd party sensor (Using a Ecolink Z-Wave Wireless Tilt Sensor)

BOOM! You’re done! Now go run outside and open your garage door then wait for a text and alert to let you know it’s open.

But I don’t want to know it’s open, I want to know it WAS open and now closed!!!

I hear ya! So did I!

WARNING The next part is VERY simple coding, you need to be careful as it could make your SmartApp NOT work if incorrect.

Head back to the developer site and go into My SmartApps and select your Ridiculously Automated Garage Door.
On the left hand side you’ll see #s, these are the line #s.

What you want to look for is the start for the Door Open Check - def doorOpenCheck()
From here you’ll notice { and } brackets. Think of these as blocks, you NEVER leave a block open. If you have a { you’ll have a } to close the block out. What we’re looking for the line of code that reads
"
else {
state.openDoorNotificationSent = false
}
"
Under this code press enter and place the following text, if you look at the next screen shot you’ll see there are 2 } AFTER the new code.

/### Code to close door if it’s left open./
closeDoor()
log.info “Closing {doorSwitch.displayName} because it has been open for {thresholdMinutes} minutes”
sendPush(“Closing {doorSwitch.displayName} because it has been open for {thresholdMinutes} minutes”)
def msg2 = “Closing {doorSwitch.displayName} because it has been open for {thresholdMinutes} minutes”
sendSms phone, msg2
/### End of Code to close door if it’s left open./

When it’s all said and done your whole “def doorOpenCheck()” should look like this.

NOTE I have done PowerShell coding before so some of this made sense, however I am VERY VERY VERY new to “Groovy” language so my code is VERY simple. It works, it makes ME happy, in the future as I learn I’d like to create a option that has Enabled or Disabled, so you can select if you want to door to shut or not. From there I’d like to write a CHECK that will send you a text / alert AFTER the door is confirmed closed. Future ideas, if I get it done I will update THIS thread, if someone else does it SWEET! Thanks you! and I’ll make sure to update this thread.

Ok so NOW you’ve updated the code, Save, Publish - For Me.

You’re about to cross the finish line!!!

Since you’ve made a change to the SmartApp go back into ST and update your new SmartApp under your Garage Door Opener “Thing”, if you haven’t loaded the SmartApp, follow the directions above. Once everything is loaded, run outside and open your garage door, hang out for a little bit and HOPEFULLY you’ll receive a text message (2 total) and Alert (2 Total) next up you hope that your GD00Z starts to Beep and flash, 5 seconds later your garage door should be shutting.

I have tested this with the ST app running, not running, normal button pushing to open etc. It constantly monitors your garage door, and if it’s left open it will shut it. If you have a light beam (most do) sensor at the bottom that stop the door, it will still continue to work, on the next door open check (I believe it runs once every minute) it will see the door is still open and try to shut it.

PLEASE PLEASE PLEASE Test , retest and TEST again before you trust it. I make ZERO guarantee this will work 100% time EVERYTIME. I’ve had VERY good luck with this code, driver combo.

If everything is working, crack a beer and show the wife / kids / neighbors and bask in the glory that is House Automation.

I hope this “guide” helps anyone getting into this, once again I have to say thanks to the ST Community and @Ron and @garyd9 for writing a FANTASTIC device handler that makes this SmartApp AWESOME!

25 Likes

Nice job. For the record my code is very much the same as @garyd9 I made some small changes for minor issues I had when using this device code.

Also my code has been moved to this location for easier integration with the SmartThings ide which now integrates with github.

Perfect, I updated the URL in the main post. I figured since it was working with your handler I should use yours for the post. :smiley:

Pretty cool. My main problem though is that the Garage Door Controller usually doesn’t show up in the list of devices a third party app can control. There are all my switches in there but never the Garage controller. Therefore Alexa or IFTTT can’t be used with it. I think it’s due to the device type of being a door and not a switch.

Any suggestion there on making it more third party app friendly?

*Edit Update: 12/6/15

To get this to format to a way you can just copy and paste I had to insert a few lines that say “’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE”

After you paste the code into the SmartThings App, go through and delete the whole “’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE” but leave the space where that line was. This should make it easier to copy / paste. However the text file below has the better / correct formatting, well at least I think so as it’s easier to read and understand what the code is doing.

I also added a Dropbox URL to the code.

Update: 12/4/15
I purchased a Ecolink Z-Wave Wireless Tilt Sensor - ECO-TILT-US to use WITH the supplied door sensor. I’ve found that this sensor is A LOT more reliable in giving the doors current state (open / close) It ties in with the SmartApp perfectly, just select it instead of the other sensor. It’s also CHEAP! 32$ on amazon.

I’ve also made changes to the “Ridiculously Automated Garage Door” SmartApps program.

Added AutoClose If you want to never worry about the door not closing and a SkipCheck that will not check to see if the door is open, this would be if you’re working in your garage and want to keep the door open and NOT get the warnings that it’s open.

'
/**

  • Copyright 2015 SmartThings
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
  • Ridiculously Automated Garage Door
  • Author: SmartThings
  • Date: 2013-03-10
  • Monitors arrival and departure of car(s) and
    1. opens door when car arrives,
    1. closes door after car has departed (for N minutes),
    1. opens door when car door motion is detected,
    1. closes door when door was opened due to arrival and interior door is closed.
      */

definition(
name: “Ridiculously Automated Garage Door”,
namespace: “smartthings”,
author: “SmartThings”,
description: “Monitors arrival and departure of car(s) and 1) opens door when car arrives, 2) closes door after car has departed (for N minutes), 3) opens door when car door motion is detected, 4) closes door when door was opened due to arrival and interior door is closed.”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact@2x.png
)

preferences {
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
section(“Garage door”) {
input “doorSensor”, “capability.contactSensor”, title: "Which sensor?"
input “doorSwitch”, “capability.momentary”, title: "Which switch?"
input “openThreshold”, “number”, title: “Warn when open longer than (optional)”,description: “Number of minutes”, required: true
input “autoCloseGarageDoor”, “enum”, title: “Close the garage door after being open longer than selected minutes”, options: [‘Yes’, ‘No’], required: true
input “skipcheck”, “enum”, title: “Working in the garage and want to keep the door open with no alerts? (If Yes door open checks will NOT happen, will need to reset to No when you’re done in the garage to have checks happen again)”, options: [‘Yes’, ‘No’], required: true
input(“recipients”, “contact”, title: “Send notifications to”) {
input “phone”, “phone”, title: “Warn with text message (optional)”, description: “Phone Number”, required: false
}
}
section(“Car(s) using this garage door”) {
input “cars”, “capability.presenceSensor”, title: “Presence sensor”, description: “Which car(s)?”, multiple: true, required: false
input “carDoorSensors”, “capability.accelerationSensor”, title: “Car door sensor(s)”, description: “Which car(s)?”, multiple: true, required: false
}
section(“Interior door (optional)”) {
input “interiorDoorSensor”, “capability.contactSensor”, title: “Contact sensor?”, required: false
}
section(“False alarm threshold (defaults to 10 min)”) {
input “falseAlarmThreshold”, “number”, title: “Number of minutes”, required: false
}
}

def installed() {
log.trace "installed()"
subscribe()
}

def updated() {
log.trace "updated()"
unsubscribe()
subscribe()
}

def subscribe() {
log.debug "present: ${cars.collect{it.displayName + ‘: ’ + it.currentPresence}}"
subscribe(doorSensor, “contact”, garageDoorContact)
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
subscribe(cars, “presence”, carPresence)
subscribe(carDoorSensors, “acceleration”, accelerationActive)
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
if (interiorDoorSensor) {
subscribe(interiorDoorSensor, “contact.closed”, interiorDoorClosed)
}
}

def doorOpenCheck()
{
final thresholdMinutes = openThreshold
if (thresholdMinutes) {
def currentState = doorSensor.contactState
log.debug "doorOpenCheck"
if (currentState?.value == “open” & skipcheck == “No”) {
log.debug "open for ${now() - currentState.date.time}, openDoorNotificationSent: ${state.openDoorNotificationSent}"
if (!state.openDoorNotificationSent && now() - currentState.date.time > thresholdMinutes * 60 *1000) {
def msg = "${doorSwitch.displayName} has been open for ${thresholdMinutes} minutes"
log.info msg
if (autoCloseGarageDoor == “Yes”) {
def msg2 = "Closing ${doorSwitch.displayName} because it has been open for ${thresholdMinutes} minutes"
log.debug "Auto Close Door selected, Calling to close Garage Door"
log.info msg2
closeDoor()
log.debug "Sending ST App Alert"
sendPush msg2
if (phone) {
log.debug "Sending text to Phone number - ${phone}"
sendSms phone, msg2
}
}
else {
log.debug "Sending ST App Alert"
sendPush msg
if (phone) {
log.debug "Sending text to Phone number - ${phone}"
sendSms phone, msg
}
}
state.openDoorNotificationSent = true
}
else {
state.openDoorNotificationSent = false
}
}
}
}

def carPresence(evt)
{
log.info “$evt.name: $evt.value”
// time in which there must be no “not present” events in order to open the door
final openDoorAwayInterval = falseAlarmThreshold ? falseAlarmThreshold * 60 : 600
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
if (evt.value == “present”) {
// A car comes home
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
def car = getCar(evt)
def t0 = new Date(now() - (openDoorAwayInterval * 1000))
def states = car.statesSince(“presence”, t0)
def recentNotPresentState = states.find{it.value == “not present”}
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
if (recentNotPresentState) {
log.debug “Not opening ${doorSwitch.displayName} since car was not present at ${recentNotPresentState.date}, less than ${openDoorAwayInterval} sec ago”
}
else {
if (doorSensor.currentContact == “closed”) {
openDoor()
sendPush "Opening garage door due to arrival of ${car.displayName}"
state.appOpenedDoor = now()
}
else {
log.debug “door already open”
}
}
}
else {
// A car departs
if (doorSensor.currentContact == “open”) {
closeDoor()
log.debug "Closing ${doorSwitch.displayName} after departure"
sendPush(“Closing ${doorSwitch.displayName} after departure”)
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
}
else {
log.debug “Not closing ${doorSwitch.displayName} because its already closed”
}
}
}

def garageDoorContact(evt)
{
log.info "garageDoorContact, $evt.name: $evt.value"
if (evt.value == “open”) {
schedule(“0 * * * * ?”, “doorOpenCheck”)
}
else {
unschedule(“doorOpenCheck”)
}
}

def interiorDoorClosed(evt)
{
log.info “interiorContact, $evt.name: $evt.value”
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
// time during which closing the interior door will shut the garage door, if the app opened it
final threshold = 15 * 60 * 1000
if (state.appOpenedDoor && now() - state.appOpenedDoor < threshold) {
state.appOpenedDoor = 0
closeDoor()
}
else {
log.debug “app didn’t open door”
}
}

def accelerationActive(evt)
{
log.info “$evt.name: $evt.value”
’ <-- REMOVE THIS LINE AFTER PASTE INTO SMARTTHINGS APP, KEEP THE SPACE
if (doorSensor.currentContact == “closed”) {
log.debug "opening door when car door opened"
openDoor()
}
}

private openDoor()
{
if (doorSensor.currentContact == “closed”) {
log.debug "opening door"
doorSwitch.push()
}
}

private closeDoor()
{
if (doorSensor.currentContact == “open”) {
log.debug "closing door"
doorSwitch.push()
}
}

private getCar(evt)
{
cars.find{it.id == evt.deviceId}
}

That did not paste well into the reply. I can not do a copy paste that works. It is broken between text and 3 or for code boxes.

I think what you need to do is paste your code, highlight it, and then click on the </> symbol in the menu bar. That should put your code into a preformatted text box that can be copied and pasted correctly.

Opps! :frowning:

Couldn’t the code to format cleanly on here so I put it in a text file and dropped it onto Dropbox, it should open up the text base code in your browser from there just copy and paste.

When I do the code from Dropbox I get:

Java.lang.NullPointerException: Cannot get property ‘locationDTO’ on null object

My gut feeling is you do not have the handler installed for the device.

I took the code straight from dropbox and created a new SmartApp and had no problems with it.

At the top of my post look for the Device Handler area.

This is the Device Handler I’m using.

This onr installed, does this one have the colse timer? I don’t have access to the app right now.

The close timer is part of the SmartApp, when you get it published it’s an option you can set.

Well… It is amazing when you actually read the whole post for “how to” when your awake and can comprehend stuff! When I get home I will play with the settings to ensure that it all runs right. But great job doing the guide kinda wish more people would do them the way that you did yours!

1 Like

Thank you so much for this great guide! I wouldn’t have figured all this out without the step-by-step instructions. The new “driver” works well within the app itself.

Here’s my issue: I’ve installed this so that I could control my garage door via my Amazon Echo. Interestingly, I can successfully open it by saying “Alexa, open Jon’s Garage Door” - and it works! But Alexa can’t even seem to find the “Jon’s Garage Door” device when I prefix it with “close.” In other words, when I say “Alexa, Close Jon’s Garage Door” she pretty much ignores me. However, if I say “Alexa, turn Jon’s Garage Door Off” she does say “OK” and closes the garage door! So, it seems like she understands the “switch” vocabulary for close but understands the “open/close” vocab for open.

Is there a “vocabulary” in the code that needs to be updated so that Alexa can close/open using the close/open vocabulary?

Any insights appreciated…thx!
Jon

I find alexa works best with simple names and don’t name too many things similarly.

For example why “Jon’s Garage Door” instead of just “Garage”. Open Garage, Close Garage is more likely to work.

If you have two then perhaps name it simply “John Garage”. As in “Alexa Open John Garage”.

Also speak clearly, I tend to speak one word at a time. as in “Alexa…pause until I hear wake sound (optional)…Open…Johns…Garage…Door”

There is a full thread on naming things well for Alexa, check it out.

The reason I have it as “Jon’s Garage Door” is because we have two garage doors! So, while renaming it to “garage door” does work, it’s not a workable solution for our home. I realize this this may be an Alexa problem and not a Garage Door Controller problem, but initially I thought it was a controller problem so I posted it here.

I understand and I addressed that in my reply. If you read my entire reply I also said “If you have two then perhaps name it simply “John Garage”. As in “Alexa Open John Garage”.”

I tried to address your problem. Sorry if you don’t like my suggested solution.

I find with Alexa you need to get a little more creative. Perhaps call the doors by the car names usually parked there. Try different names until one works.

I have a light on my main floor which I originally called “Main Floor Light”, every time I asked alexa to “Turn on Main Floor Light” it would respond with “Which light did you mean?”, and I would have to say “Main Floor Light” again and it would work. It drove me crazy. So I changed the light name to “Living Room Light” and it works perfect now. In fact if I just say “Turn on Living Room” that seems to be enough.

By having unique words in each name that word becomes the key to controlling the item.

Perhaps try these names
“Left Garage, Right Garage”
“Acura Door”, “Lexus Door”
“Red Door”, “Green Door” (based on car color)
“Car Door”, “Truck Door”

You get the idea. If you insist on the issue of making “Jon’s Garage Door” work then I suggest you contact Amazon Echo Support. :wink:

BTW: have you used the Echo Voice Training so it knows your voice, accent etc ?

Does Alexa say “OK” when you say “Alexa, Close Jon’s Door ?” if not then the issue is Alexa not understanding. Even if it does say “OK” I find many times when I say turn “On/Off” or “Open/Close” alexa gets it wrong and issues the opposite command. So watch the ide live log and see what command is issued when you make the command. Also try being real clear on words open and close as in “Alexa, CLOSE…Jons Garage Door”

Thank you again for your response. You are very helpful, and on the contrary, I didn’t say I didn’t like your suggestion – nor do I blame you for any problems! “Jon Garage” is OK but it’s not as natural as I’d prefer this to all work, because, to be honest, we’re not opening my Garage! We’re just opening the door. :smile:

What I found the most confusing is that the “open” keyword worked just fine whereas the “close” keyword failed every time…whereas “turn on/turn off” worked reliably, which is even more syllables!

This is mostly (if not fully?) on Amazon’s plate, correct? I guess my presumption was that the controller / app provided Alexa with the appropriate vocabulary for controlling devices. I guess I was wrong about that.

So my remaining question is, then: who/what determines what vocabulary Alexa can use to control devices? For instance, who determines if Alexa responds to “open” and “close” vs. “open” and “shut” or “lock” and “unlock” etc.?

You know, Alexa, open the garage door works every single time.

But, Alexa, close the garage door fails 75% of the time. Usually she gives me the definition if a garage door.

I then say, Alexa, garage door, close. And that usually works.

It’s a real pia

I wonder if “Alexa Shut Garage Door” will work ?
or “Batten Down Garage Door” :smile:

1 Like