



Life is a journey, how far do we have to go!

This article provides a simple setup for a small smart home environment that can later be used for experiments or to reproduce certain issues. As a person from the south, my skin gets really dry in the capital, and since I haven’t published anything new in a year and a half, this is a good opportunity to resurrect my writing.
First, I will briefly introduce an IoT connection protocol that will be used:

The subscriber first subscribes to the relevant topics from the server. For example, if the subscription is for a humidifier, this humidifier will first subscribe to the humidity topic from the broker. When the sensor (publisher) collects humidity data, the publisher sends this topic and its content to the broker, which then transmits the data to every subscriber that has subscribed to that topic, which is the humidifier.
Let’s first discuss the QOS (Quality of Service) on this server, which provides three levels of service for different usage scenarios:
3: Exactly once, this service guarantees that the data packet is neither duplicated nor lost, suitable for billing systems. In such environments, when a message is sent, the broker will save the message’s ID and will persistently push the message to the subscriber. If the subscriber receives the message, it will send a PUBREL to the broker to clear the saved message’s ID.
Next, let’s talk about how to use wildcards to subscribe to multiple topics.
# : Matches >= 0 levels, e.g., a/# matches a/, a/b, a/b/c.
A standalone # matches all. a# and a/#/c are not allowed.


































