Xiaomi smart sockets are among the most popular home automation devices due to the combination of price, functionality and compatibility with the Mi Home. However, Apple owners often face the problem of how to integrate these devices into HomeKit if there is no official support? In this article, we will analyze all the current ways of connecting โ from using Homebridge to cloud bridges โ as well as typical errors and their solutions.
It is important to understand that Xiaomi does not certify its devices to work with HomeKit directly. This means that any integration requires third-party solutions. We tested all methods on the sockets Xiaomi Mi Smart Plug (ZNCZ02LM models, ZNCZ04LM) and Aqara Smart Plug (model SP-EUC01) with the latest version of iOS 17.5. All instructions are current for 2026 and take into account changes in the Mi Home and Home Assistant protocols.
Why Xiaomi doesnโt support HomeKit directly?
Xiaomiโs corporate policy is based on the development of its own Mi Home ecosystem (now Mi Home App and Xiaomi Home).Unlike Philips Hue or Nanoleaf, which receives HomeKit certification and puts the โWorks with Apple HomeKitโ logo on the packaging, Xiaomi focuses on markets in Asia and Europe where Apple is not dominant.
- ๐ฐ Certification cost: Getting the HomeKit logo requires paying for an Apple license and implementing a customized MFi chip (Made for iPhone/iPad), which increases the cost of devices.
- ๐ Geographical priorities: Xiaomiโs main markets are China, India and Europe, where users are more likely to choose Android or their own brand solutions.
- ๐ Data Control: Xiaomi prefers to store user data in its cloud services (e.g., in Chinese data centers), whereas HomeKit requires local processing to improve security.
But there are workarounds, and they all fall into three categories:
- Local bridges (such as Homebridge or Home Assistant) that emulate HomeKit support.
- Cloud integrations through services like IFTTT or Yandex Alice (but with limited functionality)
- Hardware hubs from third-party vendors (such as Athom Homey) that support both Xiaomi and HomeKit protocols at the same time.
Method 1: Connecting via Homebridge (recommended)
Homebridge is an open source software that allows you to add uncertified devices to HomeKit.
- ๐ฅ๏ธ Computer or Raspberry Pi (recommended Raspberry Pi 4 or 5 with 2GB of RAM).
- ๐ Xiaomi Smart Socket (any model with Mi Home support).
- ๐ฑ iPhone or iPad with the latest version of iOS.
- ๐ง Basic terminal skills (or willingness to follow instructions)
Steps to set up:
- Install Homebridge: sudo npm install -g --unsafe-perm homebridge homebridge-mi-home If you use a Raspberry Pi, pre-update the system: sudo apt update && sudo apt upgrade -y
- Set up a plugin for Xiaomi: Open the configuration file config.json (usually ~/.homebridge) and add: "platforms": [{"platform": "MiHomePlatform", "name": "MiHome", "appId": "YOUR_APP_ID", "appSecret": "YOUR_APP_SECRET", "cacheDirectory": "/var/lib/homebridge/.node-persist/storage", "tokenRefreshInterval": 14400 } ] Where YOUR_APP_ID and YOUR_APP_SECRET โ Data from your Mi Home account (how to get it โ see the next section).
- Get a device token: How to get a Xiaomi token for Homebridge?1. Install the Mi Home app on Android (IOS won't work).2 Log in and add an outlet to the app.3 Use the MiHome Token Extractor utility (available on GitHub) to extract the token.4 Copy the token to config config.json instead of YOUR_APP_ID and YOUR_APP_SECRET.
- Launch Homebridge and add the device to HomeKit: homebridge Open the Home app on your iPhone, click Add Accessory and scan the QR- code that appears in the terminal.
โ๏ธ Preparing for Homebridge setup
Important: If the outlet was previously tied to another region in Mi Home (e.g. China), it must be dropped and re-addressed to Russia or Europe, otherwise Homebridge will not be able to detect it.
Method 2: Integration with Home Assistant
Home Assistant is a more advanced alternative to Homebridge that offers advanced automation capabilities. To connect Xiaomiโs outlet to HomeKit via Home Assistant, follow the following steps:
- Install Home Assistant: The recommended way is to use a finished image for a Raspberry Pi or Docker container. Download it from the official website.
- Add Xiaomi Mi Home integration: Go to Settings โ Devices and Services โ Add integration and select Xiaomi Mi Home. Enter the username and password from your Mi Home account.
- Configure the bridge in HomeKit: In the same menu, find HomeKit and activate integration. The system will generate a QR- code to connect to the Home app.
| Parameter | Homebridge | Home Assistant |
|---|---|---|
| Difficulty setting up | Medium (requires work with configs) | Low (web interface) |
| Support for automation | Limited. | Extended (YAML- scripts) |
| Local work. | Yes (if the device is on the same network) | Yes. |
| Cloud addiction | No (if you use a local token) | Partially (for some devices) |
Home Assistant is better suited for complex smart home systems, where there are other devices besides sockets (for example, Aqara sensors or Xiaomi cameras). If you only need an outlet, Homebridge will be easier to set up.
๐ก
If Home Assistant doesnโt see the socket, make sure that itโs tied to the same region as your account (e.g., โEuropeโ) in the Mi Home App settings.
Method 3: Cloud Services (IFTTT, Yandex Alice)
If local solutions seem complicated, you can use cloud services, such as IFTTT (If This Then That) to create an applet that will include Xiaomiโs outlet from HomeKit via Shortcuts.
- โฑ๏ธ Delays: Commands are executed through the cloud, so the response can take up to 5-10 seconds.
- ๐ Limited automation: You canโt configure complex scenarios (e.g., time of day or sensors).
- ๐ณ Paid Fees: The free account IFTTT allows you to create only 3 applets.
Instructions for setting up via IFTTT:
- Create an account at iftt.com.
- Connect services: Mi Home (to control the socket). Apple HomeKit (as a trigger).
If (if) โ HomeKit accessory turns on (HomeKit device is enabled).
Then โ Turn on Mi Smart Plug (Enable Xiaomi socket).
โ ๏ธ Warning: Cloud services transmit data through third-party servers, which may violate privacy. Do not use this method to manage critical devices (e.g. alarms).
Typical errors and their solutions
When integrating Xiaomi outlets into HomeKit, users often face the following problems:
| Mistake. | Reason. | Decision |
|---|---|---|
| Device not detectable. | The socket is tied to another region in Mi Home | Remove it from the app and add it again by selecting the "Europe" or "Russia" region. |
| Homebridge is making an error called "Invalid Token". | Token is obsolete or incorrect | Get a new token through MiHome Token Extractor |
| The socket disconnects from HomeKit after the reboot | Homebridge/Home Assistant is not set up | Set up autoboot via systemd or cron |
| Management delays | The plug is connected via the cloud, not locally. | Use a local token in Homebridge configuration |
If the Xiaomi outlet flashes orange after reset, it means that it is in pairing mode. To exit it, hold the button on the case for 5-10 seconds until the indicator goes out.
โ ๏ธ Warning: When using Home Assistant with Xiaomi Mi Home integration, some users report accidental device shutdowns. This is due to Xiaomi's API limitations. The solution is to switch to local management via MiIO protocol (requires manually specifying IP- the address of the socket in the config).
Comparison of Integration Methods: What to Choose?
The choice of connection depends on your tasks and technical skills, and below is a comparison table with recommendations:
| Criteria | Homebridge | Home Assistant | IFTTT/Cloud |
|---|---|---|---|
| Response speed | Instantly (locally) | Instantly (locally) | 5-10 seconds (cloud) |
| Difficulty setting up | Medium | High (for beginners) | Low. |
| Support for other devices | Limited. | Wide (1000+ integrations) | Minimum |
| Internet dependency | Not (if local token) | No. | Yes. |
| Recommended for | 1-2 Xiaomi devices | A comprehensive smart home | Simple scenarios |
If you only need a socket and a couple of light bulbs, Homebridge is the best choice. For full automation (with sensors, cameras, scenarios), it is better to spend time setting up Home Assistant. Cloud services are only suitable for temporary solutions or if local methods are not available.
๐ก
For maximum reliability, use local tokens (not cloud accounts) and set up Homebridge/Home Assistant configuration backups.
Security: How to protect your smart home?
Integrating Xiaomi devices into HomeKit across third-party bridges creates potential vulnerabilities, and the following steps will help minimize the risks:
- ๐ Isolate the network: Place your smart home devices on a separate subnet (VLAN) of your router, which will restrict access to them from the main network.
- ๐ Update: Update Homebridge, Home Assistant, and device firmware regularly, and vulnerabilities in older versions are often exploited by hackers.
- ๐ก๏ธ Disable Cloud Access: In the Mi Home settings, disable the Cloud Management option for the outlet if you use a local token.
- ๐ก Use a strong password: For your Mi Home and Home Assistant account, set unique passwords that are at least 12 characters long.
If you use Raspberry Pi for Homebridge or Home Assistant, you must:
- Disable SSH access with password (use only keys).
- Set up a firewall (ufw) to block unauthorized connections.
- Install fail2ban to protect against brute force attacks.
โ ๏ธ Warning: Some Xiaomi socket models (e.g., Mi Smart Plug Wi-Fi models ZNCZ04LM) transmit power consumption data to Xiaomi cloud even when locally managed. If this is critical to your privacy, consider alternatives (e.g., Zigbee-enabled Aqara sockets).