App that sends push notification about how long door/garage door is open

I’m trying to create an app that will send me a “push notification” for my garage door being open for X minutes.

However, for some reason it’s only letting me select multisensors that are set on my doors, not my garage door (the multisensor on my garage door is set as a “SmartSense Garage Door Multi” to it registers up/down to let me know when my garage door has been opened).

Any help/suggestions are greatly appreciated! Thanks!

Here’s the code I have:

/**
 *  Garage Door Time Open Push Notification
 *
 *  Copyright 2014 Matt Burrows
 *
 *  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.
 *
 */
definition(
    name: "Garage Door Time Open Push Notification",
    namespace: "",
    author: "Matt Burrows",
    description: "Sends a push notification when the garage door is open.  Also, sends push about how long garage door has been open",
    category: "",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)


preferences {
section("When the garage door is open...") {
input "multisensor", "device.smartsenseMulti", title: "Where?"
}
section("For too long...") {
input "maxOpenTime", "number", title: "Minutes?"
}
}

def installed()
{
runIn(delayInSeconds, "eventHandler")
}

def updated()
{
unsubscribe()
runIn(delayInSeconds, "eventHandler")
}

/*
The "acceleration" message comes during acceleration, but also is reported every 2.5 minutes, so we listen for
that and then check if the garage door has been open for longer than the threshold.
*/
def accelerationHandlerPush(evt) {
def latestThreeAxisState = multisensor.latestState("threeAxis") // e.g.: 0,0,-1000

if (latestThreeAxisState) {
def latestThreeAxisDate = latestThreeAxisState.dateCreated.toSystemDate()
def isOpen = Math.abs(latestThreeAxisState.xyzValue.z) > 250 // TODO: Test that this value works in most cases���������

if (isOpen) {
def deltaMillis = 1000 * 60 * maxOpenTime
def timeAgo = new Date(now() - deltaMillis)
def openTooLong = latestThreeAxisDate < timeAgo
log.debug "openTooLong: $openTooLong"
def recentTexts = state.smsHistory.find { it.sentDate.toSystemDate() > timeAgo }
log.debug "recentTexts: $recentTexts"

if (openTooLong && !recentTexts) {
def openMinutes = maxOpenTime * (state.smsHistory?.size() ?: 1)
sendTextMessage(openMinutes)
}
}
else {
clearSmsHistory()
}
}
else {
log.warn "COULD NOT FIND LATEST 3-AXIS STATE FOR: ${multisensor}"
}
}

def sendTextMessage(openMinutes) {
log.debug "$multisensor was open too long, texting $phone"

updateSmsHistory()
def message = "Your ${multisensor.label ?: multisensor.name} has been open for more than ${openMinutes} minutes!"
sendPush(message)
}

def updateSmsHistory() {
if (!state.smsHistory) state.smsHistory = []
state.smsHistory << [sentDate: new Date().toSystemFormat()]
}

def clearSmsHistory() {
state.smsHistory = null
}

Did you know there is a stock alert for this under “Access & Entryways”?

if you use the stock alert be sure you check out this thread

I would just use @gbronzer 's app.