eKey Binding and compatibility with ekey Multi and/or OpenHAB2

Hi Marcel,

I figured, I do have configured my setup exactly like yours… :wink:
And it works:

ekey.cfg

# ip address of the eKey udp converter (optional)
ip=192.168.x.x
# 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=_

ekey.items

/* 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"}

ekey_terminal.map

NULL=unbekannt
12345678901234=Haustür
xxxxxx78901234=Haustür

I don’t remember why I add this, and I don’t have the items logged in events.log, but I do get it transformed:

ekey.rules

rule "ekey Aktion"
when
	Item ekey_doorUserid received update
then
	if (ekey_doorUserid.state == -1) {
		logInfo("ekey", "Es wurde kein Finger erkannt!")
	} else {
		var String name = transform("MAP","ekey_names.map",ekey_doorUserid.state.toString())
		var String finger = transform("MAP","ekey_finger.map",ekey_doorFingerID.state.toString())
		var String terminal = transform("MAP","ekey_terminal.map",ekey_doorTerminalID.state.toString())
		var String vorgang = ""

		if ((ekey_doorFingerID.state < 20) && (ekey_doorFingerID.state != 30)) {
			// es war die linke Hand => zussperren
			postUpdate(Nuki_doorLocked, ON)
			vorgang = "zugesperrt"
		}
		if ((ekey_doorFingerID.state > 20) && (ekey_doorFingerID.state != 30)) {
			// es war die rechte Hand => aufsperren
			postUpdate(Nuki_doorLocked, OFF)
			vorgang = "aufgesperrt"
		}
		postUpdate(ekey_doorActionTime, new DateTimeType())
		var String text = name + " hat den" + finger + "Finger beim " + terminal + " Terminal aufgelegt und damit die Tür "+vorgang.toString
		logInfo("ekey", "ekey-Aktion: "+text)
	}
end

openhab.log:

2017-11-04 18:21:44.410 [INFO ] [.eclipse.smarthome.model.script.ekey] - ekey-Aktion: Andrea hat den rechten Zeige-Finger beim Haustür Terminal aufgelegt und damit die Tür aufgesperrt.

So just try putting both transforms in the map-file? :thinking:

edit:
I set the binding into TRACE mode in the karaf console (log:set TRACE org.openhab.binding.ekey) and got the following in openhab.log:

2017-11-08 07:13:25.829 [DEBUG] [ab.binding.ekey.internal.EKeyBinding] - new packet arrived RarePacket [version=3, terminalid=5678901234, relayid=2, action=136, userid=0, fingerid=6(right index),

Now I’m completely confused, as the TerminalID doesn’t match my map-file…? :confused:

Ok, this is somehow strange. I solved it now with a new item and in the rule.

new item in item file

String eKey_TerminalName

rule

rule Welcome
when
    Item Action received update
then
	var String terminal = eKey_TerminalID.state.toString	
	if (terminal== "xxxxxx19150360"){
		eKey_TerminalName.postUpdate("garagedoor")
	}else {
		eKey_TerminalName.postUpdate("frontdoor")
	}
	var String door = eKey_TerminalName.state.toString	
    if (eKey_Action.state==-1){
		var String message = "Not authorized access at " + door + "!"
        sendBroadcastNotification(message)
	}
	else {
            var String name = transform("MAP","ekey_names.map",eKey_UserID.state.toString())
            var String finger = transform("MAP","ekey_finger.map",eKey_FingerID.state.toString())					
            			
			var String text = name + " has opened the " + door + " with " + finger			
            
			eKey_LastAccess.postUpdate(new DateTimeType(now.toString))		
			sendBroadcastNotification(text) 			
    }
end

Is there any hope for an ekey 3.0 binding?

I’m also interested in the ekey 3.0 binding…

1 Like

In preparation for openhab 3.0 I have implemented a workaround:
I installed mosquitto and fhem, connected fhem to the ekey-lan-adapter (nice youtube video with all needed explanations) and propagated with mqtt_generic_bridge all ekey-readings to mosquitto and by the mqtt-binding finally to openhab.

phew! :wink:
THAT’S a hell of a workaround!

I for my part are hoping to get a compatible ekey binding and in the meantime I’ll use Remote openHAB Binding and have a second openHABian running my legacy bindings.