ERDC
April 4, 2024, 9:20pm
1
I am trying to use this format from a command line on Linux to to see if I can receive a text on my Meshtastic device:
mosquitto_pub -h 192.168.1.52 -t ‘msh/2/e/!da638728’ -m ‘{“channel”:“0”,“sender”:“MeAtMyPC”,“type”:“sendtext”,“payload”:{“text” “mqtt-test”}}’
I see the MQTT message appear in the mosquitto_sub terminal but no notifications on my ANDROID App.
Any suggestion would be grateful.
GUVWAF
April 6, 2024, 6:40am
2
See the documentation.
It has to be sent to a channel called “mqtt”, you need a field “from” with the node number and the payload should be just a string with the text.
ERDC
April 6, 2024, 5:13pm
3
I read that documentation but it doers not show an example of a basic command line for publishing a MQTT message which I am looking for
GUVWAF
April 6, 2024, 6:02pm
4
It doesn’t matter how you publish to the topic, I think your command would work but then it should be something like:
mosquitto_pub -h 192.168.1.52 -t ‘msh/2/json/mqtt’ -m ‘{"from": 3663955752, “channel”: 0, “type”: “sendtext”, “payload”: “mqtt-test”}’
This is if your root topic is just msh/
. I would recommend checking with MQTT Explorer .
ERDC
April 6, 2024, 8:32pm
5
Thanks GUVWAF for your input, but where/how do I specifically send a text to a unique Meshtastic device? I see the “from” but not a “to”. Is it inserted into the message field or in into the topic field? And if so, how?
GUVWAF
April 6, 2024, 8:40pm
6
Add a field “to” in the message with the node number to send to. This is also in the link I shared.
ERDC
April 8, 2024, 12:08am
7
I have added the following
“to”; “!da638728”
but i still see no text being delivered to my device.
Again, I have read that document BUT the topic that I have posted is as follows:
"What is the basic mosquitto_pub command to send text to your Mestastic unit?
Nothing more, nothing less. Could you do this for your own device and once it works, post that here please?
GUVWAF
April 8, 2024, 6:19am
8
First, the documentation says the to
needs to the node number, so e.g. 3663955752.
However, it also says this feature is to instruct a node to send out a message. So you don’t directly send a message from your computer to a node, but you instruct a node (the from
field) to send a message to another node (the to
field) or to a channel.
I don’t use mosquitto_pub
, but I’ve used MQTT Explorer to do this.
ERDC
April 8, 2024, 4:41pm
9
OK then could you send me a known good MQTT syntax line that does work in MQTT Explorer, and I will reverse engineer it from there.
Thank you for your support, for it is greatly appreciated.
GUVWAF
April 9, 2024, 7:03am
10
{
"from": 841446079,
"channel": 0,
"type": "sendtext",
"payload": "test"
}
Or to a certain node:
{
"from": 841446079,
"to": 2711401735,
"type": "sendtext",
"payload": "test"
}
You have to replace the “from” and “to” with your node numbers and publish it to the json/mqtt
topic with your root topic, e.g. msh/2/json/mqtt
.
tanner
April 19, 2024, 1:46am
11
I was able to do it here:
It worked! Thanks. This was the command I used:
mosquitto_pub -d -h 10.55.0.106 -t 'msh/US/2/json/mqtt' -m '{"channel":0,"from":4200208616,"payload":"test2 from CLI","to":1976953804,"type":"sendtext"}'
[image]