So far, we have been publishing MQTT messages to control the vehicle with GUI and command-line tools. Now, we will write code in Python to publish the commands to control each vehicle and check the results of the execution of these commands. Of course, GUI utilities, such as MQTT.fx and the Mosquitto command-line utilities, are extremely useful. However, after we know that things are working as we expect, we can write the necessary code to perform tests in the same programming language we are using to run the code on the IoT board.
Now, we are going to code a Python client that will publish messages to the vehicles/vehiclepi01/commands topic and will subscribe to the vehicles/vehiclepi01/executedcommands topic. We will code both a publisher and a subscriber. This way, we will be able to design applications that can talk to IoT devices with MQTT messages...