I need to send a 4-bit message to 4 separate GPIOs. I found a flow which allows you to send multi-line exec node commands and set it up for that purpose:
[
{
"id": "1a73c740.e06d79",
"type": "subflow",
"name": "Execute Shell Script",
"info": "",
"in": [
{
"x": 100,
"y": 200,
"wires": [
{
"id": "662c3c62.43d624"
}
]
}
],
"out": [
{
"x": 960,
"y": 280,
"wires": [
{
"id": "9e92978.d8d0868",
"port": 0
}
]
},
{
"x": 960,
"y": 340,
"wires": [
{
"id": "9e92978.d8d0868",
"port": 1
}
]
},
{
"x": 960,
"y": 400,
"wires": [
{
"id": "9e92978.d8d0868",
"port": 2
}
]
}
]
},
{
"id": "dda86e6b.3b362",
"type": "file",
"z": "1a73c740.e06d79",
"name": "Write script file",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"x": 860,
"y": 140,
"wires": [
[]
]
},
{
"id": "7a2a96f.a52b268",
"type": "exec",
"z": "1a73c740.e06d79",
"command": "mktemp",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "",
"x": 420,
"y": 200,
"wires": [
[
"9131a546.667eb8"
],
[],
[]
]
},
{
"id": "c9fb5364.0becc",
"type": "file",
"z": "1a73c740.e06d79",
"name": "Delete script file",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": false,
"overwriteFile": "delete",
"x": 1020,
"y": 480,
"wires": [
[]
]
},
{
"id": "9e92978.d8d0868",
"type": "exec",
"z": "1a73c740.e06d79",
"command": " sh ",
"addpay": true,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Execute the shell script",
"x": 690,
"y": 340,
"wires": [
[
"c9fb5364.0becc"
],
[],
[]
]
},
{
"id": "36f470a4.a6a84",
"type": "exec",
"z": "1a73c740.e06d79",
"command": "chmod +x ",
"addpay": true,
"append": "",
"useSpawn": "",
"timer": "",
"name": "",
"x": 1040,
"y": 200,
"wires": [
[
"6ba1dbc1.d547b4"
],
[],
[]
]
},
{
"id": "662c3c62.43d624",
"type": "change",
"z": "1a73c740.e06d79",
"name": "",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 230,
"y": 200,
"wires": [
[
"7a2a96f.a52b268"
]
]
},
{
"id": "a61c48a5.e5dc88",
"type": "change",
"z": "1a73c740.e06d79",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "filename",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 860,
"y": 200,
"wires": [
[
"36f470a4.a6a84"
]
]
},
{
"id": "9131a546.667eb8",
"type": "function",
"z": "1a73c740.e06d79",
"name": "",
"func": "msg.filename = msg.payload.trim();\nmsg.payload = msg.command;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 590,
"y": 180,
"wires": [
[
"dda86e6b.3b362",
"a61c48a5.e5dc88"
]
]
},
{
"id": "6ba1dbc1.d547b4",
"type": "change",
"z": "1a73c740.e06d79",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "filename",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 340,
"wires": [
[
"9e92978.d8d0868"
]
]
},
{
"id": "f21f0fb8.12361",
"type": "comment",
"z": "1a73c740.e06d79",
"name": "Execute shell script",
"info": "Execute the shell script in msg.payload.",
"x": 130,
"y": 40,
"wires": []
},
{
"id": "3c6751f317a368c2",
"type": "rpi-gpio out",
"z": "e7bc54457b5634db",
"name": "Enable modulator output",
"pin": "25",
"set": true,
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 730,
"y": 380,
"wires": []
},
{
"id": "dff785c9299e71e8",
"type": "trigger",
"z": "e7bc54457b5634db",
"name": "",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "500",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 730,
"y": 340,
"wires": [
[
"3c6751f317a368c2"
]
]
},
{
"id": "743f5337.595bcc",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "All on",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 260,
"wires": [
[
"92fd8149.b5867"
]
]
},
{
"id": "92fd8149.b5867",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dh\nraspi-gpio set 23 dl\nraspi-gpio set 22 dh\nraspi-gpio set 17 dh",
"x": 290,
"y": 260,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "5b242947.2d4ac8",
"type": "subflow:1a73c740.e06d79",
"z": "e7bc54457b5634db",
"x": 520,
"y": 260,
"wires": [
[
"24c6f0cd.3edaa",
"dff785c9299e71e8"
],
[
"24c6f0cd.3edaa"
],
[
"24c6f0cd.3edaa"
]
]
},
{
"id": "24c6f0cd.3edaa",
"type": "debug",
"z": "e7bc54457b5634db",
"name": "Log the result",
"active": true,
"console": "false",
"complete": "payload",
"x": 730,
"y": 260,
"wires": []
},
{
"id": "eee8acd1c89496ad",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "All off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 300,
"wires": [
[
"5e2bcc0248a55f0d"
]
]
},
{
"id": "5e2bcc0248a55f0d",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dl\nraspi-gpio set 23 dl\nraspi-gpio set 22 dh\nraspi-gpio set 17 dh",
"x": 290,
"y": 300,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "bc77d2e0b2603b01",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#1 on",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 400,
"wires": [
[
"3d091aadbf38796d"
]
]
},
{
"id": "3d091aadbf38796d",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dh\nraspi-gpio set 23 dh\nraspi-gpio set 22 dh\nraspi-gpio set 17 dh",
"x": 290,
"y": 400,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "ad626ceb7ae18c8e",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#1 off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 440,
"wires": [
[
"e873eb2022ddbd9d"
]
]
},
{
"id": "e873eb2022ddbd9d",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dl\nraspi-gpio set 23 dh\nraspi-gpio set 22 dh\nraspi-gpio set 17 dh",
"x": 290,
"y": 440,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "141fd9d02b7bc8b9",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#2 on",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 540,
"wires": [
[
"09a3bcf4de29f672"
]
]
},
{
"id": "09a3bcf4de29f672",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dh\nraspi-gpio set 23 dh\nraspi-gpio set 22 dh\nraspi-gpio set 17 dl",
"x": 290,
"y": 540,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "1ecfd6479683fda5",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#2 off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 580,
"wires": [
[
"2ad3b650166322a9"
]
]
},
{
"id": "2ad3b650166322a9",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dl\nraspi-gpio set 23 dh\nraspi-gpio set 22 dh\nraspi-gpio set 17 dl",
"x": 290,
"y": 580,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "8ce0bbd7c247d537",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#3 on",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 680,
"wires": [
[
"2c22ed0d305ed154"
]
]
},
{
"id": "2c22ed0d305ed154",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dh\nraspi-gpio set 23 dh\nraspi-gpio set 22 dl\nraspi-gpio set 17 dh",
"x": 290,
"y": 680,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "8c72f9e4c1110c9a",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#3 off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 720,
"wires": [
[
"84f85a0077601162"
]
]
},
{
"id": "84f85a0077601162",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dl\nraspi-gpio set 23 dh\nraspi-gpio set 22 dl\nraspi-gpio set 17 dh",
"x": 290,
"y": 720,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "bb33a1809c185051",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#4 on",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 820,
"wires": [
[
"b22e378094eae18f"
]
]
},
{
"id": "b22e378094eae18f",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dh\nraspi-gpio set 23 dh\nraspi-gpio set 22 dl\nraspi-gpio set 17 dl",
"x": 290,
"y": 820,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "5a41aa51f7763f87",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "#4 off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 860,
"wires": [
[
"007e7ae68c43a940"
]
]
},
{
"id": "007e7ae68c43a940",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 27 dl\nraspi-gpio set 23 dh\nraspi-gpio set 22 dl\nraspi-gpio set 17 dl",
"x": 290,
"y": 860,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "fc18859c1f981288",
"type": "comment",
"z": "e7bc54457b5634db",
"name": "Appliance name",
"info": "",
"x": 140,
"y": 360,
"wires": []
},
{
"id": "3dc0b1a7180c0932",
"type": "comment",
"z": "e7bc54457b5634db",
"name": "Appliance name",
"info": "",
"x": 140,
"y": 500,
"wires": []
},
{
"id": "9f6a602cff0436db",
"type": "comment",
"z": "e7bc54457b5634db",
"name": "Appliance name",
"info": "",
"x": 140,
"y": 640,
"wires": []
},
{
"id": "2c81906637eede98",
"type": "comment",
"z": "e7bc54457b5634db",
"name": "Appliance name",
"info": "",
"x": 140,
"y": 780,
"wires": []
},
{
"id": "6979794cf1afb8c2",
"type": "inject",
"z": "e7bc54457b5634db",
"name": "Setup GPIOs",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 300,
"y": 80,
"wires": [
[
"7f87ef523d955b62"
]
]
},
{
"id": "7f87ef523d955b62",
"type": "template",
"z": "e7bc54457b5634db",
"name": "Shell Script",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "#! /bin/sh\n\nraspi-gpio set 24 dl",
"x": 290,
"y": 140,
"wires": [
[
"5b242947.2d4ac8"
]
]
},
{
"id": "4275755d2bb2b92d",
"type": "rpi-gpio out",
"z": "e7bc54457b5634db",
"d": true,
"name": "Mode select (low=OOK mode)",
"pin": "24",
"set": true,
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 710,
"y": 560,
"wires": []
},
{
"id": "02a1c830607dc6bc",
"type": "rpi-gpio in",
"z": "e7bc54457b5634db",
"name": "GPIO 27",
"pin": "27",
"intype": "tri",
"debounce": "25",
"read": true,
"bcm": true,
"x": 920,
"y": 260,
"wires": [
[
"68edf16c66b98012"
]
]
},
{
"id": "ced24b84793e7187",
"type": "rpi-gpio in",
"z": "e7bc54457b5634db",
"name": "GPIO23",
"pin": "23",
"intype": "tri",
"debounce": "25",
"read": true,
"bcm": true,
"x": 920,
"y": 320,
"wires": [
[
"5a66232ebdaab619"
]
]
},
{
"id": "b3d901a3379f899c",
"type": "rpi-gpio in",
"z": "e7bc54457b5634db",
"name": "GPIO22",
"pin": "22",
"intype": "tri",
"debounce": "25",
"read": true,
"bcm": true,
"x": 920,
"y": 380,
"wires": [
[
"743fba18cff09729"
]
]
},
{
"id": "fed780bb4417682e",
"type": "rpi-gpio in",
"z": "e7bc54457b5634db",
"name": "GPIO17",
"pin": "17",
"intype": "tri",
"debounce": "25",
"read": true,
"bcm": true,
"x": 920,
"y": 440,
"wires": [
[
"1fa7bcd106266a0d"
]
]
},
{
"id": "68edf16c66b98012",
"type": "debug",
"z": "e7bc54457b5634db",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1060,
"y": 260,
"wires": []
},
{
"id": "5a66232ebdaab619",
"type": "debug",
"z": "e7bc54457b5634db",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1060,
"y": 320,
"wires": []
},
{
"id": "743fba18cff09729",
"type": "debug",
"z": "e7bc54457b5634db",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1060,
"y": 380,
"wires": []
},
{
"id": "1fa7bcd106266a0d",
"type": "debug",
"z": "e7bc54457b5634db",
"name": "debug 4",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1060,
"y": 440,
"wires": []
}
]