Building a home automation system based on Domoticz, Xiaomi and Broadlink

The home automation system is a combination of software and hardware devices which handles home routine such as lights, temperature/humidity (microclimate) and entertainment systems (TV, audio etc.) automatically based on some scenarios. This post is about building such system based on Domoticz server, Xiaomi and Broadlink devices. I'll try to cover some topics such as system set up and useful scenarios. Agenda:
  1. Hardware
    1. Gateway
    2. Signaling sensors
    3. Data provider sensors
    4. Controlling sensors
    5. Smart lamps
    6. Server and wifi router
  2. Software
    1. Domoticz
    2. Mini DLNA
  3. Adding devices to Domoticz
    1. Gateway
    2. ZigBee devices
    3. Yeelight Smart bulbs
    4. Broadlink RM 3 mini and RM Pro+ remote controls
    5. Naming convention, groups, and scenes
  4. Network
  5. Scenarios
    1. Network devices state
      1. Are you at home?
    2. Notifications
      1. Motion activity detected
      2. Doors/windows activity detected
      3. Fire detected (high temperature)
      4. ZigBee devices batteries level report
    3. Room occupation
      1. Motion trigger
      2. Windows and doors trigger
    4. Room presence detection
      1. TV
      2. Laptop
      3. Room locking
    5. Light
      1. Room occupation trigger
      2. Button trigger
    6. Microclimate
    7. Alarm clock
  6. Remote access to your Domoticz
  7. Monitoring
    1. Service uptime
    2. Containers state
  8. Conclusion


Let's overview hardware which will be used in the system. I distinguish 5 types of devices/sensors for building home automation systems: gateways, signaling sensors, data providers, controlling sensors and "smart" light. Most of Xiaomi/Aqara devices are working over ZigBee protocol, but there are some which are working over wifi like lamps. In a nutshell, a gateway is a central place of a smart home which receives all the data from other sensors/devices which are connected to it. Signaling sensors tell about some event. Data sensors provide environment information. Controlling sensors send commands to home devices. Smart lamps can be controlled over wifi in order to switch light.

There are a lot more devices and sensors on the market for different purposes but in this post, I'll cover only that which are used for my basic scenarios.


  • Gateway (Xiaomi, WiFi/ZigBee) - a central point of ZigBee network. Receives events from other sensors. A system can run scenarios based on provided information.

Signaling sensors

  • Motions sensor (Xiaomi or Aqara, ZigBee) - emits a signal when motion is detected.
  • Door/window state sensor (Xiaomi or Aqara, ZigBee) - emits a signal when door/window is being opened or closed.

Data provider sensors

  • Temperature and humidity sensor (Xiaomi or Aqara, ZigBee) - provides current temperature and humidity.
  • Lux sensor (Aqara, ZigBee) - provides current luminosity. Usually, this sensor combined with a motion sensor (Aqara).

Controlling sensors

  • Button (Xiaomi, ZigBee) - sends commands (single click, double click and long click).
  • Socket (Xiaomi or Aqara, ZigBee) - power control.
  • Remote control RM Pro + (Broadlink, WiFi) - sends commands to IR and RF controlled devices such as conditioner, TV etc.
  • Remote control RM Mini (Broadlink, WiFi) - sends commands only to IR controlled devices.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web