Pub/Sub Communication in IoT: MQTT and Zigbee

About deploying SmartHome with HomeAssistant

Project info


Others

2024/11/11

Introduction

A brief project description or quote to summarize its goals.

“Basic setup including HA integration with broker and devices ”
— Arek

Explore the Project

Tips

Tech details - Go to general technical info about components (on this page)


About

Introduction
A few months ago, I participated in the Java User Group Day in Thorn (May 2024), where Mariusz Strzelecki delivered an inspiring talk on IoT and smart home technologies. This encouraged me to set up my own Home Assistant server as a personal IoT lab project.

Many of the devices in my setup utilize the Zigbee protocol and the lightweight MQTT publish/subscribe protocol. Zigbee is an energy-efficient protocol specifically designed for IoT sensors. Its smaller packet sizes, low power consumption, and mesh network topology make it an excellent choice for IoT, surpassing WiFi in these aspects.

On the other hand, MQTT follows the publish-subscribe (pub/sub) pattern, which facilitates loose coupling in the system. This architecture allows components to work independently, simplifies maintenance, and provides a standardized communication protocol. The MQTT broker manages topics, enabling sensors to publish data to specific topics while multiple clients can subscribe to them. Importantly, publishers and subscribers remain decoupled, unaware of each other's existence.

This approach resembles the classic Observer design pattern, but MQTT operates at the network level, enabling communication between numerous devices, not just within a single JVM. It reminds me of the deprecated Guava Event Bus library but scaled for distributed IoT environments. Furthermore, MQTT supports topic hierarchies and Quality of Service (QoS) levels, ensuring reliable message delivery even in unstable network conditions.

This project serves as an personal project for integrating IoT technologies, aiming to demonstrate the synergy between Zigbee and MQTT in a smart home environment.

Project Overview

In General

Components

Quick Summary

  1. HomeAssistant + MQTT Server
  2. Infrastructure and Networking

List of All Technologies

Grouped by Category

Category Technologies
SoftwareHomeAssistant
ContainerizationDocker, Docker Compose
OSRaspbian
Web ServerNGINX as a Reverse Proxy
SSLCertbot + Let's Encrypt for automatic SSL
Monitoring & ObservabilityNetData
Local DNS & DHCPPiHole/Unbound + DNS over HTTPs
Static Site GeneratorEleventy (11ty) for generating a static homepage

Components Specification

Detailed Information Grouped by Components

Table of Contents:

  1. HomeAssistant + MQTT Server
  2. Infrastructure and Networking

Details
  1. HomeAssistant + MQTT Server

    Use Cases
    • SmartHome: Setup MQQT broker with HomeAssistant and devices.
    • SmartHome: Setup automatization based on published events
    Tech Stack
    Category Description
    Software HomeAssistant
    Containerization Docker, Docker Compose
    OS Raspbian
  2. Infrastructure and Networking

    Managing network and server infrastructure using NGINX and local DNS.
    Use Case
    • Network Routing: Handling subdomains and securing HTTP/S traffic
    • SSL/TLS Management: Ensuring secure connections with SSL certificates
    Tech Stack
    Category Description
    Web Server NGINX as a Reverse Proxy
    SSL Certbot + Let's Encrypt for automatic SSL
    Monitoring & Observability NetData
    Local DNS & DHCP PiHole/Unbound + DNS over HTTPs
    Static Site Generator Eleventy (11ty) for generating a static homepage

Additional Information

  • Domain: IoT
  • Status: in_progress
  • Keywords: Design IoT Docker HomeAssistant MQTT Zigbee

Thumbnail

HomeAssistant screenshot