Simple rukovodstvovat control smart home HomeKit is not developing as fast as we would like. At the moment, to find its supporting gadgets quite difficult, but the price tag is significantly more expensive than the tested devices from AliExpress.

Rumor has it that Xiaomi in the near future will provide an opportunity to connect their devices to HomeKit. It is unclear how this will be implemented, how easy will be the connection which hubs and gateways will need.

Right now there is a relatively easy way to make friends with the Xiaomi gadgets (and not only) with the system HomeKit, and app Building on iOS. About this method and will be discussed below.

HomeBridge is a special service that allows you to “make friends” with all kinds of gadgets with HomeKit, which does not natively support smart home system from Apple.

Service HomeBridge must be constantly running on any computer on your home network to transmit signals with Apple devices on unsupported smart electronics.

If the home is a continuously running computer or media server, you can deploy HomeBridge on it, if such a device is not present, you can get a simple “Malinka” (a single-Board computer Raspberry Pi) and run services on it.

In this article I will tell how to organize such a service on macOS or Windows, and will introduce General principles of connection gadgets Xiaomi to him.

How to set HomeBridge on macOS

1. Download and install necessary for operation of service components:

Nodejs for macOS

2. Set HomeBrigde with the command in the terminal:

sudo npm install -g —unsafe-perm homebridge

3. To start HomeBridge use the command:

$ homebridge

How to set HomeBridge on Windows

It is advisable to perform the installation and configuration of HomeBridge in the account, which in the future will operate the service. Some components will be installed so that access to them may not be available to other Windows users.

1. Set the required for the operation of the service components:

Bonjour SDK for Windows (you will need to confirm your free participation in the Apple Developer program);

OpenSSL 64-bit;

Nodejs for Windows (the last step is to choose where to save DLL OpenSSL. Specify the “Directory of binaries of OpenSSL”).

2. Launch command line on behalf of the administrators while (that is cmd and not a lightweight analogue of Windows PowerShell).

3. Enter the command to download and install the necessary modules:

npm install -g windows-build-tools

4. Produce unit HomeBridge team:

npm install -g homebridge

5. After installation, run Homebridge at the command prompt:


What to do next

Now for the service you need to repeat the last paragraph after you restart the computer and keep running the command line/terminal working with HomeBridge.

You can configure the automatic launch of the service in any way.

Once HomeBridge configured and started, you should go to setting up services and adding additional modules.

In theory, a large part of the smart gadgets you can make friends with HomeKit with HomeBridge. You only need to download and configure these plugins.

Basically, these modules are distributed on GitHub, there is also the example configurations for plug-in settings and answers to frequently asked questions. Write and develop anything not necessary, just install the plugin, add the configuration from the example and use.

File configuration config HomeBridge.json must be on the way:

%userprofile%.homebridge for Windows

/usr/local/lib/node_modules/homebridge for macOS

It will have to be created manually using any text editor and add all the parts of the examples from GitHub to launch the appropriate plug-ins and add-ons.

He HomeBridge will be perceived HomeKit as a separate independent unit. To mount it you will need to add a device to the app on iOS by scanning the output to the command line QR code or by entering the display in the same room.

When the device appears in the Annex Building, the installation and configuration of HomeBridge can be considered completed.

Finally, connect to HomeKit, Xiaomi

If you’ve done described above, further problems will be almost.

Installation of various gadgets Xiaomi is one and the same algorithm:

1. Find the page with the plugin for your device on GitHub.

For example, a plug-in for smart sockets Xiaomi.

2. Installed the plugin via command line or terminal.

In our example, use the command:

install-g homebridge-mi-outlet

3. Make the appropriate code in the configuration file.

In the example, the plugin supports multiple devices. Smart socket from different generations and a few filters.

Our outlet need a piece of configuration code:


To determine the IP address of the socket will snap, this will help the app or the web interface used the router at home. As you can see, using HomeBridge get even the ability to individually control the luminous diode on the socket and to determine the temperature inside the unit.

If necessary, the switches are added and removed from HomeKit change the settings to true/false.

The most difficult in the above example will define the so-called token. This is the unique identifier of that particular device.

Dwell on it will not, to obtain the token, there are many ways, depending on the presence of certain devices. For example, it can be easily obtained via a modified Mi Home app for Android and if you need a smartphone at hand, always come to the aid of the virtual machine.

To make tokens are not required for all devices Xiaomi, for example, of my devices that had to be done only for the smart outlet. Lamp, table lamp and night light connect without it.

After restarting the service HomeBridge devices begin to appear in the app, and manage them becomes as easy as and gadgets with support for HomeKit out of the box.

How to install the web interface

Control via command line not everyone will like. Much easier to add a simple but clear web interface and to make all operations through it.

“Web-face” allows you to monitor statistics and event log HomeBridge, manage connected devices directly from your browser, add or remove plugins, change the configuration and restart the service. It is possible to create multiple accounts to access the web interface.

To install do the following:

1. Go to the project page on GitHub.

This is not the only option for adding a web interface for HomeBridge. Can dwell on it or look like that from other developers. Opportunity in most cases will be identical, differs only in appearance of the module.

2. Run command prompt or terminal and use the command to install it:

npm install -g —unsafe-perm homebridge-config-ui-x
3. In the configuration file HomeBridge should add this code:


4. After successful installation restart and try HomeBridge go to the page in the browser http://localhost:8080.

For authorization use login and password “admin”. In the future, we recommend to change your credentials.

5. In the web interface display section to control connected gadgets, need to start the service with parameter “-I”.

So the command to run HomeBridge will look like the following:

homebridge -I
So we have a convenient management tool which can be run in any browser.

In the end

Now you know how to connect almost any smart gadget to HomeKit and control it with your iPhone or iPad. You can even draw assistant Siri.

All this adds a significant advantage to Xiaomi gadgets in comparison with HomeKit-ready devices. So to determine which outlet is better, will be more difficult.

Service HomeBridge can run on a constantly running computer, and ideally for him is acquired by a miniature Raspberry PI, which is great for such purposes. If interested, I will tell you in detail about how to set up a “pokey” to work with HomeKit.


Please enter your comment!
Please enter your name here