/ #zigbee2mqtt #aqara 

Zigbee2mqtt : Aqara temperature - Homeassistant without Xiaomi Gateway? Here is how !

If you are reading this article, you have already heard about zigbee. But also, maybe you don’t understand it, comparing to wifi or bluetooth. And maybe, you are looking for a cheap solution to connect to your smart devices using the protocol zigbee.

I have done a bunch of tests and will share with you how to connect and read your data through zigbee using CC2531 usb dongle and home assistant.

How it works

We will use Home assisant as our smart home hub. Then, We will connect home assistant to an MQTT broker. We will configure Zigbee2mqtt to send the data to the same MQTT broker. At the end, the zigbee2mqtt will connect to the zigbee devices using cc2531 dongle and will collect the data and send commands.

Requirements

Warning: CC2531 should be flashed already with the firmware CC2531ZNP-Prod.

Aliexpress
Aqara temperature sensorAqara temperature sensor
Sonoff CC2531 USB dongleSonoff CC2531 USB dongle
Orange pi to deploy HomeAssistantOrange pi

Start an MQTT server

Run an MQTT broker. I have chosen emqx for testing purpose, but you can use whatever you want.

version: "3"

services:
  emqx1:
    image: emqx/emqx:latest
    restart: unless-stopped
    ports:
      - 18083:18083
      - 1883:1883
$ docker-compose up -d

Zigbee2mqtt

Start by plugging the cc2531 dongle to the orange pi. Check that the usb is well plugged.

$ ls /dev/serial/by-id/
usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B001CCBE82B-if00

Now that we know the path of the dongle, let’s start zigbee2mqtt and bind it to the dongle.

version: "3.8"
services:
  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      - ./data:/app/data
      - /run/udev:/run/udev:ro
    group_add:
      - dialout
    user: 1000:1000
    ports:
      # Frontend port
      - 8080:8080
    environment:
      - TZ=Europe/Paris
    devices:
      # Make sure this matched your adapter location
      - /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B001CCBE82B-if00:/dev/ttyACM0

In ./data/configuration.yaml, add the following configuration:

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://YOUR.IP.ADDRESS.HERE
  keepalive: 60
  reject_unauthorized: true
serial:
  port: /dev/ttyACM0
frontend: true
homeassistant: true

At this time, run the zigbee2mqtt using docker-compose up -d.

you can check that zigbee2mqtt is running by going to http://orangepiadress:8080

Connect zigbee2mqtt to home assistant

Now that we have created and connected zigbee2mqtt to the mqtt broker, The only thing missing is the connection between zigbee2mqtt <-> home assistant.

Go to homeassistant:

  • On the left menu, Settings
  • Devices & services
  • Add integration
  • Mqtt

Mqtt configuration:

  • Add the mqtt broker address
  • Verify that home assistant shows no errors

Aqara temperature sensor

Now that Homeassistant is connected to zigbee2mqtt, go to http://orangepiadress:8080 to see the zigbee2mqtt frontend.

  • On the top panel, click on Permit join(All)
  • On the aqara temperature sensor, click on the button located on one of the sides.
  • You should see the aqara temperature sensor appearing in the frontend

Test it

Once the aqara temperature snsor is connected to the zigbee2mqtt, the device should be created automatically in homeassistant.

Go to homeassistant:

  • On the left menu, Settings
  • Devices & services
  • Mqtt

You should see the zigbee data appearing

aqara-temperature-homeassistant