Working with last will and testament with Python

Now, we will check what happens if the MQTT client that represents our vehicle remote control application disconnects unexpectedly from the MQTT server with the code we have written so far. Pay attention to all the steps because we will manually interrupt the execution of the vehicle remote control program to understand a specific problem that we will solve by taking advantage of the last will and testament feature.

Execute the following line to start the vehicle remote control example on any computer or device that you want to use as the MQTT client and uses Linux or macOS:

    python3 vehicle_mqtt_remote_control.py

In Windows, you must execute the following line:

    python vehicle_mqtt_remote_control.py ...

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.