How to Add Xiaomi Gateway to Alice: Integration of Zigbee Devices

Integrating the Xiaomi ecosystem with Yandex’s voice assistant is a challenge that requires understanding the architecture of the smart home. Directly connecting the Xiaomi Gateway to the Yandex app is impossible because of the Chinese manufacturer’s closed protocols. You’ll need an automation server to implement voice control scenarios.

The most common and stable solution is the Home Assistant platform, which is a bridge that translates commands from the Yandex Smart Home protocol into Zigbee signals that are understandable to the gateway. The setup process may seem difficult for a beginner, but the result is worth it.

You can control hundreds of sensors and light bulbs in one sentence, and in this article we will look at the step-by-step algorithm of actions, the necessary software, and the typical errors that users encounter during the first integration.

Equipment and software required

Before you start setting up, make sure you have a basic set of devices. The centerpiece will be the Xiaomi gateway itself, which supports the Zigbee protocol. Models like the Mi Smart Home Hub or older versions of Gateway 2 and Gateway 3 are suitable for this task, but their functionality in conjunction with Alice may differ.

The second critical component is a computer or a single-board computer (such as the Raspberry Pi) that will deploy Home Assistant on. Without a local automation server, Xiaomi’s closed ecosystem will not be able to make friends with the Yandex cloud, and a stable Wi-Fi connection will be required for all participants.

  • πŸ“± Smartphone with installed applications Mi Home and Yandex.
  • 🌐 Local server with Linux or specialized firmware (HAOS).
  • πŸ”Œ Xiaomi Gateway, put into developer mode (if required for your model).
  • πŸ“‘ Zigbee devices (sensors, relays, lamps) already tied to the gateway.

It’s important to understand that the gateway firmware version plays a key role: Some newer Hub models run exclusively over the cloud and require a special integration approach, while older Gateways are often managed locally through the Xiaomi Gateway 3 plugin.

⚠️ Warning: Make sure your Mi Home account is set up in the β€œChina” region. Many advanced features and integrations are only available when choosing a Chinese server, as the European versions of firmware have a stripped-down version of the service. API.

Installation and configuration of Home Assistant

The Home Assistant platform is the heart of your future system, and if you haven't installed it yet, it's recommended that you use the Home Assistant Operating System (HAOS) method for maximum stability.

The next step is to install the add-on manager. In modern versions of HA, it's built-in by default. You need to go to the system settings and activate the ability to download third-party repositories if you plan to use informal but powerful integrations.

Configuration -> Settings -> Add-ons -> Add repository

To work with the gateways Xiaomi most often use the integration of Xiaomi Gateway 3 from the author AlexxIT. This is a third-party solution that opens full access to the device, allowing you to throw into Alice not only the gateway itself, but all the sensors connected to it.

β˜‘οΈ Preparation of Home Assistant

Done: 0 / 4

Once the integration is installed through the HACS (Home Assistant Community Store), the system will need to restart, a standard procedure required to apply changes to the kernel configuration.

Integration of Xiaomi Gateway in Home Assistant

The process of adding a gateway depends on the model. For popular Gateway 3 models, integration is automatically done by searching for devices on the LAN. IP-lock-place MAC-address.

If you use cloud protocols, you will need to log in and password from your Mi Home account. When you enter data, the system will try to get an access token. If you use two-factor authorization, you may need to enter a code from an SMS.

A model of a lockProtocol of communicationType of integrationStability
Gateway 2Zigbee / Wi-FiLocal (LAN)Tall.
Gateway 3Zigbee 3.0 / BLELocal / CloudVery high.
Mi Smart HubZigbee 3.0Cloud (MiOT)Medium
Aqara HubZigbeeCloud / LocalTall.

Once you successfully add the device to the Home Assistant interface, you'll see a list of all the child devices connected to the gateway: motion sensors, temperatures, switches, all of them should be displayed as separate entities.

What to do if the gateway is not located?
Make sure the Home Assistant server and gateway are in the same subnet. Check router settings, maybe Wi-Fi client isolation is enabled, which prohibits local communication between devices. IP-gateway address in settings DHCP router.

It is recommended to immediately rename the entity in clear names in Russian, as they will be broadcast in the smart home of Yandex.

Set up integration with Yandex Smart Home

When all devices are displayed in Home Assistant, it's time to bundle with Alice, using the official Yandex Smart Home integration. Go to the integration settings and find the relevant component.

The system will suggest logging in to your Yandex account. Once you have successfully logged in, you need to choose which Home Assistant devices you want to export to the Yandex cloud.

  • 🏠 Choose a room for each device (Kitchen, Bedroom, Living room).
  • πŸ’‘ Specify the type of device (Light, Rosetta, Sensor).
  • πŸ”‡ Disable unnecessary entities that do not require voice control.
  • πŸ”„ Click the button β€œUpdate the list of devices” in the Yandex application.

The synchronization process can take from 30 seconds to several minutes, after which new devices should appear in the Yandex or Yandex Smart Home app, marked that they are controlled through Home Assistant.

⚠️ Warning: When changing the configuration in Home Assistant (addition of new sensors or renaming), be sure to start manual synchronization in the Yandex application, otherwise Alice will not see the changes.

πŸ“Š What kind of Xiaomi gateway do you use?
Gateway 2
Gateway 3
Mi Smart Hub
Aqara Hub M1/M2
Other

Device management and scripting

Now that Xiaomi's gateway has been added to Alice, you can control devices with voice. Phrases can be standard, like, "Alice, turn on the light in the hallway," or "Alice, what's the temperature in the bedroom," the system recognizes the types of devices and suggests appropriate commands.

But the real power of the bundle is revealed in scenarios, and you can create complex logic in the Home Assistant that will be triggered by voice command, for example, the command "Alice, I'm leaving" can turn off all the lights, close the smart curtains and turn on security mode on Xiaomi sensors.

alias: "The exit scenario"


trigger:




- platform: state




entity_id: switch.yandex_scene_care




to:"on"




action:




- service: light.turn_off




target: {entity_id: all}




- service: cover.close_cover




target: {entity_id: all}

To implement such scenarios, Home Assistant creates automation, and Yandex creates virtual switches or scenes that change the state of these automations, which bypasses the limitations of Alice’s standard functionality.

πŸ’‘

Use device groups in Home Assistant. Create a group called All Lights and put it in Yandex, so you can manage multiple light sources at once, even if they are from different manufacturers.

Remember that the delay in execution of the command depends on the response speed of the cloud and your Internet connection. Local commands inside Home Assistant are executed instantly, but the voice request always passes over the Internet.

Problem solving and communication debugging

During operation, there may be situations when devices become unavailable or no longer respond to Alice's commands. IP-Xiaomi gateway addresses after router reboot.

To avoid this, set up static address rentals (DHCP Reservation, on the router. MAC-lock-address IP. This will ensure the stability of the communication between the automation server and the hub.

If devices are missing from the list in Yandex, check the integration logs in Home Assistant. Authorization errors often occur when you change your password from your Mi Cloud account or the access token expires.

  • πŸ” Check availability of Home Assistant server from an external network (if cloud integration is used).
  • πŸ”Œ Reboot the Xiaomi gateway, disconnecting it from power for 10 seconds.
  • πŸ”„ In the Yandex application, remove the device and find it again.
  • πŸ“ Check the error logs in the home-assistant.log file.

πŸ’‘

The stability of the entire system depends on the quality of the local network. Use a wired connection for the Home Assistant server and the Xiaomi gateway, if possible.

It is also worth considering that some specific properties of Xiaomi devices (for example, the brightness of a colored lamp or the exact values of humidity) may not be thrown into Yandex completely due to the limitations of the data model of the smart home of Yandex.

Can I add a Xiaomi gateway to Alice without a Home Assistant?
Direct integration of most Xiaomi gateways into Yandex is impossible without an intermediary.There are rare exceptions for some models through the skill "Xiaomi Smart Home" (official), but it often works unstable, has a large latency and does not support all types of devices. Home Assistant remains the only way to get full control and local management.
Does the government work if the internet is missing?
If the Internet is only lost from the ISP, but the local network is working, the automation inside the Home Assistant will continue to work. However, voice control through Alice will not work, since voice processing takes place in the Yandex cloud. Voice control without the Internet would require complex solutions with local speech recognition (for example, Wyoming + Piper), which is beyond the basic setting.
Which Xiaomi Gateway is Best for Alice?
The best choice at the moment is the Xiaomi Gateway 3 (European or Chinese version).It supports the Zigbee 3.0 protocol, has a powerful processor and works great with integration from AlexxIT to Home Assistant. Older versions (Gateway 2) are also good, but have less memory and Bluetooth devices. Newer Hubs often require cloud integration, which increases latency.
Do I have to pay for the Home Assistant?
No, the Home Assistant software package itself is a completely free, open source project. You only pay for the hardware (computer, Raspberry Pi, gateway) on which it will run. No monthly subscriptions are required for the basic functionality.