MQTT - An overview
Disclaimer
All the following information is not guaranteed. I try to research all information correctly and to summarize, but in the end I am only a person who, in his Makes leisure and wants to learn something
– If I made a mistake or just wrong have published information, then write a comment! – I will read this and if I can verify the information, my text with a hint of your comment ^
This blog is for everyone and should help anyone who learns something . That is why I also ask for a friendly one
Introduction
Within the last few years I have the MQTT protocol for many
my projects used. MQTT is very easy to use, relying on
usually existing TCP networks, offers security functions
and is a pure M2M (machine to machine) protocol.
MQTT running
until then always in some form in my smarthome and has me,
different from ZigBee, for example, never abandoned.
In short
is MQTT, in my opinion, one of the best protocols to be found in
can use home automation. The question is here – why
then almost nobody does it?
This contribution (and some more) will be accompanied by this question and continue to focus on the possibilities of MQTT in.
SPOILER: MQTT can do a lot, is one of the oldest M2M protocols (introduced in 1999) and has far not come out of fashion.
MQTT is a very large protocol, with many possibilities and Drop knitting. I will therefore always divide the posts and link to each other. Please bear in mind that I have this in my free time, so I won't get rhythm in the perfect weeks can post, but I will try a certain continuity to hold.
If you want to read the current specification, you can read this here find.
Main part
What is MQTT and how does it work?
Here we start again from the very front. MQTT is like
mentions an M2M (machine to machine) protocol, but what does that mean? –
Machine to machine communication only describes that the
Communication between two (or more) machines takes place.
Each
MQTT infrastructure consists of (one) broker and clients. Each client
subscribes to special topics that contain or receive information
can (more so later) Send clients (publish) and receive
Information about the broker.
Publish / Subscribe – What is this?
MQTT implements the so-called Publish and Subscribe Pattern. Here become information through a “publish”, in a defined topic by the broker “published”. Each of the Information (or basically the topic) Interested, this can be Subscribe to topic (Subscribe) and receive the message by the MQTT Broker ( offline devices can also do this message later received. More in one of the following posts).
The use of this infrastructure is as simple as ingenious.
Each device can basically open any topic. It is necessary to
only a few formal requirements are complied with. A topic can be found
Example that fold: “home/home room/temperature” – this
Topic could be used for example to get the current temperature in
to provide living room.
A thermometer would be in this case
post the topic (Publish). This information will be
processed (and possibly held). All clients at the temperature
the living room are “interessed”, for example the heating control
of living room, can subscribe to the topic (Subscribe) and get
always the current temperature in the living room. Here is to mention that
can send multiple devices to a topic and multiple devices to a topic
can subscribe. The node always forms the broker. This
forms an advantage: Clients do not have to know each other
or be on the same network. Any client who sends or receive
wants to achieve only the MQTT broker. The rest is
the broker.
Are there alternatives?
There are still so-called filter queries. These can be Content Based, depending on the content or types sent be. In these two types of communication, however, I will not or only on the edge, since these in Smarthome environments are rare and no one knows me at least in the private environment that uses this type of MQTT communication.
MQTT Secure – Is that possible?
Depending on which data run via the broker, these should be
(e.g. by encryption). This is also with MQTT
easily possible.
MQTT generally supports some
Security functions. Since MQTT works on L8, it is also
underlying technique used.
The layers underneath already provide security mechanisms which are very widely used (e.g. TLS).
MQTT
has the main purpose to be very fast and reliable.
Accordingly, the standard only defines what is required.
In addition, almost everything is about logic on the broker, so that basically every
Device can use an MQTT client.
MQTT offers from home
no transport encryption. This can be achieved by TLS on L5
,. Furthermore, TLS gives the possibility of clients by certificate
to authenticate to the server.
For example, lower security functions for inter-LAN communication form protocols such as IPSec.
MQTT
offers even an L8 Payload encryption, which the sent
Data encrypted. In addition, MQTT allows a user/password
Authentication. Furthermore X.509.
Last post
there is the possibility to assign permissions, so for example
only certain devices may subscribe to a topic.
MQTT Security is also a very big topic and is later treated with more deep:).
What can I use MQTT for?
MQTT is good at transmitting small messages. The focus is
at low latency. For this reason, MQTT can use all data
transport within a smart home that regularly sends
but not much memory required (for example sensor values
a thermometer, car, rain sensor or other). I use MQTT to
Example by every second mean current consumption to my
Homeassistant to send.
Apart from this, applications such as security are also possible, for example, to open doors or the like.
However, data such as videos can not be transmitted via MQTT... However, this is not the purpose of the protocol.
What will come now?
This article is intended as short as possible all important information
bundle. Accordingly, this contribution has been very superficial
without special depth, but shows the most important. Topics like Sessions
and QoS (Quality of Service) for example, I only mentioned by the way.
The
the following articles will each be an aspect of the MQTT protocol
treatment. In the end, I would like to have a series of blogs for the
current MQTT 5 standard forms a solid gateway, with all
relevant information. I would like you to
put technical depth on hand, so you can put your own
Build and use network.
In addition to examples from my network, I will introduce some software that can be used free of charge.
Conclusion
This post may not even apply to the extent of the MQTT
Report and should not. But I think you
now have a basic idea about the protocol and what it can do.
In
the next item, I will focus on different aspects of this
Enter Minutes to show how great MQTT for a Smarthome
can be used. However, I will also show disadvantages which
have no other means of communication, because MQTT has its own
Disadvantages (for example the broker himself).
Nevertheless, you know and understand this protocol when you are on the move in the Smarthome area.
Back…