I have two Raspberry Pis with a LoRa module each (Microchip RN2483, connected over serial). How do I tell MQTT (in Python) to use the LoRa motes (/dev/ttyAMC0) instead of Ethernet or Wi-Fi?
-
3To answer this I think you'll need to edit to specify which MQTT library you're using; including a minimal example of your code might also be helpful.– Aurora0001Mar 26, 2019 at 18:04
-
Also do you mean LoRA or LoRAWAN?– hardillbMar 26, 2019 at 20:19
1 Answer
The short answer to this is you don't with any of the standard libraries (especially not Paho or the old Mosquitto Python wrapper).
While MQTT doesn't require TCP it is best suited to being implemented on top of it and trying to use it over a serial port routed to LoRA radio will not be simple. It will require removing all the socket level code and replacing it with LoRA specific code and a LoRA addressing scheme to identify clients and the broker.
I suggest you look at the following 2 things that may suit your needs.
Firstly, look at the MQTT-SN spec, this is an even lighter weight protocol that is better suited to serial like communication.
Secondly, what might be easier is to look at how the Things Network works. This uses MQTT to pass messages to the correct LoRA gateway when then delivers the message to the correct client.