What is the correct way to send to mesh from mqtt now?

Since pull req 3141 (docs:951), the established way to send to the mesh doesn’t work unless the channel is named “mqtt”. Obviously I don’t want to rename my private channels to “mqtt” (and I use more than one, so there’s a naming conflict). What is the correct way for an integration (in say node red) to send a message to a channel?

Note that this only holds if you’re using JSON. If you’re using protobufs, nothing has changed.
If using JSON, just add a new channel called “mqtt” and publish the JSON message as described here to that topic. You can optionally add a field “channel” with an index (0-7) to instruct the node which channel to use.

Oh, so it’ll still honour the channel index in the JSON and the “mqtt” channel is just a permission mechanism?

Correct, it has to be published to the “mqtt” channel, but you can still instruct it to send it out anywhere.

I still do not get it. Please help.

  1. I have device connected over WiFi.
  2. two channels are configure, one primary “HANAX” and one secondary “mqtt”. Both have uplink and downlink enabled (Is this necessary for both?)
  3. When I send message from device, I can see mqtt in node-red from primary channel on the topic “msh/EU_868/2/json/HANAX/!75f184e4”. Great, this works. Also, I can see telemetry messages.

Now to send text to mesh:

I send message to topic “msh/EU_868/2/json/mqtt”. The message is:

{
    "from": 1978762468,
    "type": "sendtext",
    "channel": 0,
    "payload": "TEST!!"
}

but nothing happens :frowning: What is the problem?

Edit: After more trials I resolved it.
I found out that I need to use node number “msh/EU_868/2/json/mqtt/!75f184e4” in the topic. Maybe more concrete wording in the documentation will be useful.

The node number shouldn’t be needed. Not sure what changed, but it should also work like you tried previously.

Yes, it is not so flexible, but since I have no plan to change the node, I do not mind that it is “hard wired”. At least it works.

Regarding uplink and downlink status of botch channels, now I have uplink on primary and downlink on mqtt. It works, but I wonder if it was meant to have it set up that way.

You could try sending to msh/EU_868/2/json/mqtt/ now once more, it should work.

Yes, downlink should be on on the channel “mqtt” to be able to instruct a node to send something out. If you want that to uplink to MQTT, you also have to enable that on the primary, yes.

Yes, you are right. It’s working, the ending “/” was missing. Great! Thanks.