I would like to publish data to an MQTT broker on my LAN, from a Xenon device. I’m trying to get my head around the networking topology of Mesh to figure out how to do that. My Xenon and Argon are up and running, and I can publish to the Particle Console. However, I can’t seem to publish directly to an address on my network. Does anyone have any examples of doing this?
You can’t, directly.
The mesh network (between the Xenon and Argon) is Thread Mesh, which is 6LoWPAN over 802.15.4. The mesh network is an IP network, but it’s isolated, separate from your Wi-Fi network.
The Argon is a gateway between the mesh network and the Particle cloud. It’s not a generic router between the isolated Thread Mesh IPv6 network and your Wi-Fi network, so you can’t make direct TCP or UDP connections between the two.
Also, Thread Mesh doesn’t support TCP, so you couldn’t directly do connection from a Xenon to a TCP-based MQTT server, even if the Argon was an IP router (which it’s not).
In your case, what you’d do it send data from your Xenon to your Argon, either by Mesh.publish and Mesh.subscribe or by direct UDP, and then your Argon would be the MQTT client, uploading requests from all Xenon devices in your mesh to the MQTT server by TCP.
@rickkas7 This is disappointing but I appreciate the clarity in which you explain it. I’m looking to do something similar and was hoping to use an Argon as a simple MQTT gateway.
@Wedgie , what are you trying to accomplish? Maybe we can brainstorm a good workaround. I’m planning on setting the Argon gateway up to parse the messages that arrive via MQTT and via mesh. I am setting up sensors and lights to work with openHAB.
I have a minimal mesh network setup with one Argon and one Xenon. The Argon is programmed as an MQTT client that is connected to an MQTT broker on my LAN. The Xenon is programmed with a simple program to toggle the RGB LED via mesh messages and to send out periodic mesh status messages. The Argon is functioning as a gateway and is parsing the MQTT and mesh messages.
Sounds very similar to what I’ll do. If you’re willing it might be nice to look at your code.