Garage Door Monitor by SmartThings wrong notify time

I have been using the Garage Door Monitor by SmartThing app.

I have mine set to notify every 10 minutes. It will send out the notification at 10 minutes that my door is still open.

At 20 minutes of being open it sends out a notification that it has been open for 10 minutes again.

At 30 minutes of being open it send out a notification that it has been open for 20 minutes.

It stays behind 10 minutes due to sending a notification of 10 minutes twice.

It stops changing at 100 minutes of being open.

Can someone take a look at the code and tell me what is going on?

Thanks!

/**
 *  Garage Door Monitor
 *
 *  Author: SmartThings
 */
preferences {
	section("When the garage door is open...") {
		input "multisensor", "capability.threeAxis", title: "Which?"
	}
	section("For too long...") {
		input "maxOpenTime", "number", title: "Minutes?"
	}
	section("Text me at (optional, sends a push notification if not specified)...") {
		input "phone", "phone", title: "Phone number?", required: false
	}
}

def installed()
{
	subscribe(multisensor, "acceleration", accelerationHandler, [filterEvents: false])
}

def updated()
{
	unsubscribe()
	subscribe(multisensor, "acceleration", accelerationHandler, [filterEvents: false])
}

/*
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 accelerationHandler(evt) {
	def latestThreeAxisState = multisensor.threeAxisState // 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 msg = "Your ${multisensor.label ?: multisensor.name} has been open for more than ${openMinutes} minutes!"
	if (phone) {
		sendSms(phone, msg)
	}
	else {
		sendPush msg
	}
}

def updateSmsHistory() {
	if (!state.smsHistory) state.smsHistory = []

	if(state.smsHistory.size() > 9) {
		log.debug "SmsHistory is too big, reducing size"
		state.smsHistory = state.smsHistory[-9..-1]
	}
	state.smsHistory << [sentDate: new Date().toSystemFormat()]
}

def clearSmsHistory() {
	state.smsHistory = null
}

That is the one. Thanks for posting it.

It will send me a text at 10 minutes open saying 10 minutes.

Then a text at 20 minutes also saying 10 minutes.

So every ten minutes the text message is like this: 10, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 100, 100, etc…

Can anyone tell me where the latest version of this Smart App is? It says “metadata definition not found” when i try to add it. Thanks

make your own meta data. it looks something like this

definition(
name: “Left It Open”,
namespace: “smartthings”,
author: “SmartThings”,
description: “Notifies you when you have left a door or window open longer that a specified amount of time.”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/ModeMagic/bon-voyage.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/ModeMagic/bon-voyage%402x.png
)

Copy and paste it then edit the app at the name section