Schlage BE469 - Zwave binding with security - missing features

Ok I think I figured it out by playing around with your rule amd settings.

Now that you figured it out, it may help other for you to post your settings and rules.

I couldn’t get anything returned from the alarm.state, so I had to use the alarm_raw.state and use a JSON transformation on it like:

var Number event = new Integer(transform(“JSONPATH”,"$.event", zwave_device_15e8fca79dd_node25_alarm_raw.state.toString))

in the rule in the first line.

I added this line to my Rules now I get an error in the openhab log:
no viable alternative at input ‘â’
[578,50]: missing ‘)’ at ‘JSONPATH’
[578,71]: mismatched input ‘,’ expecting ‘end’

I figured that problem out by adding a needed space before $.event. Now I get:
Error executing the transformation ‘JSONPATH’: Invalid path ‘$.event’ in ‘zwave:device:8fe51373:node41:alarm_raw’

Here you looked here…

Although, based on the version of the ALARM/NOTIFICATION CC your lock is using, this may need to be adapted. Can you provide an example value of alarm_raw?

Here is the string in the event log:
{“notification”:“ACCESS_CONTROL__MANUAL_UNLOCK”,“type”:“ACCESS_CONTROL”,“event”:“2”,“status”:“255”}
Here is how I’m trying to get the event numberin my rule:
var Number lockevent = new Integer(transform(“JSONPATH”, “$.event”, “zwave:device:8fe51373:node41:alarm_raw”))
And here is the error I’m getting in the openhab log:
Error executing the transformation ‘JSONPATH’: Invalid path ‘$.event’ in ‘zwave:device:8fe51373:node41:alarm_raw’
I’m trying to get the event number from the string and set it to a var so I can update my lock status.

You can’t access channels directly in rules like you are trying to do. You will need to create an item and link it to the alarm_raw channel. Then you can use that item’s state in your rule, like this…

var Number lockevent = Integer::parseInt(transform("JSONPATH", "$.event", Lock_EntranceFront_Alarm_Raw.state.toString))

The error you are getting is because the string you are feeding the JSONPATH transform, “zwave:device:8fe51373:node41:alarm_raw”, does not contain an “event” element. But it’s also not in JSON format :wink:.

Created Item: String Lock_MF_Dining_Alarm “Front Lock Alarm” {channel=“zwave:device:8fe51373:node41:alarm_raw”}
And Updated Rule:
var Number lockevent = Integer::parseInt(transform(“JSONPATH”, “$.event”, “Lock_MF_Dining_Alarm.state.toString”))
I still have errors in the log:
2018-02-03 21:19:17.403 [ERROR] [ore.transform.actions.Transformation] - Error executing the transformation ‘JSONPATH’: Invalid path ‘$.event’ in ‘Lock_MF_Dining_Alarm.state.toString’
2018-02-03 21:19:17.404 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Front Lock Update lock states after alarm events’: For input string: “Lock_MF_Dining_Alarm.state.toString”

Was the rule triggered by a change of the new item’s state? If not maybe the new item did not have a state before you used it? Maybe put in a log entry to show it’s current state. If that isn’t the problem, it would be helpful if you would post the whole rule.

It was Triggered by me unlocking and locking the door to change the state.
Here is the rule:
rule "Front Lock Update lock states after alarm events"
when
Item Lock_MF_Dining_Alarm received update
then
postUpdate(EventLog, “Front Door: Updated + lockevent”)
var Number lockevent = Integer::parseInt(transform(“JSONPATH”, “$.event”, “Lock_MF_Dining_Alarm.state.toString”))
if (lockevent == 1 || lockevent == 5 || lockevent == 3) {
Lock_MF_Dining_Proxy.postUpdate(ON)
postUpdate(EventLog, “Front Door: LOCKED”)
}
else if (lockevent == 2 || lockevent == 6 || lockevent == 4) {
Lock_MF_Dining_Proxy.postUpdate(OFF)
postUpdate(EventLog, “Front Door: UNLOCKED”)
}
else if (lockevent == 11) {
postUpdate(EventLog, “Front Door: JAMMED”)
}
end
Here is the proxy rule:
rule "Front Lock Proxy Status Updates"
when
Item Lock_MF_Dining_Proxy received command
then
Lock_MF_Dining_Lock.sendCommand(receivedCommand)
val notificationNumber = if (receivedCommand == ON) 3 else 4
Lock_MF_Dining_Alarm.postUpdate(notificationNumber)
end

Code fences.

The error was due to the quotes around the input string…

var Number lockevent = Integer::parseInt(transform(“JSONPATH”, “$.event”, “Lock_MF_Dining_Alarm.state.toString”))

See if this helps. Let me know if you’d like explanations for any of it.

rule "Front Lock Update lock states after alarm events"
when
    Item Lock_MF_Dining_Alarm received update
then
    switch (transform("JSONPATH","$.type",Lock_MF_Dining_Alarm.state.toString)) {
        case "ACCESS_CONTROL" : {
            switch (transform("JSONPATH", "$.event", Lock_MF_Dining_Alarm.state.toString)) {
                case "1", case "3", case "5" : {
                    Lock_MF_Dining.postUpdate(ON)
                    postUpdate(EventLog, "Front Door: LOCKED")
                }
                case "2", case "4", case "6" : {
                    Lock_MF_Dining.postUpdate(OFF)
                    postUpdate(EventLog, "Front Door: UNLOCKED")
                }
                case "11" : {
                    postUpdate(EventLog, "Front Door: JAMMED")
                }
            }
        }
        case "BURGLAR" : {
            postUpdate(EventLog, "Front Door: BURGLAR")
        }
    }
end

All you need are these items (a proxy item is not needed):

String Lock_MF_Dining_Alarm	"Front Lock Alarm" {channel="zwave:device:8fe51373:node41:alarm_raw"}
Switch Lock_MF_Dining	"Front Lock" {channel="zwave:device:8fe51373:node41:lock_door"}

An important thing to note is that the way your rule was written, if you had the alarm mode set to anything but disabled, lock picking, or a kick, or anything else that would have set off the tamper alarm (sends an event 6) would have unlocked the door! Filter on the type first.

2 Likes

Thank you, This is a great rule and good catch on the tamper alarm.

Now that I see the rule and walk through it I think I understand it.

You are welcome… I’m happy to have helped out! If you want a little more functionality, look at the rule and lambda I linked to, which also includes handling of user codes, and will prep you for when/if you add a second lock. Eventually, I will be adding some other missing events that are in the specification, which these locks may or may not fully support (user code deleted/added, keypad busy/disabled, new program code entered, etc.)

Hello folks I noticed that this post should solve my issue of not being able to get status updates from my locks. The question is I see two different ways to tackle the problem. Post 27 and post 39 on this thread. Can someone explain what the difference is between both and is there somewhere I can get all the info together? I have read all 65 posts and since I am rather new to openhab it’s a little confusing to me.

From reading the concept seems like you are using the Lambda to allow for reuse of code which I think is great. I would like to use the new alarm_raw channel as that is where I see movement in my logs.

In using the code from @5iver on post 39 I am getting an error when I save the file.

2018-04-22 20:19:39.723 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'lock.rules' has errors, therefore ignoring it: [7,45]: mismatched character ' ' expecting ']'
[7,51]: no viable alternative at input '|'
[8,5]: missing EOF at 'logDebug'

Do you mean this rule and lambda?

Try again… I just updated it. You must be using a recent snapshot build of OH. There was a change where lambdas need a space inside the square brackets.

Hello - I know this is old, but I was trying to follow along with what you did. I’ve got the following rule as a way to get started:

rule “Backdoor Lock Update”
when

     Item vBackdoorLock received update

then

var LockalarmNotification = transform(“JSONPATH”,“$.notification”, BackDoorLock_AlarmRaw.toString)

logInfo(“BackdoorNotification”, BackDoorLock_AlarmRaw.toString)

end

However my log file shows:

2018-06-25 21:25:00.029 [INFO ] [home.model.script.Backdoor LockEvent] - BackDoorLock_AlarmRaw (Type=StringItem, State={“notification”:“ACCESS_CONTROL__MANUAL_UNLOCK”,“level”:“1”,“type”:“ACCESS_CONTROL”,“event”:“2”,“status”:“255”}, Label=null, Category=null)

How do I get it to where I can separately pull out the notification, the type, the event, and the status separately?

Thank you!

Look two posts up for a link to another post with a full setup. Just set up the items with your device info and you should be up and running.

Thanks. Was a stupid error. I had not installed the JSON transformation yet. :frowning:

Hi all (& @5iver)
I’ve been spending much of today skimming through this thread and the new secure z-wave development thread to try and sort out an answer to this, but have been having difficulty.

I have 3 Schlage Connect BE469 locks that I’m hoping will be able to be integrated with OpenHab2. It appears they should be able to work with their alarm, lock and unlock features. Is it possible to program user codes from OpenHab? Is there a better way to do this (and manage rules/time/day restrictions for each user code)?
If not currently in place, is this on the near roadmap?

Thanks!

(& Thanks @chris for all of your rapid and involved development work on OpenHab & the new secure inclusion developments!)

BDM