Digi XBee 3 Cellular LTE-M User Manual page 79

Smart modem
Table of Contents

Advertisement

Examples: IOT protocols with transparent mode
The thread that reads the serial port forwards any data received onward to the client socket, and the
thread reading the client socket forwards any data received onward to the serial port. This is
represented in the figure above.
The proxy script needs to be running before running an MQTT publish or subscribe script.
1. With the proxy script running, run the subscribe example from
(subscribe) with
1883, 60) to client.connect("127.0.0.1", port=17300, keepalive=20). This connects the
MQTT client to the proxy script, which in turn connects to a broker via the XBee Smart
Modem's internet connection.
2. Run the publish example from
instance (while the publish script is running you will have three Python scripts running at the
same time).
The publish script runs over your computer's normal Internet connection, and does not use the XBee
Smart Modem. You are able to see your published message appear in the subscribe script's output
once it is received from the broker via the XBee Smart Modem. If you watch the output of the proxy
script during this process you can see the receptions and transmissions taking place.
The proxy script must be running before you run the subscribe and publish scripts. If you stop the
subscribe script, the socket closes, and the proxy script shows an error. If you try to start the proxy
script after starting the subscribe script, you may also see a socket error. To avoid these errors, it is
best to start the scripts in the correct order: proxy, then subscribe, then publish.
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
MQTT, but change the connect line from client.connect("m2m.eclipse.org",
Example: send messages (publish) with MQTT
Get started with MQTT
Example: receive messages
in a third Python
79

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee 3 cellular nb-iot

Table of Contents