Rule Machine request: locked manually vs keypad

Look at Custom Attribute. Check out having a trigger based on that.

I had looked before posting and there isn’t one for that, it’s just lock or changed I can’t use something like unlocked with (physical/thumb turn/digital/ etc) or if we could have string and manually put in or drop down of matches etc.

Only have changed and stops there I can’t say changed / locked / unlock with additional attributes.

Please show one of the events you are describing from the Events page of the device itself. My guess is that the source of the unlock is in the description of the event. This is not really a portion of the event per se, just a description that varies from driver to driver, and is subject to change. The event type of physical would sweep in opening with the keypad as well. If this is the case, it's not really possible for Rule Machine or HSM to act on this.

What could be done is a small custom app that looks at that description, and does something to communicate this case with RM or HSM.

Someone had one of those around here for a Yale Lock, but the description was different and didnt handle locking from the keypad. It would be much more polished if this was built into RM. But below is my modification to the Yale Version for the Schlage version. Basically, the app will monitor the descriptionlog for the device and look for specific events. Three events will cause a virtual switch to toggle.
Manually Unlocked from Inside
Manually Locked from Inside
Manually locked from Outside (Schlage Button on Keypad)
That leaves nothing custom for unlocked by keypad, but i have it show which code unlocked. (Leaving all 4 combinations of user interaction with the lock)

    definition(
    name: "Schlage Lock Events",
    namespace: "rvrolyk",
    author: "Russ Vrolyk",
    description: "Tracks when a lock is manually controlled and updates virtual switch",
    category: "Convenience",
	iconUrl: "",
    iconX2Url: "",
    iconX3Url: "")


def lock = [
    name: "lock",
    type: "capability.lock",
    title: "Lock",
    description: "Select the lock to monitor.",
    required: true,
    multiple: false
]

def virtualLockedSwitch = [
    name: "virtualLockedSwitch",
    type: "capability.switch",
    title: "Virtual Lock Switch",
    description: "Virtual switch that should be turned on when lock is manually locked.",
    required: true,
    multiple: false
]

def virtualUnlockedSwitch = [
    name: "virtualUnlockedSwitch",
    type: "capability.switch",
    title: "Virtual Unlock Switch",
    description: "Virtual switch that should be turned on when lock is manually unlocked.",
    required: true,
    multiple: false
]

def virtualKeypadLockedSwitch = [
    name: "virtualKeypadLockedSwitch",
    type: "capability.switch",
    title: "Virtual Keypad Lock Switch",
    description: "Virtual switch that should be turned on when lock is locked by Keypad.",
    required: true,
    multiple: false
]

def enableLogging = [
    name:				"enableLogging",
    type:				"bool",
    title:				"Enable debug Logging?",
    defaultValue:		false,
    required:			true
]

preferences {
	page(name: "mainPage", title: "<b>Lock to monitor:</b>", install: true, uninstall: true) {
		section("") {
			input lock
			input virtualLockedSwitch
			input virtualUnlockedSwitch
			input virtualKeypadLockedSwitch
			label title: "Assign an app name", required: false
		}
		section ("<b>Advanced Settings</b>") {
			input enableLogging
		}
	}
}

def installed() {
	log.info "Installed with settings: ${settings}"
	initialize()
}

def updated() {
	log.info "Updated with settings: ${settings}"
	unsubscribe()
	initialize()
}

def initialize() {
    log "Lock status: ${lock.displayName} " + lockStatus()
	subscribe(lock, "lock.locked", lockHandler)
	subscribe(lock, "lock.unlocked", unlockHandler)
	subscribe(lock, "lock.locked", keypadlockHandler)
}

def lockStatus() {
	return lock.currentValue("lock")
}

def lockHandler(evt) {
	log("Lock event: ${evt.name} : ${evt.descriptionText}")
	if (evt.type == 'physical' && evt.descriptionText.endsWith('thumb turn [physical]')) {
		log "${lock.displayName} was locked inside"
		virtualLockedSwitch.on()
	} else {
		log "${lock.displayName} was locked"
	}
}

def unlockHandler(evt) {
	log("Unlock event: ${evt.name} : ${evt.descriptionText}")
	if (evt.type == 'physical' && evt.descriptionText.endsWith('thumb turn [physical]')) {
		log "${lock.displayName} was unlocked inside"
		virtualUnlockedSwitch.on()
	} else {
		log "${lock.displayName} was unlocked"
	}
}

def keypadlockHandler(evt) {
	log("Lock event: ${evt.name} : ${evt.descriptionText}")
	if (evt.type == 'physical' && evt.descriptionText.endsWith('keypad [physical]')) {
		log "${lock.displayName} was locked outside"
		virtualKeypadLockedSwitch.on()
	} else {
		log "${lock.displayName} was locked"
	}
}

def log(msg) {
    if (enableLogging) {
        log.debug msg
    }
}
1 Like

So here is some of the varying lock unlock both digital and physical. Is there anyway to match strings to the logs? Maybe could at least match physical vs digital? That would at least work in my situation where physical would be ok to disarm (since no key) where digital would be happening from the keypad or app. So physical (at least on these) can ONLY happen from inside.

Now the Schalge is a bit different. The profile is still digital / physical (manual) but a lot of other identifiers that could be used if could pull from the log data.

The Thumbturn Log is the Yale (no key) and the other log is a 468 Schlage

This is all doable in an app, as posted above.

This won't be in RM for a number of reasons, topped by the fact that this information varies from lock to lock and doesn't generalize.

Im looking at it now thanks guys!

Heres the post with the Yale version, so you dont have to make your own.

1 Like

So thinking about how I would institute this, make a virtual switch that does the auto turn off, then have those switches be monitored and write a rule when switch turns on to disarm / arm the house?

Logic seems correct but wanted to double check or if there was a better way.

Thats pretty much how i did it. I dont use it for HSM, but i have the notification app and lighting apps doing some automation based on the switch turning on. I use the Auto Off built into the virtual switch driver.

I really dont like having 3 extra virtual switches to maintain per lock. I get where Bruce is at with integrating this with RM (as it varies by lock), but I think it could be added much like custom commands, where the rule could look in descriptionlog for a string defined in the rule (or variable) that could evaluate to true when matched.

My plan is really only for 1 door anyways so this should fit my needs, but even so If I moved the keyless to the other exterior door instead of my interior garage then I would feel ok with physical being used to disarm hsm. If we get Ring Intergration could even have after dark turn on flood or something similar.