mitchell
(Mitchell Stringer)
December 28, 2018, 4:38pm
1
if i try to use MQTT.Publish from dev tools / services i get Failed to call service mqtt/publish when using brackets.
{
"topic": "winthing/system/commands/open",
"payload": ["notepad.exe", "C:\\file.txt", "C:\\"]
}
Failed to call service mqtt/publish
This works, but i need to send the full string with arguments above
{
"topic": "winthing/system/commands/open",
"payload": "notepad.exe"
}
123
(Taras)
December 28, 2018, 5:16pm
2
Try this:
"payload": "['notepad.exe', 'C:\\file.txt', 'C:\\']"
This assumes you want to include the square brackets in the payload. If they aren’t required, just remove them from the example above but retain the double and single quotes as shown.
mitchell
(Mitchell Stringer)
December 28, 2018, 11:43pm
3
Thank you, but it doesn’t pass the text correctly, i get “invalid JSON” on the other side.
for now i set Node-red to listen for the topic, convert the payload and forward that to the host/server. that seems to be working well and very fast
123
(Taras)
December 29, 2018, 5:29am
4
In your first post, you overlooked to mention you were attempting to pass a JSON string. Indeed it is invalid and requires correction.