Introduction

Like many of us, we started to have several devices to control different smart systems in our homes: lights, robot vacuum cleaners, TVs, and more.

Each device operates with its own system and app, making things a bit disjointed. But what if we could connect everything into one seamless system?

Welcome to home automation with Home assistant

iot

Demo here, https://demo.home-assistant.io/#/lovelace/home

Connectivity

Many devices could be connected to our system (being the core a server, raspberry pi like) and, nowadays, not only the Wi-Fi, ZigBee and Bluetooth ones, also using the new protocols, Matter and Thread.

iot

Image from leonardocavagnis

In my case, I am interesting in connecting the different devices I have at home, plus some devices I had to buy in order to test all the possibilities of the system.

Wi-Fi

  • Matter devices as the IKEA Dirigera Controller, with some devices such as lights, door sensor and smart plugs. All IKEA sensors are ZigBee but with the Dirigera, it will be controlled by WiFi
  • Smart TV (Samsung TV)
  • MQTT devices with ESP32/ESP8266 connecting sensors or relays
  • MQTT devices with RPi

ZigBee

  • Sensors (Temperature and Humidity Sensors, devices on the market)
  • Eventually, the IKEA devices without Dirigera

Bluetooth / BLE / Matter

  • BLE devices (IoT with nrf52840 or nrf54L15) to connect sensors
  • Matter devices (IoT with Arduino Nano Matter) to connect sensors

Radio

  • 433MHz modules could be use as the cheapest option to connnect sensors

Home Assistant (HA)

iot All pretty straight forward to install the HA in the raspberry pi (In my case Rpi3), on the official documentation

The assistant will probably already find some devices that can be added to the network, and you can spend a good couple of hours clicking through all the possible possibilities without watching any tutorials.

IKEA Dirigera

iot

  1. Follow the instructions to enmable the Matter feature on the device, https://www.matteralpha.com/how-to/how-to-use-the-ikea-dirigera-with-matter
  2. Settings > Devices > Add Integration, we could add a Matter device
  3. After that, you will see HA has found directly a Matter Device, the IKEA Hub, with all the devices already associated to this device, so you can control them directly iot

Zigbee sensors

iot

  1. Buy an additional board, a Zigbee to USB (Like the Sonoff one, or the official from HA, connectzbt1)
  2. The HA detects the new device and added as Zigbee Home Automation integration iot
  3. You can now add all the devices/sensors that use Zigbee to communicate.

I have two kind of sensors using Zigbee at this moment:

  • Indoor temperature/humidity sensors Sonoff
  • Outdoor temperature/humidity sensors Comboss

MQTT devices with ESP8266 / ESP32

iot

Now the fun / most custom IoT part: Developing our own sensors. In the rpi, we can install a MQTT broker (With the help of HA) and our Wifi systems MQTT client could communicate and be part of the HA whole system.

Two kind of programming our ESP devices

  • The easiest way, with ESPHome
  • Programming an MQTT client from zero, with Arduino IDE, VSCode or ESP SDK

MQTT Client with ESP8266

For this second option, there are several guides we could follow:

MQTT Broker with mosquitto

Anyway, in order to use a MQTT device on the HA, we have to install a MQTT Broker on the rpi:

Mosquito MQTT Broker

iot

MQTT integration:

iot

We could test our mqtt broker on the MQTT settings (Publish and listen),

iot

Configuration in HA (yaml file)

And finally, a special configuration to get the parameters from these MQTT devices and process them as sensors,

iot

Final result

Temperature measurement coming from a ESP device (With one or several sensors connected to it) using MQTT protocol over WiFi

iot

Wrap-up and Ideas for Enhancement

  • In this post, we configure Home Assistent and basic configuration, covering from standard IoT devices such as the IKEA devices, or ZigBee devices, and also own devices with ESP & MQTT.
  • For the next project,
    • Use ESPHome, instead of developing MQTT device from zero
    • We could finish the implementation of a MQTT device with ESP32/ESP8266 with real sensors and battery powered
    • Work on Bluetooth Low Energy with nRF and seeing the capabilitiies to connect to our system
    • Using directly Matter protocol with Arduino Nano Matter