Rule Machine request: locked manually vs keypad

So just thinking out loud. Can you not discriminate between manual and keypad by using just unlocked for manual. Then use unlocked by code for everything else?

1 Like

They want to be able to distinguish if the thumbturn is used inside, vs the lock button or method (mine is a three finger touch on the glass keypad). I guess there is a lock that locks by entering a code, which I find a bit odd and then the rest have some other method like the aforementioned.

This would allow the to be used to arm HSM or another system when the lock method from the outside is used, but not do anything (or maybe arm with different settings) if the thumbturn is used inside the house.

Ah makes more sense.

I might use it if available, but maybe not :wink:

My wife almost never leaves the house in one shot. So the system would be arming and disarming a lot in a few minutes. I use the location and wifi connection data to auto arm mine. I use the auto unlock trigger to disarm it and if that doesn't trigger for any reason, unlocking via the lock keypad will disarm too.

Hi Bruce(@bravenel ),
Can you provide an example of how to do it? I don't see any Custom attribute which can be used to distinguish between Physical and Digital open/close in 2.1.1

No, I can't. I was responding to what someone else said, that the lock was reporting this. Use Custom Attribute in a Trigger Event or Condition, pick the lock as the device, and it will allow you to see all of the available attributes.

The complete list of attributes for the lock is (battery,codeChanged,codeLenght,lock,lockCodes,maxCodes)
This is the list attribute values for the lock attribute below. Neither one applies to this case.
What should I do?

Also what some of these values mean(unlocked with timeout, unknown,changed)?

changed means that you want the condition or trigger to fire whenever and only if the state changes. As to the others, I don't know. I don't know how to accomplish what you want to do, maybe someone else does, if its even possible at all.

Just wanted to bring attention to this and hopefully we can get the additonal values or even a custom one. As the current custom attributes won't let me do what I want.

I have a rule that arms night when home, when we let the dogs out it would be nice to have the HSM disarm when unlocking. I have the Yale Assure SL with Zigbee Cards and a Schlage Zigbee 468 and they are nearly instant and both report "physical" "thumbturn" which would allow me to disarm the house from inside with the physical unlock. The Yale doesnt have a key so dont have to worry about it being picked, but I dont want someone that guesses or knows the code to be what disarms if were sleeping. So the difference needs to be identifiable which so far from my logs it looks good, just need to use those variables in RM.

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.