Defining the topics and commands

We will use the following topic name to publish the commands for a vehicle: vehicles/vehiclename/commands, where vehiclename must be replaced with a unique name assigned to a vehicle. For example, if we assign vehiclepi01 as the name for a vehicle that is powered by a Raspberry Pi 3 Model B+ board, we will have to publish commands to the vehicles/vehiclepi01/commands topic. The Python code that runs on this board will subscribe to this topic to receive messages with commands and react to them.

We will use the following topic name to make the vehicles publish details about the successfully executed commands: vehicles/vehiclename/executedcommands, where vehiclename must be replaced with a unique name assigned ...

Get Hands-On MQTT Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.