`
===============END NODE 4 ======================
patched in 2.0.0 Snapshot the the ZwaveUserCodeCommandClass
################# SNIP Method #################################
``
public SerialMessage setUserCode(int id, String code) {
boolean codeIsZeros = false;
boolean isHexCode=false;
logger.info("############# code is "+code+"#############################");
if (!StringUtils.isEmpty(code)) {
code=code.trim();
} else {
code="";
}
if (code.startsWith("0x")) {
isHexCode = true;
} else {
// Zeros means delete the code
try {
codeIsZeros = Integer.parseInt(code) == 0;
} catch (NumberFormatException e) {
logger.debug("NODE {}: Error parsing user code. Code will be removed");
}
if (codeIsZeros) {
code = ""; // send no code since we will set UserIdStatusType.AVAILBLE
}
} // END else ((code.startsWith("x")))
if (codeIsZeros || userCodeIsValid(code)|| isHexCode) {
logger.debug("NODE {}: {} user code for {}", this.getNode().getNodeId(),
codeIsZeros ? "Removing" : "Setting", id);
SerialMessage message = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData,
SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Get);
ByteArrayOutputStream outputData = new ByteArrayOutputStream();
outputData.write((byte) this.getNode().getNodeId());
outputData.write(4 + code.length());
outputData.write((byte) getCommandClass().getKey());
outputData.write(USER_CODE_SET);
outputData.write(id); // identifier, must be 1 or higher
if (codeIsZeros) {
outputData.write(UserIdStatusType.AVAILABLE.key); // status
} else {
outputData.write(UserIdStatusType.OCCUPIED.key); // status
try {
if (isHexCode) {
code=code.replace("0x","");
int len=code.length();
if (! (len%2 == 0)) {
logger.info("code length must be a vielfaches of 2");
return null;
}
int countBytes=len;
for (int i1=0;i1< countBytes;i1=i1+2) {
int i3=i1+2;
String byteString=code.substring(i1,i3);
byte byteToWrite=(byte)Integer.parseInt(byteString,16);
outputData.write(byteToWrite);
logger.info("########### write "+byteString);
}
} else {
for (Byte aCodeDigit : code.getBytes("UTF-8")) {
outputData.write(aCodeDigit);
}
}
} catch (UnsupportedEncodingException e) {
logger.error("Got UnsupportedEncodingException", e);
}
}
message.setMessagePayload(outputData.toByteArray());
return message;
}
return null;
}
############### END Patched Method ######################################
I am stupid, Sorry i cant write the method better, but i should be no problem to reformat it with a IDE
how to get the RFID Code
############## LOG Begin ##################################
2017-04-01 18:18:02.156 [DEBUG] [ve.internal.protocol.ZWaveController:209] - Message: class=ApplicationCommandHandler[0x04], type=Request[0x00], priority=High, dest=255, callback=0, payload=00 04 0E 6
3 03 00 00 8F C1 4A 10 3D 50 01 04 00 00
2017-04-01 18:18:02.157 [DEBUG] [ssage.ApplicationCommandMessageClass:42] - NODE 4: Application Command Request (ALIVE:DONE)
2017-04-01 18:18:02.158 [DEBUG] [alization.ZWaveNodeInitStageAdvancer:188] - NODE 4: Starting initialisation from DONE
2017-04-01 18:18:02.159 [DEBUG] [ve.internal.protocol.ZWaveController:1140] - Event Listener org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStageAdvancer@1847bf2 already regis
tered
2017-04-01 18:18:02.160 [DEBUG] [ssage.ApplicationCommandMessageClass:152] - NODE 4: Incoming command class USER_CODE
2017-04-01 18:18:02.161 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:99] - NODE 4: Received UserCode Request
2017-04-01 18:18:02.161 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:111] - NODE 4: USER_CODE_REPORT 0 is AVAILABLE
2017-04-01 18:18:02.164 [DEBUG] [WaveSerialHandler$ZWaveReceiveThread:302] - Receive Message = 01 08 00 04 00 04 02 84 07 76
2017-04-01 18:18:02.166 [DEBUG] [ve.internal.protocol.ZWaveController:564] - Notifying event listeners: ZWaveUserCodeValueEvent
2017-04-01 18:18:02.171 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:931] - NODE 4: Got an event from Z-Wave network: ZWaveUserCodeValueEvent
2017-04-01 18:18:02.173 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:940] - NODE 4: Got a value event from Z-Wave network, endpoint = 0, command class = USER_CODE, value =
####################### Log End ##########################################
This is the Log File after using the unknown RFID Tag at the key PAD
payload=00 04 0E 63 03 00 00 8F C1 4A 10 3D 50 01 04 00 00
This is the TAG ID: 8F C1 4A 10 3D 50 01 04 00 00
I checked it again and entered a KeyCode via the keybord These keys were 1 4 2 3 1 4 2 3
Setting the Hex Code on Mini Keypad
################# BEGIN LOG ##################################
2017-04-01 18:24:58.811 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:498] - NODE 4: Configuration update received
2017-04-01 18:24:58.833 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:514] - NODE 4: Configuration update usercode_2 to 0x8FC14A103D5001040000
2017-04-01 18:24:58.835 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:175] - ############# code is 0x8FC14A103D5001040000#############################
2017-04-01 18:24:58.836 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:248] - NODE 4: Ignoring user code 0x8FC14A103D5001040000: was 22 digits but must be between 4 and 10
2017-04-01 18:24:58.838 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:197] - NODE 4: Setting user code for 2
2017-04-01 18:24:58.839 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 8F
2017-04-01 18:24:58.841 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write C1
2017-04-01 18:24:58.842 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 4A
2017-04-01 18:24:58.843 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 10
2017-04-01 18:24:58.845 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 3D
2017-04-01 18:24:58.846 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 50
2017-04-01 18:24:58.848 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 01
2017-04-01 18:24:58.849 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 04
2017-04-01 18:24:58.850 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 00
2017-04-01 18:24:58.852 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 00
2017-04-01 18:24:58.853 [DEBUG] [ve.internal.protocol.ZWaveController:547] - Message queued. Queue length = 1. Queue={}
2017-04-01 18:24:58.855 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:158] - NODE 4: Creating new message for application command USER_CODE_GET(2)
##################################### END LOG
Getting the Configuration
Now i can use my Tag and asking the keypad for used codes returns the right HEX Code
I have marked the RFID code >>>>>>>8F C1 4A 10 3D 50 01 04 00 00<<<<<< to see it better in the Log
###################################### Begin Log
2017-04-01 18:25:50.797 [DEBUG] [ve.internal.protocol.ZWaveController:1320] - Receive queue TAKE: Length=0
2017-04-01 18:25:50.800 [DEBUG] [wave.internal.protocol.SerialMessage:255] - Assembled message buffer = 01 14 00 04 00 04 0E 63 03 02 01 >>>>>>>8F C1 4A 10 3D 50 01 04 00 00<<<<<< FA
2017-04-01 18:25:50.803 [DEBUG] [ve.internal.protocol.ZWaveController:1321] - Process Message = 01 14 00 04 00 04 0E 63 03 02 01 8F C1 4A 10 3D 50 01 04 00 00 FA
2017-04-01 18:25:50.805 [DEBUG] [ve.internal.protocol.ZWaveController:209] - Message: class=ApplicationCommandHandler[0x04], type=Request[0x00], priority=High, dest=255, callback=0, payload=00 04 0E 63 03 02 01 8F C1 4A 10 3D 50 01 04 00 00
2017-04-01 18:25:50.807 [DEBUG] [ssage.ApplicationCommandMessageClass:42] - NODE 4: Application Command Request (ALIVE:DONE)
2017-04-01 18:25:50.808 [DEBUG] [alization.ZWaveNodeInitStageAdvancer:188] - NODE 4: Starting initialisation from DONE
2017-04-01 18:25:50.809 [DEBUG] [ve.internal.protocol.ZWaveController:1140] - Event Listener org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStageAdvancer@1847bf2 already registered
2017-04-01 18:25:50.810 [DEBUG] [ssage.ApplicationCommandMessageClass:152] - NODE 4: Incoming command class USER_CODE
2017-04-01 18:25:50.811 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:99] - NODE 4: Received UserCode Request
2017-04-01 18:25:50.812 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:111] - NODE 4: USER_CODE_REPORT 2 is OCCUPIED
2017-04-01 18:25:50.813 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:128] - NODE 4: USER_CODE_REPORT 2 is OCCUPIED [��J^P=P^A^D^@^@]
2017-04-01 18:25:50.814 [DEBUG] [ve.internal.protocol.ZWaveController:564] - Notifying event listeners: ZWaveUserCodeValueEvent
2017-04-01 18:25:50.815 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:931] - NODE 4: Got an event from Z-Wave network: ZWaveUserCodeValueEvent
2017-04-01 18:25:50.817 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:940] - NODE 4: Got a value event from Z-Wave network, endpoint = 0, command class = US
#################################### END LOG
Now i can use the RFID Tag like a usercode with pressing keys on the keypad
@chris:
is it possible to show the key code in HEX and ASCII
( to show the incoming unknown TAG CODE and to show the known USER Code occupied by a
usercode)
to use incoming unknown Tag Code (Hex) to set the Usercode as HEX ( done with my patched Method)
the Zipato Documentation says
"After sending the User Code Set , including a Unique User Indentifier (UID) the in use State (0x01) and the TAG Code
or a keypad sequence using ascii codes. the mini keypad will accept the code and notify other devices using the alarm command class. ...."
It seems to be that only the keypad sequence is in asccii code
thanks in advance
Thanks for the rapid reply and i hope, it is now better readable
Openhab 2.0.0 Snapshot I use a Zipato Mini Keypad RFID / ZWAVE The Keypad has the Node ID 4 =============== node4.xml ======================= `
` ===============END NODE 4 ====================== patched in 2.0.0 Snapshot the the ZwaveUserCodeCommandClass ################# SNIP Method ################################# `` public SerialMessage setUserCode(int id, String code) { boolean codeIsZeros = false; boolean isHexCode=false; logger.info("############# code is "+code+"#############################"); if (!StringUtils.isEmpty(code)) { code=code.trim(); } else { code=""; } if (code.startsWith("0x")) { isHexCode = true; } else { // Zeros means delete the code try { codeIsZeros = Integer.parseInt(code) == 0; } catch (NumberFormatException e) { logger.debug("NODE {}: Error parsing user code. Code will be removed"); } if (codeIsZeros) { code = ""; // send no code since we will set UserIdStatusType.AVAILBLE } } // END else ((code.startsWith("x"))) if (codeIsZeros || userCodeIsValid(code)|| isHexCode) { logger.debug("NODE {}: {} user code for {}", this.getNode().getNodeId(), codeIsZeros ? "Removing" : "Setting", id); SerialMessage message = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Get); ByteArrayOutputStream outputData = new ByteArrayOutputStream(); outputData.write((byte) this.getNode().getNodeId()); outputData.write(4 + code.length()); outputData.write((byte) getCommandClass().getKey()); outputData.write(USER_CODE_SET); outputData.write(id); // identifier, must be 1 or higher if (codeIsZeros) { outputData.write(UserIdStatusType.AVAILABLE.key); // status } else { outputData.write(UserIdStatusType.OCCUPIED.key); // status try { if (isHexCode) { code=code.replace("0x",""); int len=code.length(); if (! (len%2 == 0)) { logger.info("code length must be a vielfaches of 2"); return null; } int countBytes=len; for (int i1=0;i1< countBytes;i1=i1+2) { int i3=i1+2; String byteString=code.substring(i1,i3); byte byteToWrite=(byte)Integer.parseInt(byteString,16); outputData.write(byteToWrite); logger.info("########### write "+byteString); } } else { for (Byte aCodeDigit : code.getBytes("UTF-8")) { outputData.write(aCodeDigit); } } } catch (UnsupportedEncodingException e) { logger.error("Got UnsupportedEncodingException", e); } } message.setMessagePayload(outputData.toByteArray()); return message; } return null; }
############### END Patched Method ###################################### I am stupid, Sorry i cant write the method better, but i should be no problem to reformat it with a IDE
how to get the RFID Code ############## LOG Begin ################################## 2017-04-01 18:18:02.156 [DEBUG] [ve.internal.protocol.ZWaveController:209] - Message: class=ApplicationCommandHandler[0x04], type=Request[0x00], priority=High, dest=255, callback=0, payload=00 04 0E 6 3 03 00 00 8F C1 4A 10 3D 50 01 04 00 00 2017-04-01 18:18:02.157 [DEBUG] [ssage.ApplicationCommandMessageClass:42] - NODE 4: Application Command Request (ALIVE:DONE) 2017-04-01 18:18:02.158 [DEBUG] [alization.ZWaveNodeInitStageAdvancer:188] - NODE 4: Starting initialisation from DONE 2017-04-01 18:18:02.159 [DEBUG] [ve.internal.protocol.ZWaveController:1140] - Event Listener org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStageAdvancer@1847bf2 already regis tered 2017-04-01 18:18:02.160 [DEBUG] [ssage.ApplicationCommandMessageClass:152] - NODE 4: Incoming command class USER_CODE 2017-04-01 18:18:02.161 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:99] - NODE 4: Received UserCode Request 2017-04-01 18:18:02.161 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:111] - NODE 4: USER_CODE_REPORT 0 is AVAILABLE 2017-04-01 18:18:02.164 [DEBUG] [WaveSerialHandler$ZWaveReceiveThread:302] - Receive Message = 01 08 00 04 00 04 02 84 07 76 2017-04-01 18:18:02.166 [DEBUG] [ve.internal.protocol.ZWaveController:564] - Notifying event listeners: ZWaveUserCodeValueEvent 2017-04-01 18:18:02.171 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:931] - NODE 4: Got an event from Z-Wave network: ZWaveUserCodeValueEvent 2017-04-01 18:18:02.173 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:940] - NODE 4: Got a value event from Z-Wave network, endpoint = 0, command class = USER_CODE, value = ####################### Log End ########################################## This is the Log File after using the unknown RFID Tag at the key PAD
I checked it again and entered a KeyCode via the keybord These keys were 1 4 2 3 1 4 2 3
#################### Log Begin ########################################### 2017-04-01 16:34:26.568 [DEBUG] [ve.internal.protocol.ZWaveController] - Message: class=ApplicationCommandHandler[0x04], type=Request[0x00], priority=High, dest=255, callback=0, payload=00 04 0E 63 03 00 00 31 34 32 33 31 34 32 33 00 00 2017-04-01 16:34:26.569 [DEBUG] [ssage.ApplicationCommandMessageClass] - NODE 4: Application Command Request (ALIVE:DONE) 2017-04-01 16:34:26.569 [DEBUG] [alization.ZWaveNodeInitStageAdvancer] - NODE 4: Starting initialisation from DONE 2017-04-01 16:34:26.570 [DEBUG] [ve.internal.protocol.ZWaveController] - Event Listener org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStageAdvancer@12ec829 already registered 2017-04-01 16:34:26.570 [DEBUG] [ssage.ApplicationCommandMessageClass] - NODE 4: Incoming command class USER_CODE 2017-04-01 16:34:26.571 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass] - NODE 4: Received UserCode Request 2017-04-01 16:34:26.571 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass] - NODE 4: USER_CODE_REPORT 0 is AVAILABLE 2017-04-01 16:34:26.571 [DEBUG] [ve.internal.protocol.ZWaveController] - Notifying event listeners: ZWaveUserCodeValueEvent ################### Log End ######################################### Key Payload payload=00 04 0E 63 03 00 00 31 34 32 33 31 34 32 33 00 00 TAG Payload payload=00 04 0E 63 03 00 00 8F C1 4A 10 3D 50 01 04 00 00
Setting the Hex Code on Mini Keypad ################# BEGIN LOG ################################## 2017-04-01 18:24:58.811 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:498] - NODE 4: Configuration update received 2017-04-01 18:24:58.833 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:514] - NODE 4: Configuration update usercode_2 to 0x8FC14A103D5001040000 2017-04-01 18:24:58.835 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:175] - ############# code is 0x8FC14A103D5001040000############################# 2017-04-01 18:24:58.836 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:248] - NODE 4: Ignoring user code 0x8FC14A103D5001040000: was 22 digits but must be between 4 and 10 2017-04-01 18:24:58.838 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:197] - NODE 4: Setting user code for 2 2017-04-01 18:24:58.839 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 8F 2017-04-01 18:24:58.841 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write C1 2017-04-01 18:24:58.842 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 4A 2017-04-01 18:24:58.843 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 10 2017-04-01 18:24:58.845 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 3D 2017-04-01 18:24:58.846 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 50 2017-04-01 18:24:58.848 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 01 2017-04-01 18:24:58.849 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 04 2017-04-01 18:24:58.850 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 00 2017-04-01 18:24:58.852 [INFO ] [mmandclass.ZWaveUserCodeCommandClass:225] - ########### write 00 2017-04-01 18:24:58.853 [DEBUG] [ve.internal.protocol.ZWaveController:547] - Message queued. Queue length = 1. Queue={} 2017-04-01 18:24:58.855 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:158] - NODE 4: Creating new message for application command USER_CODE_GET(2) ##################################### END LOG Getting the Configuration
Now i can use my Tag and asking the keypad for used codes returns the right HEX Code I have marked the RFID code >>>>>>>8F C1 4A 10 3D 50 01 04 00 00<<<<<< to see it better in the Log
###################################### Begin Log 2017-04-01 18:25:50.797 [DEBUG] [ve.internal.protocol.ZWaveController:1320] - Receive queue TAKE: Length=0 2017-04-01 18:25:50.800 [DEBUG] [wave.internal.protocol.SerialMessage:255] - Assembled message buffer = 01 14 00 04 00 04 0E 63 03 02 01 >>>>>>>8F C1 4A 10 3D 50 01 04 00 00<<<<<< FA 2017-04-01 18:25:50.803 [DEBUG] [ve.internal.protocol.ZWaveController:1321] - Process Message = 01 14 00 04 00 04 0E 63 03 02 01 8F C1 4A 10 3D 50 01 04 00 00 FA 2017-04-01 18:25:50.805 [DEBUG] [ve.internal.protocol.ZWaveController:209] - Message: class=ApplicationCommandHandler[0x04], type=Request[0x00], priority=High, dest=255, callback=0, payload=00 04 0E 63 03 02 01 8F C1 4A 10 3D 50 01 04 00 00 2017-04-01 18:25:50.807 [DEBUG] [ssage.ApplicationCommandMessageClass:42] - NODE 4: Application Command Request (ALIVE:DONE) 2017-04-01 18:25:50.808 [DEBUG] [alization.ZWaveNodeInitStageAdvancer:188] - NODE 4: Starting initialisation from DONE 2017-04-01 18:25:50.809 [DEBUG] [ve.internal.protocol.ZWaveController:1140] - Event Listener org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStageAdvancer@1847bf2 already registered 2017-04-01 18:25:50.810 [DEBUG] [ssage.ApplicationCommandMessageClass:152] - NODE 4: Incoming command class USER_CODE 2017-04-01 18:25:50.811 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:99] - NODE 4: Received UserCode Request 2017-04-01 18:25:50.812 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:111] - NODE 4: USER_CODE_REPORT 2 is OCCUPIED 2017-04-01 18:25:50.813 [DEBUG] [mmandclass.ZWaveUserCodeCommandClass:128] - NODE 4: USER_CODE_REPORT 2 is OCCUPIED [��J^P=P^A^D^@^@] 2017-04-01 18:25:50.814 [DEBUG] [ve.internal.protocol.ZWaveController:564] - Notifying event listeners: ZWaveUserCodeValueEvent 2017-04-01 18:25:50.815 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:931] - NODE 4: Got an event from Z-Wave network: ZWaveUserCodeValueEvent 2017-04-01 18:25:50.817 [DEBUG] [ding.zwave.handler.ZWaveThingHandler:940] - NODE 4: Got a value event from Z-Wave network, endpoint = 0, command class = US #################################### END LOG Now i can use the RFID Tag like a usercode with pressing keys on the keypad @chris:
thanks in advance
Thanks for the rapid reply and i hope, it is now better readable
Alexander