Thanks @ahaw021
I am still wrapping my mind around how to go from sensor/MQTT-->LoPy send via LoRa to a LoPy acting as a RAW LoRa Nano-Gateway/LoPy--> that then forwards the message over wifi on local network.
LoPy/LoRa Node --> LoPy/LoRa NanoGateway (recieves and forwards via WiFi)-->LoPy/WiFi NanoGateway --> local network.
I apologize that I have not been very clear in my posts. In the LoPy NanoGateway discussion
"The nodes send messages to the Nano-Gateway for further processing, this might include sending the messages over WiFi to a server for example."
I want to forward messages over WiFi. The MQTT example HERE uses WiFi to send client messages to the MQTT Broker.
Each LoRa/LoPy node needs to send the data to the NanoGateway, the NanoGateway needs to send it to the MQTT Broker.
I don't know if there is a simple programmatic way to assemble and send the messages/topics from the NanoGateway to the MQTT Broker. Ideally it would just publish topics/data based on the message payload from the LoPy node. However, this hard codes publishing topics in node code.
In the LoPy RAW NanoGateway example HERE the node code the message payload (Sensor Data Here) could include sensor data that the NanoGateway would publish the topic to the MQTT broker.
msg = "Sensor Data Here"
pkg = struct.pack(_LORA_PKG_FORMAT % len(msg), DEVICE_ID, len(msg), msg)
lora_sock.send(pkg)
It seems like this would work, but I would like the message payload to be inclusive like
msg = "client.publish("/sensors/sensor8/print(temp)")"
pkg = struct.pack(_LORA_PKG_FORMAT % len(msg), DEVICE_ID, len(msg), msg)
lora_sock.send(pkg)
I am not sure of a proper syntax to send in the message payload for parsing and forwarding. Perhaps just the topic e.g. /sensors/sensor8/temp, print(temp)
The NanoGateway would receive the message payload and publish the topic with something like:
client.publish("/sensors/sensor8/temp", "72.3")
This would hard code each LoRa/LoPy sensor node with its topics, which is not very flexible. And I think this is just on way, not sure how to forward a node subscribing back via LoRa from the NanoGateway.
Has anyone done anything like this?
Any feedback is appreciated.