How to connect the Xiaomi Mi Gateway to Domoticz

Out of the box the Xiaomi Mi Gateway does not allow other network-based devices to integrate with it, with a little bit of effort though you can enable LAN support for integration with Domoticz or other smart home platforms.

Here’s how to connect the Xiaomi Mi Gateway to Domoticz:

  1. Supply power to the Xiaomi Mi Gateway (you do not need to hard reset this device to enable LAN support)
  2. Open up the MiHome App (Android and App Store)
  3. From the Profile > Settings screen set to the Location field to “Mainland China”
  4. Open up the device detail screen for the Gateway device
  5. Click the triple dots button in the top-right corner of the screen to open the More screen
  6. Open the About screen
  7. At the bottom of the screen keep tapping the version number until a notice appears
  8. From the same screen open the Local Area Network Communication Protocol screen
  9. Slide the toggle element for “Local Area Network Communication Protocol” to enabled
  10. Note down the Password detail for later use in Domoticz (if the Password detail is blank or shows “password” click Confirm and re-open this screen
  11. Click the Confirm button to save changes and return to the More screen
  12. Open the Network Info screen and note the IP address for later use in Domoticz
  13. Switch to Domoticz and open up the Setup > Hardware screen
  14. From the Add new hardware section select Xiaomi Gateway from the Type list
  15. Set the Remote Address to the Xiaomi Mi Gateway IP address referenced above
  16. Set the Port Number to 9898
  17. Set the Password to the Xiaomi Mi Gateway password detail referenced above
  18. Click Add to add the new Xiaomi Mi Gateway to Domoticz
  19. Open up the Setup > Devices screen and check for new devices

That’s it 🙂

Give it some time for Domoticz to discover the new devices and you’re away, have fun!

How to delete an erroneous device record in Domoticz

My z-wave smart plug from Neo-cam decided to throw a single bad reading into the mix when reporting the line voltage of the TV I’m monitoring and Domoticz happily accepted it. Having a single bad device value threw out all of my long-term monitoring statistics and I could not easily remove that bad value without using DB Browser and/or another database editor on my Raspberry Pi.

Here’s the easy fix for devices that support graphing, the best part being that’s built into Domoticz!

  1. Open up Domoticz in your preferred web browser
  2. Open up the device log screen for the device in question (in my case a Utility device)
  3. With your mouse hover over the bad reading
  4. Hold down SHIFT on your keyboard and left click the bad reading
  5. A confirmation screen will appear, check the date/time and value is the bad value and hit OK

That’s it! Long-term statistics are working again. 🙂

Gallery