How to Add Xiaomi Humidifier to HomeKit: The Complete Guide

Owners of Xiaomi equipment often face a dilemma: the brand’s devices have excellent functionality, but do not have native support for the Apple ecosystem, which creates a disparity in the management of the smart home, where climate control has to be managed through a separate application, but there is a proven way to combine everything into a single Apple Home system.

Integration of the humidifier, whether it is the popular Xiaomi Smartmi Evaporative Humidifier 2 model or newer versions, requires the use of an intermediate link.Naturally, these gadgets work through the Mi Home protocol, which is not directly compatible with HomeKit without the use of special gateways or software.

In this article, we’ll break down all the current connectivity methods, learn how to turn your Android phone or Raspberry Pi into a bridge between the worlds of Xiaomi and Apple, allowing you to create complex automation scenarios and manage voice moisture through Siri.

Equipment and training required

Before you start software configuration, you need to make sure that there is a basic set of equipment. Without the right hardware, software emulation of the gateway will be impossible or unstable.

You need a stable local area Wi-Fi network. The router needs to keep multiple devices running simultaneously, because the constant exchange of data between the gateway and the humidifier can load the channel, and it is also critical that all devices are on the same subnet.

  • πŸ“± iPhone with the installed application "Home" (Home).
  • πŸ“‘ The Gateway Device (Raspberry Pi, Apple) TV, Mac or Android phone).
  • πŸ”Œ Xiaomi’s humidifier itself, already configured in the Mi Home app.
  • πŸ”‘ Access to Xiaomi account (Mi Account) to receive device token.

⚠️ Warning: Make sure your humidifier is connected to the server you plan to use.If you change region in the Mi Home app, the device may require a reset.

Special attention should be paid to the versions of the operating system on your iPhone. For the correct operation of new plugins and widgets, it is recommended to use the current version of iOS. Older versions may not support some types of accessories or data formats.

πŸ“Š What device do you plan to use as a gateway?
Raspberry Pi
Apple TV (HomePod)
Constantly on PC/Mac
Old Android smartphone

Receiving a token of the Mi Home device

A key step in integration is to get a unique identifier, Token, which is a 32-character string that allows third-party software to gain control over your humidifier bypassing standard protocol constraints.

There are several ways to mine this token, and the easiest and safest way for iOS users is to use jailbreak tools or special utilities for macOS that intercept traffic, but if you don't want to use sophisticated tools, you can use the method through an Android emulator or root rights.

The process is as follows: you need to install the Mi Home application on a device where you can run a traffic sniffer, or use special scripts that log in under your login. Once successful, the script will display a list of devices and their tokens.

Device: zhimi.humidifier.ca1


Token: 32_character_hex_string_here




IP: 192.168.1.45

Keep the information in a safe place. The token is the actual access key. If you reset the humidifier to the factory settings or re-attach it to another account, the token changes and you have to repeat the procedure.

πŸ’‘

Write down the token and IP-the device address in the notes immediately after receipt. IP-addressing in the router setting will work more stable even after restarting the router.

Method 1: Using Homebridge on Raspberry Pi

The most reliable and popular integration solution is the Homebridge platform installation.This is a lightweight Node.js server that emulates the HomeKit accessory and allows third-party plugins to stream the status of Xiaomi devices to Apple Home.

The ideal platform for Homebridge deployment is the Raspberry Pi single board computer, which consumes minimal electricity, operates silently and can function 24/7.

After installing the Homebridge itself, you need to go to the management interface (usually available via port). 8585) and find the homebridge-xiaomi-humidifier plugin or the universal homebridge-mi-humidifier. config.json.

ParameterDescriptionExample of meaning
platformType of plugin platformXiaomiHumidifier
nameDevice name in HomeKitBedroom Humidifier
ipLocal. IP-address192.168.1.45
token32-character keyffffffffffffffffffffffffffffffff
modelModel of the devicezhimi.humidifier.ca1

After making changes to the configuration file, you need to restart the Homebridge service. If all the parameters are specified correctly, the Home app on the iPhone will request to add a new accessory.

β˜‘οΈ Checklist of Homebridge installation

Done: 0 / 1

Method 2: Integration with Home Assistant

For advanced users looking to gain maximum control over a smart home, Home Assistant is a powerful open source platform that supports thousands of integrations, including the Xiaomi ecosystem.

Unlike Homebridge, Home Assistant offers deep data analysis and the ability to create complex automations, for example, the humidifier can only turn on when the temperature sensor is above 22 degrees and the humidity drops below 40%.

Installation is similar to Homebridge, often on the same Raspberry Pi, but in the form of a Docker container or virtual machine. After deployment, in the "Settings" section β†’ "Devices and services", you need to add Xiaomi Miio integration.

The system will automatically detect devices on the network if you provide it with account details or IP-Added to Home Assistant, devices can be tossed into Apple HomeKit through the built-in HomeKit Bridge.

⚠️ Warning: Home Assistant requires more resources to work than Homebridge. On older Raspberry Pi models (before version 3), the system can run slowly.

The main advantage of this method is independence from the cloud servers of Xiaomi after initial setup, all commands are executed locally, which provides instant response and work even in the absence of the Internet.

What if the Home Assistant can’t see the device?
If automatic detection does not work, try adding the device manually through the YAML-configuration. Specify IP, Also check if the firewall blocks ports 54321 or 53443 that Miio uses.

Setting up scenarios and automation

With the successful addition of a humidifier to the Home app, a world of automation is opening up. The standard Mi Home app is limited in this regard, while Apple Home allows you to link devices from different manufacturers.

You can create a Good Morning script that includes a humidifier along with a coffee maker and curtain lifting, or set up an automatic shutdown when you leave the house (iPhone geolocation determines exit from the Home zone).

You can use voice commands to control it through Siri, and you can just say, "Hi Siri, turn on the humidifier in the bedroom," or "Hi Siri, set the humidity level at 50 percent," and the system recognizes the device by the name you set up.

  • πŸŒ™ Automatic turn on at night when humidity drops below 35%.
  • 🏠 Turn off all climate devices when activated "Nobody is home".
  • πŸ’§ Notification on iPhone if water level in tank is critically low.
  • 🌑️ Turning on the humidifier only if the room temperature is above 20Β°C.

It's important to name devices and rooms correctly, and it has a direct impact on the accuracy of voice commands, avoid complex names, use simple words that speech recognition algorithms understand.

πŸ’‘

Local automation through HomeKit works faster and more reliable than cloud, as it does not depend on the speed of the Internet and servers of the manufacturer.

Diagnostics and troubleshooting

During the setup process, users may encounter a number of typical problems, most often related to network settings or incorrectly specified parameters of the token.

If the device appears in HomeKit as β€œNo response”, check if it has changed. IP-It is recommended to fix the address. IP-address of the humidifier in the router settings (Static) DHCP), so that it will always remain unchanged.

A common mistake is to use a token from another device or an outdated token. If you reset the humidifier or changed the Wi-Fi password, the token could change, in which case the procedure for obtaining the access key would have to be repeated.

Problem.Possible causeDecision
"No response" deviceChanged. IP-addressSecure IP in the router
Token errorWrong or old keyGet a new token
Management delaysWeak Wi-Fi signalImprove network coverage
Not visible at Home.Different Wi-Fi networksCheck the gateway and iPhone

Also, consider that some Xiaomi humidifier models have protection against frequent requests. If you set up a status survey every second, the device can temporarily block connections. The optimal survey interval is 5-10 seconds.

⚠️ Note: When you update the humidifier firmware through the Mi Home app, the integration may temporarily fail. After the update, check the health and reconnect the device if necessary.

Frequently Asked Questions (FAQ)

Do I need the Internet to work with a humidifier through HomeKit?
The Internet is a must for initial setup and token acquisition. However, if you use a Homebridge/Home Assistant, the control and automation will work locally without access to the WAN. Voice control via Siri also requires the Internet to process voice on Apple servers, but the execution command itself will go inside your network.
Will this work with a humidifier purchased in China?
Yes, the method of obtaining a token and using Homebridge is universal. It does not depend on the regional binding of the device (China, Global Version, Europe), the main thing is that the device connects to the Mi Home application and has a standard Miio protocol.
Can I use an old Android phone as a gateway?
Theoretically, yes, running a Homebridge or a dedicated server on it. However, the phone should be constantly connected to charging and Wi-Fi, the screen should be on (or configured to work constantly), which will quickly lead to a battery bloating.
Is it safe to transfer the token to third-party plugins?
The token gives you complete control of the device on the local network. Open source plugins (like Homebridge) are verified by the community. The risk is minimal if you use trusted repositories. The token does not give access to your Mi Account, only to a particular device.