Xiaomi Gateway (Aqara)

From Domoticz
Jump to: navigation, search

Xiaomi Gateway

Xiaomi (Aqara) makes a smart home gateway/hub that has support for a variety of Xiaomi sensors. They can be purchased on AliExpress or other stores at very competitive prices. Protocol is Zigbee and WiFi, and the gateway and Domoticz need to be in the same network/subnet.

Multiple gateways are not supported, however the Smart Socket/Plug acts as a wireless repeater so you can use these to extend network range.

Currently you need the beta version of Domoticz to support the Xiaomi Gateway and devices

Note that the gateway needs to be at least version 2. Radio support on the gateway indicates at least version 2. If you are unsure, please ask your supplier before purchasing

Xiaomi.jpg

Compatible Devices

Compatible Devices:

  1. Human Body Sensor (Motion Sensor)
  2. Wireless Smart Switch
  3. Door/Window Sensor
  4. Temperature and Humidity Sensor
  5. Smart Socket/Plug - Zigbee version (The WiFi version is not supported)
  6. Xiaomi Mi Smart Cube
  7. Wireless Aqara Switch (Dual Button)
  8. Wireless Aqara Switch (Single Button)
  9. Wired Aqara Switch (Dual Button)
  10. Wired Aqara Switch (Single Button)
  11. Xiaomi Gateway LED

Note that some features are not yet available as they are not accessible in the Xiaomi API. Gateway radio control, gateway light sensor, smart socket power usage, and battery levels are not available in Domoticz yet, however there is a firmware update planned from Xiaomi that should add these features. When that firmware update is made public, the new features will be added to Domoticz!

Adding the Xiaomi Gateway to Domoticz

You first need to enable local network functions by using the Android Mi Home App https://play.google.com/store/apps/details?id=com.xiaomi.smarthome

  1. Install the App on a Android device
  2. Make sure you set your region to: Mainland China under settings -> Locale - at time of writing this seems to be required.
  3. Mainland China and language can set on English
  4. Select your Gateway in Mi Home
  5. Then the 3 dots at the top right of the screen
  6. Then click on about
  7. Tap the version (2.23 is the current Android version as of 8 March 2017) number at the bottom of the screen repeatedly
  8. You should see now 2 extra options listed in English (was Chinese in earlier versions)until you did now enable the developer mode. [ if not try all steps again!]
  9. Choose the first new option
  10. Then tap the first toggle switch to enable LAN functions. Note down the password (91bg8zfkf9vd6uw7 in the screenshot). Make sure you hit the OK button (to the right of the cancel button) to save your changes.
  11. If you change here something, you lose your password! [ this password you need in Domoticz ]

Xiaomi 01.png

Now choose the second new menu option, and note down the IP address after "localIp".
Make the IP static in your router!

Then in Domoticz go to Setup -> Hardware, and choose the Xiaomi Gateway Type. Enter the following:

  1. Name: "Xiaomi Gateway" or anything you want to name it
  2. Remote Address: the IP address of your gateway
  3. Port: Use 9898 Note that you cannot have another service on your system already using port 9898
  4. Password: The password of your gateway

Note that you may need to clear your browser cache if you can't see the Xiaomi Gateway option and/or all the fields

Xiaomi 03.PNG

  1. Then click the Add button.
  2. set in Domotic new hardware and devices active
  3. Navigate to Setup -> Devices, and you should now see detected devices listed.

You should learn the new Xiaomi devices [ sensors you have ] first on the gateway with the Xiaomi app. When they are learned in the gateway, you wil see the devices under new devices in Domoticz.

Great job Corbin!!

Troubleshooting

Problem: After adding the gateway, no devices are found in Domoticz Solution: You need to ensure the system Domoticz is running on can receive UDP Multicast packets. On Linux, this can be done with

iptables -P OUTPUT ACCEPT

iptables -I INPUT -p udp -j ACCEPT