Automator string building example flow
Frequently Asked Questions
Brand:
- AMX
Models:
- Muse Automator
Question:
How to build a string in Muse Automator?
Answer:
Please copy and import the example below of how, in Muse Automator, to store values in flow variables and then use those values to create a string to send to a device.
This example uses change nodes to store an input number and output number into flow.input and flow.output. (Use the inject node to select the input and output number.)
The inject node labeled Take is then used to trigger the function node which uses the current values of the flow variables to build a string and then returns the message object. The string that was built will be returned in msg.payload.
The string is sent to a debug node for example purposes.
[
{
"id": "371f296449d283a1",
"type": "tab",
"label": "String Building Example",
"disabled": false,
"info": "",
"env": []
},
{
"id": "7dfd0f04075f7d47",
"type": "group",
"z": "371f296449d283a1",
"name": "Input and Output Selection",
"style": {
"label": true
},
"nodes": [
"29828ab7ba234f16",
"c3c84d143a07bf6f",
"724fdc1f3e2d1447",
"c5e0edb28cd123a5",
"877df226d19fb3ec",
"dd62fcbcbcdab4fa",
"7b20dbddf6615be3",
"48e26722ceaa4c76",
"db1c17b345970405",
"bd4acf9e43512799",
"52f41f684b96499d",
"ca1f4e892e31723e",
"b1e4cbf4f4b3a3a5",
"b9e0d73966231264",
"7f77b04fc57f28e1",
"a10afd218a879eeb"
],
"x": 94,
"y": 59,
"w": 792,
"h": 202
},
{
"id": "de7982691b07d045",
"type": "function",
"z": "371f296449d283a1",
"name": "Command Building Function",
"func": "var input = flow.get(\"input\")\nvar output = flow.get(\"output\")\n\nmsg.payload = Buffer.from(\"CI\"+input+\"O\"+output);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 440,
"wires": [
[
"0101dceb8a0e5912"
]
]
},
{
"id": "29828ab7ba234f16",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 1",
"rules": [
{
"t": "set",
"p": "input",
"pt": "flow",
"to": "1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 100,
"wires": [
[]
]
},
{
"id": "c3c84d143a07bf6f",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 2",
"rules": [
{
"t": "set",
"p": "input",
"pt": "flow",
"to": "2",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 140,
"wires": [
[]
]
},
{
"id": "724fdc1f3e2d1447",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 3",
"rules": [
{
"t": "set",
"p": "input",
"pt": "flow",
"to": "3",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 180,
"wires": [
[]
]
},
{
"id": "c5e0edb28cd123a5",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 4",
"rules": [
{
"t": "set",
"p": "input",
"pt": "flow",
"to": "4",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 220,
"wires": [
[]
]
},
{
"id": "877df226d19fb3ec",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 1",
"rules": [
{
"t": "set",
"p": "output",
"pt": "flow",
"to": "1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 800,
"y": 100,
"wires": [
[]
]
},
{
"id": "dd62fcbcbcdab4fa",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 4",
"rules": [
{
"t": "set",
"p": "output",
"pt": "flow",
"to": "4",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 800,
"y": 220,
"wires": [
[]
]
},
{
"id": "7b20dbddf6615be3",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 3",
"rules": [
{
"t": "set",
"p": "output",
"pt": "flow",
"to": "3",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 800,
"y": 180,
"wires": [
[]
]
},
{
"id": "48e26722ceaa4c76",
"type": "change",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 2",
"rules": [
{
"t": "set",
"p": "output",
"pt": "flow",
"to": "2",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 800,
"y": 140,
"wires": [
[]
]
},
{
"id": "db1c17b345970405",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 100,
"wires": [
[
"29828ab7ba234f16"
]
]
},
{
"id": "bd4acf9e43512799",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 140,
"wires": [
[
"c3c84d143a07bf6f"
]
]
},
{
"id": "ca1f4e892e31723e",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 4",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 220,
"wires": [
[
"c5e0edb28cd123a5"
]
]
},
{
"id": "52f41f684b96499d",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Input 3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 180,
"wires": [
[
"724fdc1f3e2d1447"
]
]
},
{
"id": "b9e0d73966231264",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 610,
"y": 140,
"wires": [
[
"48e26722ceaa4c76"
]
]
},
{
"id": "b1e4cbf4f4b3a3a5",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 610,
"y": 100,
"wires": [
[
"877df226d19fb3ec"
]
]
},
{
"id": "b3de3868921679aa",
"type": "inject",
"z": "371f296449d283a1",
"name": "TAKE",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 440,
"wires": [
[
"de7982691b07d045"
]
]
},
{
"id": "a10afd218a879eeb",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 610,
"y": 180,
"wires": [
[
"7b20dbddf6615be3"
]
]
},
{
"id": "7f77b04fc57f28e1",
"type": "inject",
"z": "371f296449d283a1",
"g": "7dfd0f04075f7d47",
"name": "Output 4",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 610,
"y": 220,
"wires": [
[
"dd62fcbcbcdab4fa"
]
]
},
{
"id": "0101dceb8a0e5912",
"type": "function",
"z": "371f296449d283a1",
"name": "bufferToString",
"func": "msg.payload = msg.payload.toString();\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 440,
"wires": [
[
"176186a4965de4a0"
]
]
},
{
"id": "176186a4965de4a0",
"type": "debug",
"z": "371f296449d283a1",
"name": "debug 108",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 440,
"wires": []
}
]