eKey Binding and compatibility with ekey Multi and/or OpenHAB2

I’m having trouble getting my ekey Multi to work with openHAB(2).
As described here: eKey binding compatible with OpenHab 2?

So, first of all my Hardware:

  • ekey integra 2.0 Fingerprint Sensor (ekey articlenumber #101 326)
  • ekey Multi SE REG 4 (#101 163)
  • ekey CV LAN (100 460)

Software-configuration as described in the thread above:

my ekey.cfg:

# ip address of the eKey udp converter (optional)
ip=192.168.xx.xx
# port number for the UDP packets
port=21000
# mode can be RARE, MULTI or HOME depending on what your system supports - RARE is default
mode=MULTI
# the delimiter is also defined on the eKey udp converter - use the eKey configuration
# software to determine which delimiter is used or to change it.
# Not defining this is the same as " "
delimiter=#

my .items

String ekey_EG_Windfang_aktion		"Letzte Aktion [MAP(ekey_action.map):%d]"	<lock>	(EG_Windfang)	{ekey="action"}

My CV-LAN configuration:

// if CV LAN and ekey.cfg is set to "HOME or MULTI":
2016-11-20 19:38:01.524 [ERROR] [ing.ekey.internal.EKeyPacketReceiver] - Error parsing packet
java.lang.IllegalArgumentException: Invalid Packet! Converting String to Integer failed!
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:96)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at org.openhab.binding.ekey.internal.EKeyPacketReceiver.run(EKeyPacketReceiver.java:136)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
Caused by: java.lang.NumberFormatException: For input string: "#0001"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)[:1.8.0_111]
	at java.lang.Integer.parseInt(Integer.java:569)[:1.8.0_111]
	at java.lang.Integer.valueOf(Integer.java:766)[:1.8.0_111]
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:85)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	... 2 more
2016-11-20 19:38:01.532 [DEBUG] [ing.ekey.internal.EKeyPacketReceiver] - Received a packet that does not match the mode
you specified in the 'openhab.cfg'!
2016-11-20 19:38:06.700 [WARN ] [al.bus.KNXBindingDatapointReaderTask] - Autorefresh: Cannot read value for item 'RTR_EG_WoZi_HVAC_Status' from KNX bus: timeout waiting for group read response: timeout
2016-11-20 19:38:06.702 [WARN ] [al.bus.KNXBindingDatapointReaderTask] - Autorefresh: Remaining retries for address '8/5/1' = '0'
2016-11-20 19:38:14.332 [ERROR] [ing.ekey.internal.EKeyPacketReceiver] - Error parsing packet
java.lang.IllegalArgumentException: Invalid Packet! Converting String to Integer failed!
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:96)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at org.openhab.binding.ekey.internal.EKeyPacketReceiver.run(EKeyPacketReceiver.java:136)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
Caused by: java.lang.NumberFormatException: For input string: "#0000"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)[:1.8.0_111]
	at java.lang.Integer.parseInt(Integer.java:569)[:1.8.0_111]
	at java.lang.Integer.valueOf(Integer.java:766)[:1.8.0_111]
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:85)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	... 2 more
2016-11-20 19:38:14.337 [DEBUG] [ing.ekey.internal.EKeyPacketReceiver] - Received a packet that does not match the mode
you specified in the 'openhab.cfg'!

// if CV LAN and ekey.cfg is set to "RARE":
2016-11-20 19:46:39.190 [ERROR] [ing.ekey.internal.EKeyPacketReceiver] - Error parsing packet
java.lang.IllegalArgumentException: Invalid Packet! Delimiter-match failed
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:53)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at org.openhab.binding.ekey.internal.EKeyPacketReceiver.run(EKeyPacketReceiver.java:136)[210:org.openhab.binding.ekey:1.9.0.201611200211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
2016-11-20 19:46:39.198 [DEBUG] [ing.ekey.internal.EKeyPacketReceiver] - Received a packet that does not match the mode
you specified in the 'openhab.cfg'!

after changing the protocol type a few times, I don’t get any entries in logfiles anymore, except if a bundle:stop - bundle:start the ekey binding in the console:

2016-11-20 20:13:40.263 [DEBUG] [org.openhab.binding.ekey            ] - BundleEvent STOPPING - org.openhab.binding.ekey
2016-11-20 20:13:40.286 [DEBUG] [org.openhab.binding.ekey            ] - ServiceEvent UNREGISTERING - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.ekey, component.name=org.openhab.binding.ekey.binding, component.id=213, service.id=364, service.bundleid=210, service.scope=bundle} - org.openhab.binding.ekey
2016-11-20 20:13:40.314 [DEBUG] [ab.binding.ekey.internal.EKeyBinding] - Stopping eKey listener...
2016-11-20 20:13:40.335 [DEBUG] [org.openhab.binding.ekey            ] - ServiceEvent UNREGISTERING - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.ekey.EKeyBindingProvider}={component.name=org.openhab.binding.ekey.genericbindingprovider, component.id=214, service.id=363, service.bundleid=210, service.scope=bundle} - org.openhab.binding.ekey
2016-11-20 20:13:40.361 [DEBUG] [.binding.ekey.internal.EKeyActivator] - eKey binding has been stopped.
2016-11-20 20:13:40.367 [DEBUG] [org.openhab.binding.ekey            ] - BundleEvent STOPPED - org.openhab.binding.ekey
2016-11-20 20:13:42.268 [DEBUG] [org.openhab.binding.ekey            ] - BundleEvent STARTING - org.openhab.binding.ekey
2016-11-20 20:13:42.272 [DEBUG] [.binding.ekey.internal.EKeyActivator] - eKey binding has been started.
2016-11-20 20:13:42.277 [DEBUG] [org.openhab.binding.ekey            ] - BundleEvent STARTED - org.openhab.binding.ekey
2016-11-20 20:13:42.358 [DEBUG] [org.openhab.binding.ekey            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.ekey.EKeyBindingProvider}={component.name=org.openhab.binding.ekey.genericbindingprovider, component.id=216, service.id=366, service.bundleid=210, service.scope=bundle} - org.openhab.binding.ekey
2016-11-20 20:13:42.372 [DEBUG] [org.openhab.binding.ekey            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.ekey, component.name=org.openhab.binding.ekey.binding, component.id=215, service.id=367, service.bundleid=210, service.scope=bundle} - org.openhab.binding.ekey

Do I miss something important on either side (ekey configuration or openHAB2 configuration)?

I do use the ekey with my legacy smarthome.py - on a UDP-Level. I get the payload from the ekey CV LAN and split it manually in a logic (similar to rules in openHAB). Which works fine with MULTI protocol.

So here are the payloads I can get from the CV LAN via UDP (each payload is the same origin, same finger, …):

// Protocol: MULTI:
Payload = 1#0001#TOM      #1#7#1#12345678901234#TUER#1#
// Protocol: HOME:
Payload = 1#0000#7#12345678901234#1#3
// Protocol: RARE:
yeah - it's BYTECODE. 

Thanks for help!
Thomas.

The problem might be that your delimiter character, #, should be escaped as described here. So the last line of your config would read

delimiter=\#
1 Like

So, you mean I just accidentally picked the delimiter, which is not allowed! :laughing:
So - I tried to escape the #, but this didn’t work. I also tried “-” and “_” as delimiter. After “-” I received some error like always:

2016-11-21 21:48:52.768 [ERROR] [ing.ekey.internal.EKeyPacketReceiver] - Error parsing packet
java.lang.IllegalArgumentException: Invalid Packet! Delimiter-match failed
	at at.fhooe.mc.schlgtwt.parser.MultiPacket.<init>(MultiPacket.java:53)[207:org.openhab.binding.ekey:1.9.0.201611210210]
	at org.openhab.binding.ekey.internal.EKeyPacketReceiver.run(EKeyPacketReceiver.java:136)[207:org.openhab.binding.ekey:1.9.0.201611210210]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
2016-11-21 21:48:52.778 [DEBUG] [ing.ekey.internal.EKeyPacketReceiver] - Received a packet that does not match the mode
you specified in the 'openhab.cfg'!

after changing to “_” there’s no more error in the openhab.log, but unfortunately not in events.log, where the changes for the items should appear, right? I also did some bundle:stop, bundle:start after changing the delimiter in the ekey.cfg, not sure, if it would refresh automatically.

PS: Is there a way to feature-install after a update of openHAB2 also? I had to reinstall ekey after upgrading openHAB2.

Sorry if the delimiter configuration didn’t solve the problem. I thought that might be because of

java.lang.NumberFormatException: For input string: "#0000"

and the documentation that says it has to be escaped.

I think distro upgrades are being fixed now. This binding won’t be installable until it’s known to work under OH2, so it still might require extra steps until then.

1 Like

ok. I kinda solved the thing. It still won’t use MULTI or HOME - but RARE at the Moment. YEAH! :beers:

bundle:stop 207 can’t stop the binding - it just loops endlessly? so I need to reboot the pi.
After the reboot, I can use RARE protocol. (despite: MULTI bringing the most Information).

2016-11-21 22:17:15.656 [INFO ] [ab.binding.ekey.internal.EKeyBinding] - new packet arrived: RarePacket [version=3, terminalid=1234567890, relayid=2, action=136, userid=0, fingerid=6(right index),
 name=0, personalid=0, serial=38150400, reserved=0, event=, terminalSerial=, time=]

so - if there’s some more I could do in the configuration for MULTI, I’d be glad, but RARE works for the moment.

edit: NOTE: see next post for solution:

I’m still a bit confused on the items, the RARE protocol updates. As I see it, only two items “action” and “userid” are updated.

// openhab.log
2016-11-21 23:22:56.715 [INFO ] [ab.binding.ekey.internal.EKeyBinding] - new packet arrived: RarePacket [version=3, terminalid=1933640080, relayid=2, action=136, userid=0, fingerid=6(right index), name=0, personalid=0, serial=38150400, reserved=0, event=, terminalSerial=, time=]
2016-11-21 23:22:58.204 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'ekey Aktion': An error occured during the script execution: The name 'ekey_door_fingerID' cannot be resolved to an item or type.

// events.log
2016-11-21 23:22:56.717 [ItemStateChangedEvent     ] - ekey_door_userid changed from NULL to 1
2016-11-21 23:22:56.734 [ItemStateChangedEvent     ] - ekey_door_action changed from NULL to 0

in my .items there’s

/* eKey - Fingerprint */
Number ekey_door_action				"Letzte Aktion [MAP(ekey_action.map):%d]"								<lock>	(EG_Windfang)		{ekey="action"}
Number ekey_door_userid				"letzter Benutzer [%s]"													<lock>	(EG_Windfang)		{ekey="userid"}
String ekey_door_username			"Last user that accessed the house was [%s]"                            <boy0>	(EG_Windfang)		{ekey="username"}
Number ekey_door_userstatus			"The status of the last user that entered was [MAP(ekey_userstatus.map):%d]" <lock>	(EG_Windfang)	{ekey="userstatus"}
String ekey_door_terminalID			"The last used terminal was the one at the [MAP(ekey_terminal.map):%s]"	<lock>	(EG_Windfang)		{ekey="terminalid"}
String ekey_door_terminalName		"The short name of the last used terminal was: [%s]"					<lock>	(EG_Windfang)		{ekey="terminalname"}
Number ekey_door_fingerID			"Last used finger was the [MAP(ekey_finger.map):%d]"					<lock>	(EG_Windfang)		{ekey="fingerid"}
Number ekey_door_keyID 				"Last defined key was: [MAP(ekey_key.map):%d]"							<lock>	(EG_Windfang)		{ekey="keyid"}
Number ekey_door_inputID			"The input that triggered the last action: [MAP(ekey_input.map):%d]"	<lock>	(EG_Windfang)		{ekey="inputid"}
Number ekey_door_relayID			"The relay that switched at the last action: [MAP(ekey_relay.map):%d]"	<lock>	(EG_Windfang)		{ekey="relayid"}
Number ekey_door_mode				"The packet mode was [MAP(ekey_mode.map):%d]"							<lock>	(EG_Windfang)		{ekey="mode"}´

in my .rules there’s

rule "ekey Aktion"
when
	Item ekey_door_action received update
then
	if(ekey_door_action.state==-1) {
		logInfo("ekey", "Es wurde kein Finger erkannt!")
	} else {
		var String name = transform("MAP","ekey_names.map",ekey_door_userid.state.toString())
		var String finger = transform("MAP","ekey_finger.map",ekey_door_fingerID.state.toString())
		var String terminal = transform("MAP","ekey_terminal.map",ekey_door_terminalID.state.toString())
		var String vorgang = ""
		
		if ((ekey_door_fingerID.state < 6) && (ekey_door_fingerID.state != 0)) {
			// es war die linke Hand => zussperren
			postUpdate(Nuki_EG_door, OFF) 
			vorgang = "zugesperrt"
		}
		if ((ekey_door_fingerID.state > 5) or (ekey_door_fingerID.state == 0)) {
			// es war die rechte Hand => aufsperren
			postUpdate(Nuki_EG_door, ON) 
			vorgang = "aufgesperrt"
		}

		var String text = name + " hat seinen " + finger + "-Finger beim " + terminal + " Terminal eingelöst und damit die Tür "+vorgang
		logInfo("ekey", "ekey-Aktion: "+text)
	}    
end

I Need the fingerid to determine, if it was a right hand finger (=open door) or a left hand finger (=close door).

What I learned now after several times going to the door, swiping the finger on the fingerprint is this:

  1. a bundle installed via the console (like I did with ekey-binding) doesn’t get the item updates via simple file-saving
  2. a bundle installed via the console only gets new item changes if the bundle (or even the openHAB service?) restarts

ad 2. I can’t test a simple bundle:restart in the console, because the ekey-bundle won’t stop (it loops at some point endlessly); I had to restart the Pi.

so: long story short: if the (ekey-)binding is installed via console bundle:install, you have to at least restart the respective bundle to get updates e.g. for the .items file.

What was the exact feature:install command you’re referring to?

oh. sorry. it was bundle:install, typo changed above!

like in this one:

bundle:install https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.ekey/target/org.openhab.binding.ekey-1.9.0-SNAPSHOT.jar
1 Like

OK, thanks! After the binding is proven to work on OH2, it will be installable as a feature like the others that are already installable.

yes, but for this to achieve, I think we need some input from the maintainer of the binding on my configuration. I guess, the CV LAN is putting the payload correctly in the three protocols available - but I think, I just can’t find the right delimter-configuration for HOME or what brings the most attributs: MULTI.

Hi
Whats happen to the ekey binding. Couldn’t find version 1.9 anywhere, any idea?
Thanks

Hi Christian,

the binding moved to version 1.10:

It works with RARE protocol - RARE is lacking some really useful attributes, which come with MULTI (my preferred mode), but at least it works - I opened two issues on github: one for including it in the normal build and one hoping for Fixing MULTI and HOME mode.

Hi Thomas

Thanks for you feedback :slight_smile:

Best regards
Christian

I’m also trying to get communication with the ekey home convertor. I installed a UDP test tool and get packets in the HOME and RARE protocol form. But no succes with the ekey binding so far. I have the following binding installed;
217 | Active | 80 | 1.10.0.201705190111 | openHAB eKey Binding
and tried the RARE protocol, if i see in the openhab log file, no entry is written when a doortrigger is done. Where can i look further to tackle the communcation? Thank in advance.Tom

Hi there,

post your.items and ekey.cfg (perhaps .rules) here, so we can have a look. At best with a screenshot of the "ekey_home_converter_LAN_config", where your settings are visible for the CV LAN.

Thomas,

I use no rules for the moment on the ekey part, just items.

ekey.cfg

    # ip address of the eKey udp converter (optional)
    ip=192.168.0.200
    # port number for the UDP packets
port=51000
    # mode can be RARE, MULTI or HOME depending on what your system supports - RARE is default
    mode=RARE
    # the delimiter is also defined on the eKey udp converter - use the eKey configuration
    # software to determine which delimiter is used or to change it.
    # Not defining this is the same as " "
    delimiter=_

items

// ekey

Number ekey_action				"Letzte Aktion"									<lock>	(deurstation)		{ekey="action"}
Number ekey_userid				"letzter Benutzer"								<lock>	(deurstation)		{ekey="userid"}

If i use the UDP test utility, i get a byte code back.

I’m a bit confused as to where the UDP port numbers come from and I’m sure I haven’t set it up right.

Firstly, the EKEY config. I’m using a RPI for openHAB. What port number do I use and how do I find it?

port number for the UDP packets

port=51000

Secondly, in the EKEY LAN config there’s a Sender and a Receiver port. What values do I put in here and where do I get them from?
Is the Receiver IP address the address of the RPi running Openhab .

Current values as shown are made up.

Any pointers would be great. Thanks!

Hi Tom,

I’m a bit confused on the port number for the UDP packets. In both ekey.cfg and UDP Test Tool 3.0 your listening to port 51000, whereas in the ekey home converter LAN you defined 56000?

other than that, the two most important questions:

  1. your openHAB is running on 192.168.0.150?
  2. your openHAB listens to 56000 (see above)?

with that, we’ll dive into OH2-config:

ekey.cfg
your config seems ok, if your CVLAN is 192.168.0.200
only thing I did, I commented the delimiter line (as it isn’t needed in RARE mode):

# ip address of the eKey udp converter (optional)
ip=192.168.xx.xx
# port number for the UDP packets
port=21000
# mode can be RARE, MULTI or HOME depending on what your system supports - RARE is default
mode=RARE
# the delimiter is also defined on the eKey udp converter - use the eKey configuration
# software to determine which delimiter is used or to change it.
# Not defining this is the same as " "
#delimiter=_

saying this: Be sure, your OH2 is able to receive UDP packets, please check your router and/or your OH2-server on this. I once used the TCP-binding to check, if the UDP packets are received - but you could also use udp-receiver.

ekey.items
also seems legit to me, you could try the spelling, though I use “Action” and “User ID” instead of “action” and “user id”:

/* eKey - Fingerprint */
DateTime ekey_doorActionTime		"Letzte EKey-Aktion Zeit [%1$td %1$tb um %1$tR]]"		<lock>	(gEkey, EG_Windfang)
Number ekey_doorAction			"EKey-Aktion [MAP(ekey_action.map):%s]"				<lock>	(gEkey, EG_Windfang)				{ekey="Action"}
Number ekey_doorUserid			"Benutzer [MAP(ekey_names.map):%s]"				<lock>	(gEkey, EG_Windfang)				{ekey="UserID"}
Number ekey_doorFingerID		"Benutzter Finger [MAP(ekey_finger.map):%s]"			<lock>	(gEkey, EG_Windfang)				{ekey="FingerID"}
String ekey_doorTerminalID		"Benutzes Terminal [MAP(ekey_terminal.map):%s]"				(gEkey)						{ekey="TerminalID"}

Hi Tom(Saracen),

which Version of “ekey home converter LAN” do you use? Seems pretty old? :wink:
My CV LAN have Firmware 3.2.31.6 and the Windows-Exe is Version 4.3.34.24.

So my first suggestion is to update both your CV LANs and download the newest exe from ekey.net.
Second, please read through my post before this in response to the other Tom (Wouters), you should find all the Information there for your config.