My lock seem to report status very reliably now.
I look at the door condition to determine if the door is opened / closed.
You canât always look at the door condition to determine if the lock is locked or unlocked, because door condition wonât be changed if you unlock the door from openhab using the lock switch. It will only be updated if you open it using keypad or the unlock button on the lock from inside.
So: DoorCondition to determine if the door is opened / Closed
EntryNotification to determine if the door is locked unlocked.
items:
Group ZwaveIdLock "ID Lock" (Zwave)
Number ZwaveIdLockBattery "ID Lock [%d %%]" <battery> (ZwaveIdLock,Battery,gRestore) { channel="zwave:device:xxxx:node49:battery-level" }
String ZwaveIdLockAlarmRaw "ID Lock Alarm Raw [%s]" <alarm> (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:alarm_raw" }
Switch ZwaveIdLockAlarmBurglar "ID Lock Alarm Burglar [%s]" <alarm> (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:alarm_burglar" }
Switch ZwaveIdLockAlarmEmergency "ID Lock Alarm Emergency [%s]" <fire> (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:alarm_emergency" }
Switch ZwaveIdLockEntryNotification "ID Lock Entry Notification [%s]" <switch> (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:alarm_entry" }
Switch ZwaveIdLockDoorLock "ID Lock Door Lock [%s]" (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:lock_door" }
Number ZwaveIdLockDoorCondition "ID Lock Door Condition [%d]" (ZwaveIdLock,gRestore) { channel="zwave:device:xxxx:node49:sensor_general" }
String FrontDoorLock "Front Door is [%s]" <lock2> (ZwaveIdLock, gRestore)
String FrontDoorStatus "Front Door is [%s]" <door> (ZwaveIdLock, gRestore)
rules
val String LOG = "IdLock"
rule "UpdateDoorStatus"
when
Item ZwaveIdLockDoorCondition changed
then
val doorStatus = transform("MAP", "idlock_door.map", ZwaveIdLockDoorCondition.state.toString)
FrontDoorStatus.postUpdate(doorStatus)
val lockStatus = transform("MAP", "idlock_lock.map", ZwaveIdLockEntryNotification.state.toString)
FrontDoorLock.postUpdate(lockStatus)
logInfo(LOG, "[IDLock] The door is " + doorStatus + " and " + lockStatus)
end
rule "UpdateLockStatus"
when
Item ZwaveIdLockEntryNotification changed to ON or
Item ZwaveIdLockEntryNotification changed to OFF
then
val lockStatus = transform("MAP", "idlock_lock.map", ZwaveIdLockEntryNotification.state.toString)
FrontDoorLock.postUpdate(lockStatus)
logInfo(LOG, "[IDLock] EntryNotification, the door is " + lockStatus)
end
Transform idlock_door.map
0=Opened
1=Closed
2=Opened
3=Closed
-=Unknown
NULL=Unknown
idlock_lock.map
0=Locked
1=Locked
2=Unlocked
3=Unlocked
ON=Locked
OFF=Unlocked
-=Unknown
NULL=Unknown
Note that since I have manually edited the zwave database and binding, this is probably not how it will work. I expect the door condition to be a json string in the future.