Hi Guys, Ive got the following config but I cannot get the listener node to go green so when I swipe on my door access controller it passes the Rfid cards ID number. I found out my controller was strangly trying to send its messages to some 120.x.x.x IP address and with the help of AI and using an inject node to change it to my Node Red IP
All functions with node red to trigger the door and update the door status (open or closed) work just fine. Its just the swiping which apparently needs a listener.
Is anyone able to point me in the right direction? Thanks!
[
{
"id": "e47fc3a5fa69b253",
"type": "tab",
"label": "Side Gate Controller",
"disabled": false,
"info": "",
"env": []
},
{
"id": "aa3d637857f1d95d",
"type": "uhppoted-config",
"name": "Side Gate Controller",
"timeout": 5000,
"bind": "0.0.0.0",
"broadcast": "255.255.255.255",
"listen": "0.0.0.0:60001",
"controllers": "{\"225024747\":{\"address\":\"192.168.0.19:60000\",\"broadcast\":false}}",
"debug": false
},
{
"id": "e8800b19f39e0d4f",
"type": "http in",
"z": "e47fc3a5fa69b253",
"name": "\"Receive OpenHAB Command\"",
"url": "/gate-trigger",
"method": "post",
"upload": false,
"skipBodyParsing": false,
"swaggerDoc": "",
"x": 650,
"y": 220,
"wires": [
[
"18f855cee5ac50c3",
"1c24cf9d16610b45"
]
]
},
{
"id": "18f855cee5ac50c3",
"type": "http response",
"z": "e47fc3a5fa69b253",
"name": "Return Success to OpenHAB",
"statusCode": "",
"headers": {},
"x": 1080,
"y": 240,
"wires": []
},
{
"id": "ed6d133168d3b62d",
"type": "uhppoted-open-door",
"z": "e47fc3a5fa69b253",
"name": "Open Door",
"topic": "",
"config": "aa3d637857f1d95d",
"x": 1670,
"y": 60,
"wires": [
[]
]
},
{
"id": "1c24cf9d16610b45",
"type": "function",
"z": "e47fc3a5fa69b253",
"name": "Side Gate Controller Function",
"func": "msg.payload = {\n \"controller\": 225024747,\n \"door\": 1\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1270,
"y": 60,
"wires": [
[
"ed6d133168d3b62d"
]
]
},
{
"id": "600ec7a569aff289",
"type": "function",
"z": "e47fc3a5fa69b253",
"name": "Translate the Gate Status",
"func": "if (msg.payload && msg.payload.state && msg.payload.state.doors) {\n \n // In your debug, doors: 1 is false (CLOSED) or true (OPEN)\n let isDoorOpen = msg.payload.state.doors[1];\n let status = (isDoorOpen === true) ? \"OPEN\" : \"CLOSED\";\n\n msg.payload = status;\n msg.method = \"PUT\"; // Required for state updates\n msg.url = \"http://192.168.0.3:8080/rest/items/Side_Gate_Status/state\";\n msg.headers = { \n \"Content-Type\": \"text/plain\" \n };\n\n return msg;\n}\nreturn null;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2630,
"y": 200,
"wires": [
[
"af036a5c6b526dc8"
]
]
},
{
"id": "af036a5c6b526dc8",
"type": "http request",
"z": "e47fc3a5fa69b253",
"name": "Update Side Gate Status",
"method": "use",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 2950,
"y": 200,
"wires": [
[]
]
},
{
"id": "f59d5b01425658d2",
"type": "inject",
"z": "e47fc3a5fa69b253",
"name": "Poll Gate Status every 3s",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1680,
"y": 280,
"wires": [
[
"ec2ff4fca5f5538b"
]
]
},
{
"id": "6b31c2a8b43798bc",
"type": "uhppoted-get-status",
"z": "e47fc3a5fa69b253",
"name": "Get the Gate Status",
"topic": "",
"config": "aa3d637857f1d95d",
"x": 2300,
"y": 280,
"wires": [
[
"600ec7a569aff289"
]
]
},
{
"id": "ec2ff4fca5f5538b",
"type": "function",
"z": "e47fc3a5fa69b253",
"name": "Set Controller ID",
"func": "msg.payload = {\n \"controller\": 225024747\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1980,
"y": 280,
"wires": [
[
"6b31c2a8b43798bc"
]
]
},
{
"id": "da45b571232167e4",
"type": "uhppoted-listen",
"z": "e47fc3a5fa69b253",
"name": "LIVE Swipe Listener",
"topic": "",
"config": "aa3d637857f1d95d",
"x": 1720,
"y": 960,
"wires": [
[
"b1da64ee38c89ee4",
"8fb54dffe0242e82"
]
]
},
{
"id": "b1da64ee38c89ee4",
"type": "function",
"z": "e47fc3a5fa69b253",
"name": "Process Side Gate Swipe",
"func": "if (msg.payload && msg.payload.event) {\n let event = msg.payload.event;\n let cardID = event[\"card-number\"];\n let doorID = event[\"door-id\"]; \n if (doorID === 1 && cardID > 0) {\n msg.payload = cardID.toString();\n msg.method = \"PUT\"; \n msg.url = \"http://192.168.0.3:8080/rest/items/Side_Gate_LastCard_Swiped/state\";\n msg.headers = { \"Content-Type\": \"text/plain\" };\n return msg;\n }\n}\nreturn null;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 790,
"y": 860,
"wires": [
[
"28a1dcb3fecaeb78"
]
]
},
{
"id": "28a1dcb3fecaeb78",
"type": "http request",
"z": "e47fc3a5fa69b253",
"name": "Send to openHAB",
"method": "use",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1350,
"y": 820,
"wires": [
[]
]
},
{
"id": "964692be450a12ef",
"type": "inject",
"z": "e47fc3a5fa69b253",
"name": "STEP 1: CLICK ME TO FIX IP",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "str",
"x": 760,
"y": 700,
"wires": [
[
"c3b78d75b3553203"
]
]
},
{
"id": "c3b78d75b3553203",
"type": "function",
"z": "e47fc3a5fa69b253",
"name": "Set Node Red IP",
"func": "msg.payload = {\n \"controller\": 225024747,\n \"address\": \"192.168.0.11\",\n \"port\": 60001\n};\nreturn msg;",
"outputs": 1,
"x": 1310,
"y": 700,
"wires": [
[
"8ec5942945c50140"
]
]
},
{
"id": "8ec5942945c50140",
"type": "uhppoted-set-listener",
"z": "e47fc3a5fa69b253",
"name": "",
"topic": "",
"config": "aa3d637857f1d95d",
"x": 1810,
"y": 620,
"wires": [
[
"8fb54dffe0242e82"
]
]
},
{
"id": "8fb54dffe0242e82",
"type": "debug",
"z": "e47fc3a5fa69b253",
"name": "debug 1",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 2260,
"y": 580,
"wires": []
},
{
"id": "3a61d4b0578703f3",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-uhppoted": "1.1.12"
}
}
]