Hello,
Thanks for reading me.
I can send a message on a Mqtt topic, it works!
But NR leaves me an error and I don't like that.
Sending code:
msg.topic = "EffiCompteV2_485/Action";
msg.payload = "getModBus=010600110001:1:19200;";
console.log('MANO mqtt-->> ' + msg.topic + ' :=: ' + msg.payload);
return msg;
Error code:
MANO mqtt-->> EffiCompteV2_485/Action :=: getModBus=010600110001:1:19200;
26 Nov 15:06:08 - [error] [json:d97050094f96a565] Unexpected token 'g', "getModBus="... is not valid JSON
26 Nov 15:06:08 - [error] [json:d97050094f96a565] Unexpected number in JSON at position 1
Thanks for any help you can give me.
All code:
[
{
"id": "5e310c666522d99f",
"type": "mqtt out",
"z": "7b3ba7f3b90d2298",
"name": "Envoie Mosquitto",
"topic": "",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "0d3d3e77a1e17f01",
"x": 670,
"y": 220,
"wires": []
},
{
"id": "ef5f825532812ac7",
"type": "inject",
"z": "7b3ba7f3b90d2298",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "str",
"x": 150,
"y": 220,
"wires": [
[
"e2ebc0074c7f0543"
]
]
},
{
"id": "e2ebc0074c7f0543",
"type": "function",
"z": "7b3ba7f3b90d2298",
"name": "Boucle Tab_Action",
"func": "msg.topic = \"EffiCompteV2_485/Action\";\nmsg.payload = \"getModBus=010600110001:1:19200;\";\nconsole.log('MANO mqtt-->> ' + msg.topic + ' :=: ' + msg.payload);\nreturn msg;\n\n\n\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 390,
"y": 220,
"wires": [
[
"5e310c666522d99f"
]
]
},
{
"id": "0d3d3e77a1e17f01",
"type": "mqtt-broker",
"name": "Local",
"broker": "192.168.1.60",
"port": "1884",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]