Owning a Yeelight or Xiaomi Smart LED device opens up a lot of possibilities for automation, but iPhone owners often face a limitation: native support for Apple HomeKit lamps is absent. This creates a situation where light control is scattered between several applications, which reduces the usability of the ecosystem. Fortunately, there are proven software methods to make Chinese smart light friends with Apple’s proprietary system.
To do this, you'll need not only a smartphone, but also a constantly working computing center that bridges protocols. Unlike direct Bluetooth or Wi-Fi connectivity, integration requires a local server that translates the state of the lamps into the HomeKit Accessory Protocol. The process may seem difficult to beginners, but following the algorithm of actions ensures a successful outcome.
Consider two main ways to solve the problem: using specialized software on a computer or running a server on a single board computer like the Raspberry Pi. The choice of the specific method depends on your technical training and availability of free equipment. In any case, after setting up, you will have full control of the light through the Home app and the voice assistant Siri.
There are several key components that integration is not possible without: first, the smart bulb itself, which is already configured in the native Mi Home app; second, the gateway device that will take over as the server; and third, a stable LAN where all devices are on the same subnet.
It’s important to understand that direct connectivity without an intermediate server is only possible if you buy an expensive physical Aqara gateway with HomeKit support, but in this article we’ll look at software methods that work with conventional Wi-Fi lamps.
Necessary equipment and network preparation
Before you start installing software, you need to make sure your infrastructure is ready to go.The basic requirement is to have a router that distributes it. IP-If you have a complex network with multiple access points or guest areas, make sure that the server and the lamps see each other.
You'll need a device to host the server side. This can be an old laptop with Windows or macOS, a computer with a Linux operating system, or the popular single-board Raspberry Pi. For Mac users with Apple Silicon processors, running the server directly on the main computer is a great option, although this is not recommended for the production environment due to dependencies.
- 📱 iPhone with the installed application “Home” (Home).
- 💡 Smart lamp. Xiaomi/Yeelight, Connected to Wi-Fi and Mi Account.
- 💻 Server device (PC, Mac, Raspberry Pi) with Internet access.
- 🌐 2.4GHz stable Wi-Fi connection (lamps often don't see 5GHz network).
⚠️ Warning: Make sure that customer isolation is turned off on the router (AP If this function is active, the server will not be able to send commands to the lamps, and the integration will not work.
It is also critical to record IP-Device addresses or set up static address issuance (DHCP Reservation on the router. IP-The lamp address will change after the router restarts, the server will lose communication with the device, and the Home application will have a status of "Not responding." This is a common problem that is easy to prevent at launch.
Platform choice: Homebridge vs Home Assistant
The two leaders in the world of home automation for bringing together disparate devices are Homebridge and Home Assistant, both free, open source and actively supported by the community, but they have different philosophies and entry thresholds.
Homebridge is a lightweight server that is designed exclusively for emulating HomeKit accessories. Its interface is minimalistic, and the installation of plugins is through a convenient web interface. For the task of “just add a lamp to HomeKit”, this is often the best choice, since it consumes minimal resources and does not require deep knowledge of Linux.
Home Assistant is a powerful platform for fully automated smart homes that allows you to create complex scenarios, link devices from different brands and visualize data. If you plan to expand your smart home in the future with motion sensors, climate control and cameras, you should choose Home Assistant right away, although the initial setup will take longer.
| Characteristics | Homebridge | Home Assistant |
|---|---|---|
| Main objective | Emulation of HomeKit | Centralized automation |
| Difficulty | Low/Mediocre | Medium/High |
| Resource intensity | Low. | Medium/High |
| Interface. | Web-based control panel | Extended panel Lovelace |
Both platforms use plugins (integrations) to work with specific devices. In the case of Xiaomi, it is most often the homebridge-yeelight plugin or Xiaomi MiOT integration. The choice of a particular plugin depends on the model of your lamp and the region to which the account is linked.
💡
To get started with Homebridge on Windows or macOS, the easiest way to use the Homebridge Config UI X installer is to automatically configure the required Node.js dependencies.
Installation and configuration of Homebridge on the example Windows/macOS
Consider the Homebridge-based installation process, because it's the most direct route to the goal. You first need to download and install the server itself. For Windows and macOS, there are pre-installers that make it much easier.
After installing the basic package, go to the web management interface, which is usually available at the address http://localhost:8581. Here in the “Plugins” section you need to find and install a plugin for working with lamps Yeelight/Xiaomi. In the search, type homebridge-yeelight or @miio/homebridge.
The key step is the configuration of the plugin. You'll need to get a token access to your lamp. This is a unique security key that is generated when you link the device, and you can get it through third-party snails on Android (for example, Mi Home Token Grabber) or through Python scripts if you have a Mi Cloud account.
☑️ Checklist of Homebridge setup
After receiving the token, open the configuration file config.json You need to add a note about the lamp by specifying it. IP-The address, model and the token received must be strictly adhered to, otherwise the server will not start.
{
"platform": "Yeelight",
"devices": [
{
"name": "Living Room Light",
"model": "color",
"ip": "192.168.1.50",
"token": "your token of 32_characters"
}
]
}Once the configuration is saved, the server will restart, and if there are no errors in the logs in red, then the connection to the lamp is established, and now a new device should appear in the Home app on the iPhone, ready to be added.
Integration with Home Assistant and Xiaomi MiOT
If you choose the Home Assistant path, the process will be different. This platform is often installed as an operating system on a Raspberry Pi or as a Docker container. Once you first set up the HA, you need to install integration for Xiaomi.
The most modern way is to use Xiaomi MiOT Auto integration, which allows you to add devices directly by scanning your local network» → «Add integration» → Find out Xiaomi MiOT».
The system will ask you to log in to Xiaomi. After successful login, all compatible devices will appear in the list. HomeKit uses the built-in HomeKit Bridge feature, which does not require additional plugins, unlike Homebridge.
- 🔌 Open Home Assistant settings and go to Integration».
- 🔍 Find and activate the HomeKit Bridge».
- 📲 Follow the instructions on the screen to pair with the iPhone.
- 🏠 Scan it. QR-code or enter the code manually in the application "Home».
⚠️ Note: When using Home Assistant, make sure port 51827 (or your chosen HomeKit port) is open in the server firewall, otherwise the iPhone won’t see the bridge when you add it.
The advantage of this method is flexibility: You can rename the device, change its type (for example, imagine a color lamp as a regular one if you need to), and create complex automations that are not available in the standard Mi Home app.
What to do if the token does not work?
Adding the device to the Home app on iPhone
When the server is set up and the lights are detected, the final step is to add an accessory to the Apple ecosystem. Open the Home app on your iPhone or iPad. Make sure the mobile device is connected to the same Wi-Fi network as the automation server.
Click the + button in the upper right corner and select Add Accessory. If the server is running correctly, a new bridge will appear in the More Likely list (such as Homebridge or Home Assistant). If the device is not listed, select No Code or Undiscovered.
Enter the pairing code that appears in your server's web interface (usually in the HomeKit status section). Once you enter the code, the setup process will begin, and you can assign a lamp to a particular room, such as the Living Room or the Bedroom, and give it a clear name.
Tip: Call the devices as you will use them in voice commands. The name "Light in the Hall" is better than "Yeelight Color 1," as Siri will be easier to recognize commands.
Once the setting is complete, the lamp will light up and you can control it: turn it on, turn it off, change the brightness and color (if the model supports it), and all changes are instantly synchronized between the server, the Mi Home app and Apple Home.
💡
The successful addition to HomeKit means that the device is now managed locally through your iPhone, even if the ISP is disabled while the LAN is running.
Setting up scenarios and light automation
The main value of the integration in HomeKit is the ability to create scripts. You can combine the Xiaomi lamp with other Apple devices or third-party accessories, for example, the lights can turn on automatically when you open a door or a geolocation event.
To create a script, go to the Automation tab in the Home app. Press + and select a trigger, such as Time of Day or Motion Sensor. Then specify the action: Turn on Xiaomi light with a certain brightness and color temperature.
Also available are "Scenes" -- sets of actions performed with a single touch. The "Cinema" scene can turn off the main lights, turn on the bras by 10% and start the Apple TV. Xiaomi lamps perfectly support these commands, responding without noticeable delay.
- 🌅 Morning rise: Smooth lights on 30% at 7:00.
- 🎬 Mode: Turn off all lamps except one with warm light.
- 🔒 Leaving the house: turning off all lights when activating the geofence "Home».
- 🎉 Party: Cyclical change of colors when clapping hands (via Home Assistant).
Using Siri, you can control the lights in your voice, and phrases like "Hi Siri, turn off the lights in your bedroom," or "Hi Siri, turn the lights red," are stable, and voice control is particularly convenient when your hands are busy or you're in another part of the room.
Frequent problems and methods of their solution
You may encounter some common errors during the setup process, and one of the most common is, "Accessories are not responding," which means that the server is running, but the connection to the lamp is lost. IP-address of the lamp, and make sure it is online in the Mi Home app.
Another problem is the latency, which is often due to congestion in the Wi-Fi channel or a weak signal at the location of the lamp, try moving the router closer or using a Wi-Fi repeater, and rebooting the router also helps.
If Homebridge stopped seeing the lamp after updating the firmware, the communication protocol or token may have changed, in which case you will need to re-extract the device token and update the configuration file, and server logs (Journal or Log in the interface) will help accurately diagnose the error.
⚠️ Note: If you have frequent communication failures, try to disable the Smart Connect function on your router by dividing 2.4 GHz and 5 GHz networks into different ones. SSID, and connect the lamp strictly to 2.4 GHz.
Sometimes it helps to completely reset the lamp (5-6 times quickly turn on and off the switch) and re-tether in the Mi Home, after which the token can be updated.