How to Add Xiaomi Smart Socket to HomeKit: 3 Working Ways (2026)

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:

  1. Local bridges (such as Homebridge or Home Assistant) that emulate HomeKit support.
  2. Cloud integrations through services like IFTTT or Yandex Alice (but with limited functionality)
  3. Hardware hubs from third-party vendors (such as Athom Homey) that support both Xiaomi and HomeKit protocols at the same time.
๐Ÿ“Š What kind of integration do you prefer?
Local Bridge (Homebridge)
Cloud service (IFTTT)
The hardware hub (Homey)
Not yet.

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:

  1. 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
  2. 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).
  3. 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.
  4. 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

Done: 0 / 4

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:

  1. 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.
  2. 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.
  3. 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.
ParameterHomebridgeHome Assistant
Difficulty setting upMedium (requires work with configs)Low (web interface)
Support for automationLimited.Extended (YAML- scripts)
Local work.Yes (if the device is on the same network)Yes.
Cloud addictionNo (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:

  1. Create an account at iftt.com.
  2. 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 HomeRemove 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 incorrectGet a new token through MiHome Token Extractor
The socket disconnects from HomeKit after the rebootHomebridge/Home Assistant is not set upSet up autoboot via systemd or cron
Management delaysThe 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:

CriteriaHomebridgeHome AssistantIFTTT/Cloud
Response speedInstantly (locally)Instantly (locally)5-10 seconds (cloud)
Difficulty setting upMediumHigh (for beginners)Low.
Support for other devicesLimited.Wide (1000+ integrations)Minimum
Internet dependencyNot (if local token)No.Yes.
Recommended for1-2 Xiaomi devicesA comprehensive smart homeSimple 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:

  1. Disable SSH access with password (use only keys).
  2. Set up a firewall (ufw) to block unauthorized connections.
  3. 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).

FAQ: Frequent questions

Can I connect Xiaomi to HomeKit without Raspberry Pi?
Yes, but with limitations. Options: Use Home Assistant in a Docker container on any PC or NAS (like Synology); buy a ready-made hub, like Athom Homey Pro or Hoobs Box (pre-configured by Homebridge); use cloud services (IFTTT, Yandex Alice), but this is less reliable. Without a permanent server (even a cloud one), local integration is impossible.
Why Xiaomi is switching off HomeKit after the Mi Home update?
Mi Home app updates sometimes change the protocol for interacting with devices, which causes Homebridge or Home Assistant to lose communication. Solutions: Update the homebridge-mi-home plugin to the latest version. Get a new token through MiHome Token Extractor. Reverse temporarily to the old version of Mi Home (if it is known that it worked).
How to reset the Xiaomi outlet to factory settings?
To reset, hold the button on the socket case: 5 seconds - reset the connection to the Wi-Fi (the indicator flashes yellow). 10 seconds - a full reset to the factory settings (the indicator flashes orange). After reset, you need to re-add the socket to Mi Home and configure integration with HomeKit.
Can I control Xiaomiโ€™s socket through Siri?
Yes, but only if it's successfully added to HomeKit. After integration: Open the Home app on your iPhone. Click on the socket and select Settings. Enable the option "Allow Siri control." Now you can use commands like, "Hey Siri, turn on the socket in the living room." "Hey Siri, turn off all devices."
Which Xiaomi Socket Models Are Best for HomeKit?
The following models are best integrated: Model Features Protocol Xiaomi Mi Smart Plug (ZNCZ02LM) Wi-Fi Supports power consumption monitoring, but requires cloud token Xiaomi Mi Smart Plug (ZNCZ04LM) Wi-Fi More stable local operation, but no Aqara Smart Plug (SP-EUC01) Wi-Fi Easy to configure via Home Assistant, supports Zigbee in some regions Avoid models designed only for the Chinese market (for example, with a Type A plug) โ€“ they may not support local management.