To help explain, see the items file for this device below:
// Door Lock to Garage: Black & Decker 914TRL but image shown as 910 in documents
Switch Front_Lock_Door "F Lock State" <door> {channel="zwave:device:fe40ab17:node32:lock_door"}
String Front_Alarm_Raw "F Alarm Raw type" {channel="zwave:device:fe40ab17:node32:alarm_raw"}
Number Front_Battery_Level "F Lock Battery [%d %%]" <battery> {channel="zwave:device:fe40ab17:node32:battery-level"}
String Front_Alarm_Virtual "F Lock StateV "
String Front_Alarm_Virtual_Short "FS State"
Note, the last two Virtual items are used to avoid what I called bogus reports from the lock. It would report the correct action/state {“type”:“xx”,“value”:“x”) then sometimes later report something like {“type”:“0”,“value”:“0”} which is not in the “reference of Alarm_Number related messages”. The Alarm_Raw item would then change to the bogus report not the actual report. So in the rules file (below) I set the Virtual items to the correct report and ignore the bogus reports. I don’t claim this method, it was suggested by Chris Jackson a while back. I have the first Virtual one to display the full text of the Alarm and the Short one for use on my cellphone.
By “Door Lock” action I am referring to the name used by the first channel. It is also the first item in the items file above.
The log file I am referring to is openhab.log. When the lock is not responding, executing lock_door or manual actions result in a blast of log entries, like drinking from a fire hose, but there is no entry like {“type”:“25”,“value”:“1”} so, no, the alarm channel does not change.
I will post the log file when(if) it starts failing again. Right now it is working fine. Would you want the text from the openhab.log file or the one from Chris’s log viewer. That may be a problem because I seem to be locked out of it right now. I know he was moving to to a new site and I registered there but just now I tried the old one and the new one and I can’t get passed the sign-in page. It also says the email address I used isn’t valid. But I used it in the last few days. I also can’t get to a place to create a new registration.
Below is the only rules file for this device. Note, when failing, none of the logDebug lines get logged, especially the first one that is place before the “if” statement so I am pretty sure the file is never run.
rule "Ignore Bogus Reports"
when
Item Front_Alarm_Raw changed //not Item Front_Battery_Level changed
// Note, I used "changed" so subsequent identical bogus messages won't get here.
then
//Process the JSON from the raw alarm to get the Type and Value
var actionType = transform("JSONPATH", "$.type",triggeringItem.state.toString) // these SOBs are strings
var actionTypeValue = transform("JSONPATH", "$.value", triggeringItem.state.toString)
logDebug("RULE_SYSTEM", "Lock: Alarm events: TFormed State: {}, StateValue: {}", actionType, actionTypeValue)
if(actionTypeValue != "0"){
/* Alarm types and levels from the documentation
Alarm Type Alarm Level Notification Event
017 001 Lock Secured at Keypad – Bolt Jammed (Not fully extended)
018 000 or User-ID#* Lock Secured at Keypad – Successful (Fully extended)
019 User-ID#* Lock Un-Secured by User (User-ID) at Keypad
021 001 Lock Secured using Keyed cylinder or inside thumb-turn
022 001 Lock Un-Secured using Keyed cylinder or inside thumb-turn
023 001 Lock Secured by Controller – Bolt Jammed (Not fully extended)
024 001 Lock Secured by Controller – Successful (Fully extended)
025 001 Lock Un-Secured by Controller – Successful (Fully retracted)
026 001 Lock Auto Secured – Bolt Jammed (Not fully extended)
027 001 Lock Auto Secured – Successful (Fully extended)
032 001 All User Codes deleted from lock
033 User-ID#* User Code Removed (Not shown in the Device but discovered by experiment.)
112 User-ID#* New User Code (User-ID#) added to the lock
161 001 Failed User Code attempt at Keypad
162 User-ID#* Attempted access by user (User-ID#) outside of scheduled
167 001 Low battery level
168 001 Critical battery level
169 001 Battery level too low to operate lock
I was getting others like 19/0, 21/0
* User-ID# values: 001 to 030
Rule inspired by this but modified to work with our locks
https://community.openhab.org/t/zwave-yale-yrd220-lock/34180/5
*/
switch (actionType) {
//Locking actions
case "17": {
Front_Alarm_Virtual.postUpdate("Lock Secured at Keypad by User # – Bolt Jammed (Not fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured_Jammed")
logDebug("RULE_SYSTEM", "{} Lock Secured at Keypad – Bolt Jammed (Not fully extended)", "FrontLock")
}
case "18": {
Front_Alarm_Virtual.postUpdate("Lock Secured at Keypad by User # " + actionTypeValue + " – Successful (Fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Lock Secured at Keypad by User [{}] – Successful (Fully extended)", "FrontLock", actionTypeValue)
}
case "19": {
Front_Alarm_Virtual.postUpdate("Lock Un-Secured by User # " + actionTypeValue + " at Keypad" )
Front_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} Lock Un-Secured by User ({}) at Keypad", "FrontLock", actionTypeValue)
}
case "21": {
Front_Alarm_Virtual.postUpdate("Lock Secured using Keyed cylinder or inside thumb-turn")
Front_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Lock Secured using Keyed cylinder or inside thumb-turn", "FrontLock")
}
case "22": {
Front_Alarm_Virtual.postUpdate("Lock Un-Secured using Keyed cylinder or inside thumb-turn")
Front_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} Lock Un-Secured using Keyed cylinder or inside thumb-turn", "FrontLock")
}
case "23": {
Front_Alarm_Virtual.postUpdate("Lock Secured by Controller – Bolt Jammed (Not fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured_Jammed")
logDebug("RULE_SYSTEM", "{} Lock Secured by Controller – Bolt Jammed (Not fully extended)", "FrontLock")
}
case "24": {
Front_Alarm_Virtual.postUpdate("Lock Secured by Controller – Successful (Fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Lock Secured by Controller – Successful (Fully extended)", "FrontLock")
}
case "25": {
Front_Alarm_Virtual.postUpdate("Lock Un-Secured by Controller – Successful (Fully retracted)")
Front_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} Lock Un-Secured by Controller – Successful (Fully retracted)", "FrontLock")
}
case "26": {
Front_Alarm_Virtual.postUpdate("Lock Auto Secured – Bolt Jammed (Not fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured_Jammed")
logDebug("RULE_SYSTEM", "{} Lock Auto Secured – Bolt Jammed (Not fully extended)", "FrontLock")
}
case "27": {
Front_Alarm_Virtual.postUpdate("Lock Auto Secured – Successful (Fully extended)")
Front_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Lock Auto Secured – Successful (Fully extended)", "FrontLock")
}
case "32": {
Front_Alarm_Virtual.postUpdate ("All User Codes deleted from lock")
logDebug("RULE_SYSTEM", "All User Codes deleted from lock", "FrontLock")
}
case "33": {
Front_Alarm_Virtual.postUpdate ("User Number " + actionTypeValue + " Removed")
logDebug("RULE_SYSTEM", "{} User Number " + actionTypeValue + " Removed", "FrontLock")
}
case "112": {
Front_Alarm_Virtual.postUpdate ("User Number " + actionTypeValue + " Added")
logDebug("RULE_SYSTEM", "{} User Number " + actionTypeValue + " Added", "FrontLock")
}
case "161": {
Front_Alarm_Virtual.postUpdate ("Failed User Code attempt at Keypad")
logDebug("RULE_SYSTEM", "{} Failed User Code attempt at Keypad", "FrontLock")
}
case "167": {
Front_Alarm_Virtual.postUpdate ("Low battery level")
logDebug("RULE_SYSTEM", "{} Low battery level", "FrontLock")
}
case "168": {
Front_Alarm_Virtual.postUpdate ("Critical battery level")
logDebug("RULE_SYSTEM", "{} Critical battery level", "FrontLock")
}
case "169": {
Front_Alarm_Virtual.postUpdate ("Critical battery level")
logDebug("RULE_SYSTEM", "{} Critical battery level", "FrontLock")
}
default : {
Front_Alarm_Virtual.postUpdate ("Unknown Alarm Type " +actionType + " Value " +actionTypeValue)
logDebug("RULE_SYSTEM_Default", "{} Unknown Alarm Type " +actionType + " Value " +actionTypeValue, "FrontLock")
}
}
}
end