Rule Machine request: locked manually vs keypad

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.

Whats the status on this...... Its really needed and its clearly possible the driver writes the action in the log it just doesn't set a state for it.

Sounds like we need a custom lock driver..

1 Like

Since I just started looking for a lock to use with Hubitat I just came upon this thread.

It seems the issue is that the person wants to know when the door was unlocked from the outside when somebody is arriving versus unlocked manually from the inside.

From reading the above thread it seems that when somebody unlocks it from the outside you will get a report of the person who entered the code to unlock it. You can also, I assume, get the time that was done. If any of the people unlocked it and then it was relocked within X time you know that somebody was returning. If the door was unlocked manually from the inside you wouldnā€™t have any named person unlocking it within your time frame. (It would just report unlocked without a name)

I would use a variable to store who unlocked the door so it could be cleared out after the time you want to allow for them to lock it. Otherwise, there will always be somebody who last unlocked it with a code.

So in pseudo code it would be like:
When door unlocked store unlocked time (Now()) in variable unlockedTime and person who unlocked it in variable whoUnlocked.

Then Delay (say 2 minutes)
Then test if whoUnlocked <> NoOne (or conversely if whoUnlocked = Person X, Y or Z) AND Now() < unlockedTime + 2 minutes (for example) then comingHome = True. Else comingHome = false. Then end it by setting whoUnlocked = ā€œā€.

I also like the button idea if you donā€™t mind caring it with you. I just bought an Aeotec Minimote 7 button that has four buttons on it. It is small enough to fit on a keychain. In fact, they gave you a keyring for the keychain. When you approached you could push a button which would unlock the door and that would indicate that it was done from the outside. While more $ to give one to each user, it would keep it (a bit more) out of kidā€™s hands, if that is an issue.

One other way that comes to mind is a motion sensor on inside of door that would be tripped before someone got to the lock. Then you can, like the above, test if motion sensor tripped before unlocked (so someone opened the door from the inside) vs. if door unlocked then the motion sensor was tripped, which would mean it was unlocked from the outside.

It shows up in the event log.......
locked by thumb turn [physical]
lock was unlocked [digital]
was locked by keypad [physical]

The driver is identifying it and entering it in events it just needs to set a state and feed that to the rules. Moving from smartthings it used to do this which allowed us to arm on exit.

No thats incorrect we want to know when someone locks from the outside. The unlocking works and that can be used to disarm but we need the keyboard lock state. to arm on exit

We are using stock driver Schlage be468/469 and they dont set a custom event they list the event in the event log but set no custom attribute.
Shouldn't this be listed as a bug in the driver

Please show the events in question from the Events on the device page -- a screenshot please.

That's an old topic but the need is still there. Has anyboy found a way to make it?

My lock is a ZigBee Weiser (Kwickset) SmartCode 10 using the generic zigbee driver. The driver knows when the lock is lock/unlock by code/manual/keypad/digital and write it in the log. It would be nice to keep that last action in an attribute.