Hi All,
I am trying to use a serial flow to drive a relay box via serial over a USB/RS485 device.
I tried to import dedicated RS485 nodes, but they will not load.
When I send using a standard serial node, I get a response of "0x00" from the other device, so it is listening (I believe).
If I power the other device off and on, it sends a message of payload 0x0, followed by another of 0xf0, 0xa2,0x76,0x6, 0x0 which means nothing to me.
I am trying to send "FD 20 02 01 01 5D" in ASCII terms, and if I capture debug, I send [253, 2 32,1,1,93], and it is received and I get a response of the same buffer back (as "request_payload", and a payload of 0x0.
I am stuck, and have been trying various things to no effect. Appreciate any help here folks.
My flow is as below:
[
{
"id": "4a0ac2ce.818e0c",
"type": "debug",
"z": "7b472191.351b1",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 990,
"y": 420,
"wires": []
},
{
"id": "34c334a.41043cc",
"type": "serial in",
"z": "7b472191.351b1",
"name": "485-Rx",
"serial": "e19b9f04.c6402",
"x": 790,
"y": 420,
"wires": [
[
"4a0ac2ce.818e0c"
]
]
},
{
"id": "a713e90a.e26dd8",
"type": "inject",
"z": "7b472191.351b1",
"name": "",
"topic": "Relay 1 - 485",
"payload": "ON",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 140,
"y": 340,
"wires": [
[
"5b15a315.665a3c"
]
]
},
{
"id": "216318b1.0d9728",
"type": "debug",
"z": "7b472191.351b1",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 950,
"y": 480,
"wires": []
},
{
"id": "5b15a315.665a3c",
"type": "function",
"z": "7b472191.351b1",
"name": "Set Buffer",
"func": "//var buf = JSON.stringify([\"0xFD\",\"0x02\",\"0x20\",\"0x01\",\"0x01\",\"0x5D\"]);\nvar buf = ([0xFD,0x02,0x20,0x01,0x01,0x5D]);\n//var buf = Buffer.from([0xFD,0x02,0x20,0x01,0x00,0x5D]);\n//var buf = JSON.stringify(['FD 02 20 01 00 5D']);\n//var buf = ([253,2,20,1,0,93]);\n//var buf = (['FD','02','20','01','01','5D']);\n\nmsg.payload=buf;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 320,
"y": 340,
"wires": [
[
"2b040dd5.6787b2"
]
]
},
{
"id": "2b040dd5.6787b2",
"type": "json",
"z": "7b472191.351b1",
"name": "To JS Object",
"property": "payload",
"action": "obj",
"pretty": true,
"x": 510,
"y": 360,
"wires": [
[
"b764cca6.ad507",
"f85acbfa.253f18",
"70fa758d.f0316c"
]
]
},
{
"id": "70fa758d.f0316c",
"type": "serial request",
"z": "7b472191.351b1",
"name": "485-Tx",
"serial": "e19b9f04.c6402",
"x": 800,
"y": 360,
"wires": [
[
"2f8b8eb.fda4d72"
]
]
},
{
"id": "e287a329.e8872",
"type": "inject",
"z": "7b472191.351b1",
"name": "",
"topic": "Relay 1 - 485",
"payload": "OFF",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 150,
"y": 380,
"wires": [
[
"37c37ef9.805612"
]
]
},
{
"id": "37c37ef9.805612",
"type": "function",
"z": "7b472191.351b1",
"name": "Set Buffer",
"func": "//var buf = JSON.stringify([\"0xFD\",\"0x02\",\"0x20\",\"0x01\",\"0x01\",\"0x5D\"]);\nvar buf = ([0xFD,0x02,0x20,0x01,0x00,0x5D]);\n//var buf = Buffer.from([0xFD,0x02,0x20,0x01,0x00,0x5D]);\n//var buf = JSON.stringify(['FD 02 20 01 01 5D']);\n//var buf = ([253,2,20,1,0,93]);\n//var buf = (['FD','02','20','01','00','5D']);\n\nmsg.payload=buf;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 320,
"y": 380,
"wires": [
[
"2b040dd5.6787b2"
]
]
},
{
"id": "2f8b8eb.fda4d72",
"type": "debug",
"z": "7b472191.351b1",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 990,
"y": 360,
"wires": []
},
{
"id": "b764cca6.ad507",
"type": "json",
"z": "7b472191.351b1",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 790,
"y": 480,
"wires": [
[
"216318b1.0d9728"
]
]
},
{
"id": "d875a16f.90171",
"type": "serial out",
"z": "7b472191.351b1",
"name": "",
"serial": "e19b9f04.c6402",
"x": 810,
"y": 300,
"wires": []
},
{
"id": "f85acbfa.253f18",
"type": "debug",
"z": "7b472191.351b1",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 810,
"y": 240,
"wires": []
},
{
"id": "e19b9f04.c6402",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyUSB0",
"serialbaud": "115200",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"dtr": "none",
"rts": "none",
"cts": "none",
"dsr": "none",
"newline": "0",
"bin": "bin",
"out": "time",
"addchar": "",
"responsetimeout": ""
}
]