Schlage BE469 - Zwave binding with security - missing features

schlage
zwave
doorlock
Tags: #<Tag:0x00007fe058924ec0> #<Tag:0x00007fe058924d30> #<Tag:0x00007fe058924970>

(Scott Rushworth) #58

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?


(Rob Byrd) #59

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.


(Scott Rushworth) #60

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:.


(Rob Byrd) #61

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”


(Scott Rushworth) #62

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.


(Rob Byrd) #63

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


(Scott Rushworth) #64

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.


(Rob Byrd) #65

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.


(Scott Rushworth) #66

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.)


(Hector G) #67

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'

(Scott Rushworth) #68

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.


(Douglas.Wildemuth@gmail.com) #69

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!


(Scott Rushworth) #70

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.


(Douglas.Wildemuth@gmail.com) #71

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


(Ben) #72

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


(Scott Rushworth) #73

Yes, you can program user codes (I don’t). Here’s what it looks like in Habmin…

As for rules, you can trigger events when a code is used (you can find some of that in my example rule), but you wouldn’t be able to put in restrictions. Well, you could probably modify the codes through the REST API, but it would be better to add some channels in the device db for this.


(Ben) #74

Thanks @5iver, this is helpful.

Is it this lack of ability to apply rules ( by which I mean the cleaner code only works on given days/ times) that causes you to not use OH2 to program your locks?
Is it the (apparent) limitation to 5 ( rather than 30) codes?
What do you use to program the codes instead?

Thanks
BDM


(Scott Rushworth) #75

We have 5 locks and I prefer to just manually configure the codes. We’ve also chosen to not automate anything involving secure access (garage doors don’t open, locks don’t unlock, etc.). We also work from home, so someone can always answer the door, but also wouldn’t trust anyone to be inside our house unsupervised :slight_smile:.

There are 30 slots available. TMK, all can be configured through OH, but I could be wrong.


(Ra) #76

I am running OH 2.3 with latest Z-wave add-on. (not experimental). I was able to discover Schlage BE469 but can’t get it to work (lock/unlock). Do I have to use beta Z-wave binding (2.4), or 2.3 should be fine ?

I deleted thing and added again. Now it shows as unknown device.


(Scott Rushworth) #77

You need the dev version. No other version has security. For lock/unlock status, you need a rule.