Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Hands-On MQTT Programming with Python
  • Table Of Contents Toc
  • Feedback & Rating feedback
Hands-On MQTT Programming with Python

Hands-On MQTT Programming with Python

By : Gaston C. Hillar
2.3 (3)
close
close
Hands-On MQTT Programming with Python

Hands-On MQTT Programming with Python

2.3 (3)
By: Gaston C. Hillar

Overview of this book

<p>MQTT is a lightweight messaging protocol for small sensors and mobile devices. This book explores the features of the latest versions of MQTT for IoT and M2M communications, how to use them with Python 3, and allow you to interact with sensors and actuators using Python.</p> <p>The book begins with the specific vocabulary of MQTT and its working modes, followed by installing a Mosquitto MQTT broker. You will use different utilities and diagrams to understand the most important concepts related to MQTT. You will learn to make all the necessary configuration to work with digital certificates for encrypting all data sent between the MQTT clients and the server. You will also work with the different Quality of Service levels and later analyze and compare their overheads.</p> <p>You will write Python 3.x code to control a vehicle with MQTT messages delivered through encrypted connections (TLS 1.2), and learn how leverage your knowledge of the MQTT protocol to build a solution based on requirements. Towards the end, you will write Python code to use the PubNub cloud-based real-time MQTT provider to monitor a surfing competition.</p> <p>In the end, you will have a solution that was built from scratch by analyzing the requirements and then write Python code that will run on water-proof IoT boards connected to multiple sensors in surfboards.</p>
Table of Contents (9 chapters)
close
close

What this book covers

Chapter 1, Installing an MQTT 3.1.1 Mosquitto Server, starts our journey toward the usage of the preferred IoT publish-subscribe lightweight messaging protocol in diverse IoT solutions, combined with mobile apps and web applications. We will learn how MQTT and its lightweight messaging system work. We will understand the MQTT puzzle: clients, servers (formerly known as brokers), and connections. We will learn the procedures to install an MQTT 3.1.1 Mosquitto server in Linux, macOS, and Windows. We will learn special considerations for running a Mosquitto server on the Cloud (Azure, AWS, and other cloud providers).

Chapter 2, Using Command-Line and GUI Tools to Learn How MQTT Works, teaches us to work with command-line and GUI tools to learn how MQTT works in detail. We will learn MQTT basics, the specific vocabulary for MQTT, and its working modes. We will use different utilities and diagrams to understand the most important concepts related to MQTT. We will understand everything we need to know before writing Python code to work with the MQTT protocol. We will work with the different Quality of Service levels, and we will analyze and compare their overheads.

Chapter 3, Securing an MQTT 3.1.1 Mosquitto Server, focuses on how to secure an MQTT 3.1.1 Mosquitto server. We will make all the necessary configurations to work with digital certificates to encrypt all the data sent between the MQTT clients and the server. We will use TLS, and we will learn to work with client certificates for each MQTT client. We will also learn to force the desired TLS protocol version.

Chapter 4, Writing Code to Control a Vehicle with Python and MQTT Messages, focuses on writing Python 3.x code to control a vehicle with MQTT messages delivered through encrypted connections (TLS 1.2). We will write code that will be able to run on different popular IoT platforms, such as a Raspberry Pi 3 board. We will understand how we can leverage our knowledge of the MQTT protocol to build a solution based on requirements. We will learn to work with the latest version of the Eclipse Paho MQTT Python client library.

Chapter 5, Testing and Improving Our Vehicle Control Solution in Python, outlines using our vehicle control solution with MQTT messages and Python code. We will learn how to process commands received in MQTT messages with Python code. We will write Python code to compose and send MQTT messages with commands. We will work with the blocking and threaded network loops, and we will understand the difference between them. Finally, we will take advantage of the last will and testament feature.

Chapter 6, Monitoring a Surfing Competition with Cloud-Based Real-Time MQTT Providers and Python, gets you started with writing Python code to use the PubNub cloud-based, real-time MQTT provider in combination with a Mosquitto MQTT server to monitor a surfing competition. We will build a solution from scratch by analyzing the requirements, and we will write Python code that will run on waterproof IoT boards connected to multiple sensors in surfboards. We will define the topics and commands, and we will work with a cloud-based MQTT server, in combination with the Mosquitto MQTT server used in the previous chapters.

Appendix, Solutions, the right answers for the Test Your Knowledge sections of each chapter are included in the appendix.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY