Schlage BE469 - Zwave binding with security - missing features

Sorry to bug you on this one - I like this idea and I think I saw some mention of this in the megathread but I am not sure if any plan was agreed on for it’s implementation.
I for one would be happy with a nominal limit on the number of user code channels, 10 seems like more than enough although others may disagree.
Could we start with 10 or even 5 just to get the functionality going and then allow people to argue for an increase?

@Python This stuff looks very cool. I have a Schlage BE469 that thanks to Chris’ 0808 SNAPSHOT binding, I’ve been able to include it in my massive 2 node Z-wave network. LOL. That’s after I figured out I had to click on the magnifying glass in HABmin and not the plus sign. I had my Z-stick held next to the lock, and did the discovery using my iPad and I just couldn’t get the system to find the lock after I told it to turn on it’s Z-wave radio. It’s now included and I have Z-wave DEBUG turned on so the logs show the activity.

So thank you for sharing your solution. The question I have is, exactly what do I with the various parts to get them into my OH2 system. So far, I haven’t found any text files for most things that I’ve defined using either the Paper UI or HABmin.

For example. Do I create a lock_alarm.map file with those entries and put it … where? Same for the other files. Not sure how to name the files or where they would go.

I thought I read someplace that while OH1 relied a lot on text files, OH2 doesn’t use or doesn’t like them.

Also, I’m not sure about 11=Jammed. I’ve seen 1-6 in the logs doing some tests, but I got an 11 when I entered a bogus code. The deadbolt’s working perfectly and has never jammed. So maybe it’s got two meanings.

One of the main reasons I decided to try openHAB is that I want to be able to keep a log/record of what user codes are used and when. But it looks like we don’t have that functionality yet for the Schlage BE469 Touchscreen Deadbolt. It seems like a great lock and communication with an HA systems was why I bought it. I just don’t want to rely on a cloud-based solution or crazy stuff like will.i.am, an American musician buying Wink and then doing who knows what with it.

Thanks,
Mark

I’ve been stumbling around and finding where some things are and hopefully where they go.

@Python I see the lock_alarm.map but not your lock.map which you reference in your Items. Would you please post how that’s defined?

Thanks,
Mark

I have a similar setup and my lock.map file looks like this:

ON=Closed
OFF=Open

This will transform the ‘switch’ ON/OFF to the Open/Closed that is supposed to drive the dynamic padlock icon. I say supposed because for some reason on my setup it is not working - the transform is happening but the icon is not reacting, but that is likely an issue with my system, hopefully you will have more luck.

User code monitoring should now be available. I’ll be testing tonight.

1 Like

If you’d like to see an example of using alarm_raw, check out this post…
https://community.openhab.org/t/zwave-yale-yrd220-lock/34180/5

2 Likes

Great stuff - thanks for updating this thread with new developments!
I finally got round to switching my code over to the new alarm_raw channel and it is working great including being able to figure out which user code was used to unlock the door.

@5iver Do you know if it is possible to detect a failed user code? There is some chatter about this on the smartthings forum here: https://community.smartthings.com/t/z-wave-lock-with-failed-attempt-alarm/16376/7
I would also like to be able to detect if the alert ‘alarm’ is tripped (I currently have all my locks set to Alarm Mode: Alert), but I am not getting any change to the alarm_raw value when the alert is triggered.

Is this a case of adding more properties to the alarm_raw message?

…maybe I should ask @chris :slight_smile:

Edit:
Was re-reading some old posts and spotted this debug entry from @5iver
NODE 183: Updating channel state zwave:device:07cb40a2:node183:alarm_raw to {"notification":"BURGLAR__TAMPER_UNKNOWN","type":"BURGLAR","event":"2","status":"255"} [StringType]

Maybe the ‘Alert’ setting never triggers an event but ‘Forced Entry’ and ‘Tamper’ settings do?

Based on the info on SmartThings, type=6, event = 16, this would give a notification ACCESS_CONTROL__KEYPAD_TEMPORARILY_DISABLED.

In my notes, I have a V1 code of 161 for failed user code attempt (maybe for a different lock) and code 16 for wrong code entered too many times. I do not see alarms after a single bad user code entry, but after 4 the siren on the lock turns on and the lock sends:

{"notification":"ACCESS_CONTROL__KEYPAD_TEMPORARILY_DISABLED","type":"ACCESS_CONTROL","event":"16","status":"255"}

Hello do you mind sharing how you worked that out or the code for it and also how you setup for the lock to report its status when opened and closed from the key pad.

Disclaimer: most of the clever stuff here is borrowed heavily from @5iver - his rule can be viewed here:

Here is my rule. I too use a lambda since I have multiple locks of the same type:

val Functions$Function3<String, String, SwitchItem, Void> ProcessAlarmRaw = [lockName, alarmRawMessage, remoteLockItem |
	logDebug("Rules-DoorLocks", "Lock: {} updated AlarmRawMessage to: {}", lockName, alarmRawMessage)
	
	val HashMap<Integer, String> userCodeNames = newHashMap(
		1 -> "User1",
		2 -> "User2")
	
	val String typeString = transform("JSONPATH", "$.type", alarmRawMessage)
	switch (typeString) {
		case "BURGLAR" : {
			logDebug("Rules-DoorLocks", "{} sent 'BURGLAR' message: {}", lockName, alarmRawMessage)
			// TODO Sound siren
			// TODO Trigger Elk
			gDoorLocks.sendCommand(ON) // Lock all doors
			val message = "Intruder alert triggered by " + lockName;
			sendBroadcastNotification(message)
			return null
		}
		case "ACCESS_CONTROL" : {
			logDebug("Rules-DoorLocks", "{} sent ACCESS_CONTROL message: {}", lockName, alarmRawMessage)
		}
		default : {
			logDebug("Rules-DoorLocks", "Unknown event with unknown 'type' detected from: {}", lockName)
			return null
		}
	}
	
	val String eventString = transform("JSONPATH", "$.event", alarmRawMessage)
	val Integer eventNumber = Integer::parseInt(eventString)
	
	var String state = UNDEF.toString
	var String userCodeName = null
	switch (eventNumber) {
		case 1,
	//	case 3,
		case 5,
		case 9 : {
			state = ON.toString
		}
		case 2,
	//	case 4,
		case 6 : {
			state = OFF.toString
			if (eventNumber == 6) {
				val String userCodeString = transform("JSONPATH", "$.code", alarmRawMessage)
				val Integer userCodeNumber = Integer::parseInt(userCodeString)
				userCodeName = userCodeNames.getOrDefault(userCodeNumber, "Unknown")
				val String debugMessage = lockName + " granted access to user: " + userCodeName + " with user code index: " + userCodeNumber
				logDebug("Rules-DoorLocks", debugMessage)
				if (userCodeName == "Unknown") {
					sendBroadcastNotification(debugMessage)
				}
			}
		}
		case 11,
		case 16 : {
			val String eventDescription = if (eventNumber == 11) "jammed" else "keypad disabled due to too many failed user code attempts"
			state = UNDEF.toString
			logDebug("Rules-DoorLocks", "{} {}" , lockName, eventDescription)
			sendBroadcastNotification(lockName + " " + eventDescription)
		}
	}
	logDebug("Rules-DoorLocks", "Updating remoteLockItem: {} to {}", remoteLockItem.name, state)	
	remoteLockItem.postUpdate(state)
	
	return null
]


rule "Door Lock - Commanded"
when
	Item Lock1__RemoteLock received command
then
	val notificationNumber = if (receivedCommand == ON) 3 else 4
	Lock1__AccessControlNotification.postUpdate(notificationNumber)	
end

rule "Door Lock - State Changed"
when
	Item Lock1__AlarmRaw received update
then
	ProcessAlarmRaw.apply(
		"Lock1",
		Lock1__AlarmRaw.state.toString,
		Lock1__RemoteLock)
end

Note that you will need an instance of ‘Door Lock - Commanded’ and an instance of ‘Door Lock - State Changed’ for each of your locks.

1 Like

@mcqwerty, I see a risk in your logic. When the TYPE is BURGLAR, there is also an EVENT of 6 and no CODE in the JSON. In that case, your lambda will fail silently when trying to read the CODE (no exceptions thrown from a lambda unless using try/catch), Fortunately, it looks like this will happen BEFORE you unlock the door for the burglar! There was some more discussion of this in the main thread when I realized this was occurring in my own rule before I had implemented alarm_raw. The simple story… keypad unlock and burglar both send EVENT 6, hence the need for alarm_raw and not just notification_access_control or alarm_number (they should now show as deprecated in the database).

Also, I have been periodically updating the lambda I’d posted in the other thread you linked to. The last update includes my handling for when a lock is unjammed, which I do not see in yours.

@5iver Thanks for the tip on your updated post :+1: I may add add in an ‘unjammed’ notification to my setup. I also want to reorganise my notifications using Items to relay as it looks like you are doing so I may roll this feature into that larger update when/if I get some time!

As for the EVENT 6 issue you point out, I remember reading your post on this in the main thread.
I think the return at the end of my ‘BURGLAR’ case statement will mean I am not relying on the silent exception to save me from being robbed, will it not?

1.Thanks so much for your help so far, do i put the lambada and rule in the
rules folder?
2.The undefined areas means i need to configure them in openhab2 and then
they will be associated in the lambada/rule?
3. How are you doing the sms and what does that mean “
presenceMessage.append(” Scott’s code") if (Scott.state == OFF) { "

Not sure which to use your example mcquerty or scotts, i am a newbie and was looking for a setup where i just have to copy in my lock name ect… which do u guys recommend.

When I first read your lambda, my brain must have completely disregarded the returns. My post was completely in error… sorry for that!

Put the lambda and rules into the same rules file, and save it to the rules folder.

Not sure what you are asking or I’d try to help!

Our phone service has an smtp to sms gateway. I have the mail Action installed and have a rule that triggers on a String item (SMS_Notification) change, and then sends an email to our phones with the state of the string. I do something similar with Kodi and audio notifications. The rest of that is a StringBuilder that I am building for use in a log or notification. The Scott.state == OFF is checking my presence, and then updating it since my lock code was used. Owntracks works well for us, but this adds some redundancy to prevent the alarms from going off.

No problem! Thanks for your concern and for all your help getting me this far!

As @5iver mentioned above, it is not clear what you are asking here. If you are referring to the areas in my rule where I define the state as UNDEF then -
UNDEF is a Type in the OpenHAB that, to my knowledge at least, is a valid state for any Item regardless of the Item type (Switch, Dimmer, String, etc.).
Because I am overly concerned with small details I didn’t like to set the State of my lock to either ON (locked) or OFF (unlocked) if the lock reported ‘jammed’ because it is not possible to know for sure if it is actually ‘jammed’ locked or ‘jammed’ open. (Note: one could make a pretty decent guess based on the previous state and the fact that it is very likely still in the previous state if it got jammed, but) I decided to go with UNDEF to define this third ‘unknown’ state.

Long story short - if UNDEF confuses you, don’t use it - it’s not essential :slight_smile:

Hi thanks for clarification about the rule/lambada, can you guys write this up so that a newb can understand it please, I have items for lock and alarm raw, I also made a lock.map just like yours, but i get confused from post#27 the items and the transform or is the info from that post just a diff way to get status info for the lock than yours.

what does this error mean?
2017-11-05 19:49:52.089 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘-’ with the file ‘lock.map’ : Target value not found in map for ‘-’

The state of an item is not always known by the system, especially during startup. So it is possible that the item you are trying to transform has an ‘undefined’ value. OH shows this as a ‘-’ character.
to avoid that error in the log, just add another line to your lock.map:
-=unknown

As for your other question it is not clear to me what you are asking. Could you rephrase with a problem statement and what you were expecting vs what is happening and I’m sure we can help you out.