Help with garage door left open app


#1

this is code ffor app i found but would rather have it send a text than a notification, can anybody help with that code change?

/**

  • Is It Closed?
  • Copyright 2014 Greg Bronzert
  • 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: “Is It Closed?”,
namespace: “gbknet”,
author: “Greg Bronzert”,
description: “Check whether door is closed after a mode change or specific time.”,
category: “Convenience”,
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(“Which mode changes trigger the check?”) {
input “newMode”, “mode”, title: “Which?”, multiple: true, required: false
}
section(“When should I check? (once per day)”) {
input “timeToCheck”, “time”, title: “(Optional)”, required: false
}
section(“Which doors should I check?”){
input “doors”, “capability.doorControl”, title: “Which?”, multiple: true, required: true
}
}

def installed() {
log.debug “Installed with settings: ${settings}”

initialize()

}

def updated() {
log.debug “Updated with settings: ${settings}”

unsubscribe()
unschedule()
initialize()

}

def initialize() {
if (newMode != null) {
subscribe(location, modeChangeHandler)
}
if (timeToCheck != null) {
schedule(timeToCheck, checkDoor)
}
}

def modeChangeHandler(evt) {
log.debug “Mode change to: ${evt.value}”

doors.each {
    if (newMode.any{ it == evt.value } || newMode == evt.value) {
        checkDoor(it)
    }
}

}

def checkDoor(door) {
log.debug "Door ${door.displayName} is ${door.currentContact}"
if (door.currentContact == “open”) {
def msg = "${door.displayName} was left open, closing it!"
log.info msg
sendNotificationEvent(msg)
closeDoor(door);
} else {
def msg = "${door.displayName} was not open, we are good."
log.debug msg
sendNotificationEvent(msg)
}
}

private closeDoor(door) {
if (door.currentContact == “open”) {
log.debug "closing door"
door.close()
}
}
Thanks


#2

Hi @Jdoniz,

That sounds like a great start, but you can already do this via the WebCore/CoRe community rule engine. I have it working via the Core.


(Allan) #3

Why not just use a custom rule in Smart Home Monitor? I have these setup for all my exterior doors in case we accidentally leave one open. Its already built into the app and will do exactly what you want.


#4

it doesn’t work for me, because when my mode changes to away the door is already open, and it looks to see if the door is opening not left open, I appreciate any advice how you have it setup


#5

i’m pretty new to this - i do not know what Webcore/Core is


(Ron Talley) #6

I just use webCoRE to make my own rules. Install webCoRE! You will not regret and you will be making your own rules in no time.

Here’s an example, although not created to your exact request, it can be easily modified to fit your likings:


(jkp) #8

How does sharing a piston become a private key to his system?


(Ron Talley) #9

The Code is what you use to import the Piston…


#10

I stand corrected.


#11

I researched Webcore - got it loaded which wasn’t real easy but once loaded i was able to do what i wanted in a few minutes. Pretty easy - i am excited to do other things now where as before i was reluctant because it was so hard - thanks for all the help!!!