These instructions guide you through the steps to publish data from an Intel® IoT Gateway to an MQTT broker (server) using a Python* Script.
Applicable to These Intel® IoT Gateway Products
In this section, you will set up your Development Computer to subscribe to an MQTT message test topic on an independent MQTT message broker. After your Development Computer has subscribed to a topic, messages published to the topic are sent to the Development Computer.
To setup your Development Computer you must:
To setup your Gateway, you must:
With your Development Computer and Gateway configured for MQTT and your MQTT broker set up, you are ready to create and run a Python script to publish MQTT messages.
These steps use Paho Python examples to create an initial script that you can later modify to meet your needs. Create the Python script either directly on your Gateway or on your Development Computer. If you create the script on your Development Computer, copy it to your Gateway to run it.
Congratulations! Using the Python programming language, you sent an MQTT message (Hello) from the Gateway, through the topic (mytopic) on the MQTT broker (localhost), and then to a Development Computer that subscribed to that MQTT topic. (mytopic)
Consider the following ideas to enhance the use of MQTT messages in your environment:
By using this document, in addition to any agreements you have with Intel, you accept the terms set forth below.
- Seite 1