Mqtt for a 3year old

Can some please explain mqtt like you are talking to a 3 year old kid.

What will i need to set it up? any more device then HA?
What is the Home assistant connect? it that mqtt?
What it zigbeemgtt2?

I feel kind of stuid but i dont understand this, I think i am mix all this up

  1. You need an MQTT broker, such as Mosquitto
  2. Yes, the mqtt integration connects HA to your MQTT broker
  3. Zigbee2MQTT is a way of bridging Zigbee devices to MQTT, and from there to Home Assistant or other software

If all you’re looking to do is to use Zigbee devices then ZHA is a native integration that’s easier to get set up.

This is one of many explanations of what MQTT is and why you may use it.

1 Like

ELI3: I buy a car from you via an online website. We agree to use a broker. I give the money to the broker and you give the car to them. They do the necessary checks and complete the exchange.

ELI10+: MQTT is a protocol — a way of communicating between different pieces of software (services). HTTP, on which the internet is built, is also a protocol.

MQTT is a pub-sub (publish-subscription) protocol, whereas HTTP is a client-server protocol. The browser is your client and the server is where you are connecting to. Pub-sub means there are publishers (producers) of information and subscribers (consumers) of information. To keep things nicely separated, you publish and subscribe to topics (like queues). A topic looks like a path: a kind of hierarchy to organise and group things, e.g. /living_room/light/status.

In principle, you can have multiple publishers and subscribers to one topic, but usually you only have one publisher and one or more subscribers. If you strictly have only one at either end, it’s basically a queue.

The thing in the middle is called a broker. Mosquitto is such a piece of software. The broker will handle the marshalling of messages. MQTT brokers can only keep one message per topic at a time, which means, given my queue analogy from before, that it’s a queue of one. The broker can also handle whether the last value must be retained and what must happen when a client unexpectedly disconnects (LWT or last will and testament). Note that in this world, the publishers and subscribers are both clients connecting to a server (the broker). QoS or quality of service refers to with what guarantee a message must be delivered.

This pub-sub pattern is useful for asynchronous applications, i.e. where you don’t want to wait for the receiver of your message to respond before you proceed. It also means the receiver can process at their own leisure.

Using a standard protocol such as MQTT (just like for HTTP) means anybody in the world can implement the specification and have interoperability, regardless of other tech choices.

https://www.hivemq.com/mqtt/mqtt-protocol/

I forgot to add the HA bits: Thus, the MQTT integration is a client that can publish or subscribe to messages. The Mosquitto add-on (if you use add-ons) is the broker. Any device (e.g. a light) that connects to the broker is also a client.

5 Likes

okej…

so if i have a Home Assistant SkyConnect in my HA setup, i dont need to use Zigbeemgtt2?
or what will i eran to use Zigbeemgtt2

is it just that have it all on the same “network mqtt”?

sorry for stupid questions

I’m treading carefully here, since I don’t use Zigbee or SkyConnect.

Do you have a SkyConnect dongle for your HA? Looks like you can then just integrate it directly.

Why do you think you need Zigbee2MQTT? Did someone suggest it to you?

Zigbee is its own standard and protocol, so it would translate Zigbee to MQTT, which seems unnecessary in the light of the above.

You can (and should) use the SkyConnect with ZHA, not Zigbee2MQTT.

That’s simpler for you to set up, and doesn’t require anything to do with MQTT so one less thing to learn.