As discussed by mail, but still i put it here if useful for other people, here is a quick sample code that would do the job :
[
{
"id": "0eae815a5e3cac4a",
"type": "inject",
"z": "869e1fa67fd8309e",
"name": "Channel 1 ON",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "0",
"topic": "/yamahatest",
"payload": "1",
"payloadType": "num",
"x": 350,
"y": 220,
"wires": [
[
"1c8f9e9b4b1f757f"
]
]
},
{
"id": "1c8f9e9b4b1f757f",
"type": "function",
"z": "869e1fa67fd8309e",
"name": "assign integer Type",
"func": "\nlet vsmMessage = msg.payload;\nlet yamahaMessage = {};\n\n// Do stuff only if msg is integer\nif (Number.isInteger(vsmMessage)) {\n\n yamahaMessage = {\n \"type\": \"i\",\n \"value\": vsmMessage\n }\n msg.payload = yamahaMessage\n}\n// Otherwise pass msg.payload without modification\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 300,
"wires": [
[
"ce830894e9682cca",
"499f50c39198a0d6"
]
]
},
{
"id": "ce830894e9682cca",
"type": "osc",
"z": "869e1fa67fd8309e",
"name": "",
"path": "",
"metadata": false,
"x": 850,
"y": 300,
"wires": [
[
"9ea7ea73eef103cf"
]
]
},
{
"id": "b6eaf74c496a3003",
"type": "inject",
"z": "869e1fa67fd8309e",
"name": "Channel 1 OFF",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "0",
"topic": "/yamahatest",
"payload": "0",
"payloadType": "num",
"x": 360,
"y": 280,
"wires": [
[
"1c8f9e9b4b1f757f"
]
]
},
{
"id": "bcc78b2f39b292ce",
"type": "inject",
"z": "869e1fa67fd8309e",
"name": "test Float",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "0",
"topic": "/yamahatest",
"payload": "1.25",
"payloadType": "num",
"x": 340,
"y": 320,
"wires": [
[
"1c8f9e9b4b1f757f"
]
]
},
{
"id": "107f216a17959ddd",
"type": "inject",
"z": "869e1fa67fd8309e",
"name": "test String",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "0",
"topic": "/yamahatest",
"payload": "HelloWorld",
"payloadType": "str",
"x": 340,
"y": 360,
"wires": [
[
"1c8f9e9b4b1f757f"
]
]
},
{
"id": "9ea7ea73eef103cf",
"type": "udp out",
"z": "869e1fa67fd8309e",
"name": "",
"addr": "127.0.0.1",
"iface": "",
"port": "3345",
"ipv": "udp4",
"outport": "",
"base64": false,
"multicast": "false",
"x": 1040,
"y": 300,
"wires": []
},
{
"id": "499f50c39198a0d6",
"type": "debug",
"z": "869e1fa67fd8309e",
"name": "check Payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 340,
"wires": []
}
]