Smart Homes and MQTT

Because the HTTP protocol is most common protocol on the Internet it has become the main protocol for controlling first generation smart home devices.

However HTTP is not the main protocol for IOT (Internet of things) devices.

The choice here is MQTT (MQ Telemetry Transport ) and this will also most likely become the main control protocol for home automation.



Many second generation smart home devices will be bi-lingual in that they will support both protocols.

Using MQTT on a Home Network

MQTT is a very simple and fast messaging protocol that uses the publish and subscribe model.

This model relies on a central broker that is used to exchange messages as shown in the diagram below.

MQTT- Publish-Subscribe-Model
This model is very similar to the radio/TV broadcasting model.

In this model a publisher publishes on a topic (radio =channel) and a subscriber simply subscribes to that topic to receive the messages.

You can learn more about MQTT on my other site See- How MQTT Works.

MQTT Brokers or Servers

Although there are cloud based test and commercial brokers available See MQTT Brokers/Servers and Cloud Hosting Guide the best choice for a home network is a locally installed broker.

The most popular one is mosquitto and is the one I use and will use in the tutorials on this site.

You can install Mosquitto on Linux and Windows and also on the Raspberry Pi.

MQTT Clients

There are clients for almost all programming languages.

Node-red as an MQTT publish and subscribe node built in and on this site I will concentrate on using this client.

Here is a detailed tutorial on Using the Publish and Subscribe nodes on node-red.

I also did a video here

I cover the Python client in detail on my other site here.

Important MQTT Properties

  • There is no direct connection between subscriber and publisher.
  • MQTT is a 1 to many protocol by default
  • MQTT supports QOS levels to guarantee message delivery.
  • MQTT can use SSL for security
  • MQTT can be used in a web browser Using MQTT over Websockets.
  • Any message restrictions are set on the MQTT broker.
  • MQTT brokers don’t normally store Messages.

Related Tutorials and Resources:

 

Please Let me Know if you found it Useful
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>