Skip to content

Instantly share code, notes, and snippets.

@klein0r
Created July 30, 2019 12:49
Show Gist options
  • Select an option

  • Save klein0r/f5413a8e663aaac43e587cebc5423c62 to your computer and use it in GitHub Desktop.

Select an option

Save klein0r/f5413a8e663aaac43e587cebc5423c62 to your computer and use it in GitHub Desktop.
ekey event - split data of LAN converter

When you are using an ekey finger scanner, you can also add the LAN converter and send udp events to other systems in the network (like Node-RED).

This flow will help you to receive "home" events of the converter and splits the information into an object. Just configure Node-RED as the target in the ekey configuration tool and use target port 5555 (or change it in the udp node after import).

Type

  • always 1

User

  • "null" if not allowed
  • ID of user if allowed

Finger

  • "null" if not found
  • 99 = RFID
  • ID of finger if allowed
    • 1 = left pinkie finger
    • 2 = left ring finger
    • 3 = left middle finger
    • 4 = left index finger
    • 5 = left thumb
    • 6 = right thumb
    • 7 = right index finger
    • 8 = right middle finger
    • 9 = right ring finger
    • 0 = right pinkie finger

Scanner

  • Serial of user scanner

Action

  • 1 if ok
  • 2 if not recognized / unknown / not allowed

Relay

  • "null" if nothing
  • ID of switched relay if allowed
    • 1 = Relay 1
    • 2 = Relay 2
    • 3 = Relay 3
    • 4 = Relay 4
    • 99 = Double Relay
[
{
"id": "349ce054.11564",
"type": "tab",
"label": "ekey",
"disabled": false,
"info": ""
},
{
"id": "38f57fd8.f2763",
"type": "udp in",
"z": "349ce054.11564",
"name": "ekey LAN-Converter",
"iface": "",
"port": "5555",
"ipv": "udp4",
"multicast": "false",
"group": "",
"datatype": "utf8",
"x": 130,
"y": 360,
"wires": [
[
"f45ef3d1.444da"
]
]
},
{
"id": "5e6d4f1a.29479",
"type": "debug",
"z": "349ce054.11564",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 830,
"y": 300,
"wires": []
},
{
"id": "f45ef3d1.444da",
"type": "function",
"z": "349ce054.11564",
"name": "Split ekey-Event",
"func": "var data = msg.payload.split('_', 6);\n\nmsg.payload = {\n type: data[0],\n user: data[1] == '0000' ? null : parseInt(data[1]),\n finger: isNaN(data[2]) ? (data[2] == 'R' ? 99 : null) : parseInt(data[2]),\n scanner: data[3],\n action: parseInt(data[4]),\n relay: isNaN(data[5]) ? (data[5] == 'd' ? 99 : null) : parseInt(data[5])\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 340,
"y": 360,
"wires": [
[
"6bd6e376.10aeac"
]
]
},
{
"id": "6bd6e376.10aeac",
"type": "switch",
"z": "349ce054.11564",
"name": "Check Permission",
"property": "payload.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "eq",
"v": "2",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 550,
"y": 360,
"wires": [
[
"5e6d4f1a.29479"
],
[]
],
"inputLabels": [
"ekey-Event"
],
"outputLabels": [
"OK",
"Forbidden"
]
},
{
"id": "63377688.c264a8",
"type": "comment",
"z": "349ce054.11564",
"name": "Help (see Description)",
"info": "**Type**\n\n- always 1\n\n**User**\n\n- \"null\" if not allowed\n- ID of user if allowed\n\n**Finger**\n\n- \"null\" if not found\n- 99 = RFID\n- ID of finger if allowed\n - 1 = left pinkie finger\n - 2 = left ring finger\n - 3 = left middle finger\n - 4 = left index finger\n - 5 = left thumb\n - 6 = right thumb\n - 7 = right index finger\n - 8 = right middle finger\n - 9 = right ring finger\n - 0 = right pinkie finger\n\n**Scanner**\n\n- Serial of user scanner\n\n**Action**\n\n- 1 if ok\n- 2 if not recognized / unknown / not allowed\n\n**Relay**\n\n- \"null\" if nothing\n- ID of switched relay if allowed\n - 1 = Relay 1\n - 2 = Relay 2\n - 3 = Relay 3\n - 4 = Relay 4\n - 99 = Double Relay",
"x": 360,
"y": 320,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment