The Messaging Queuing Telemetry Transport (MQTT) protocol is a publish/subscribe messaging protocol that works on top of your home TCP/IP network. It provides a fast and reliable way to connect your IoT devices together and create responses to messages.
Every MQTT network needs a broker. The broker is the heart of the MQTT network and is just a server that receives information from devices, also known as clients, and distributes that information to other clients based on the topic.
Topics are arranged in a directory-like structure. A topic might be “LivingRoom,” or “LivingRoom/Light” if you have multiple clients within that parent topic. The subscriber client will listen for incoming messages from the subscribed topic and react to what was published, such as “on” or “off.” Clients can subscribe to one topic and publish to another as well. If the client subscribes to “LivingRoom/Light,” it might also want to publish to another topic like “LivingRoom/Light/State,” so that other clients can monitor the state of that light.
With home automation services like Home Assistant that can run on a Raspberry Pi, you can easily integrate your own MQTT clients with your commercial IoT devices to create additional temperature nodes for your smart thermostat, or maybe just a basic remote switch to control the lights in your house without having to get up, for maximum laziness.
To see how to do that, stay tuned for a new tutorial dedicated to Home Assistant. In the meantime however, if you’d like to learn more about MQTT and how to get started using just a Raspberry Pi and ESP32 Thing, check out the new tutorial below.