Smart home Xiaomi from scratch: how to build a system, configure the gateway and sensors without errors

Xiaomi’s smart home system is not just a collection of gadgets, but a complete ecosystem that integrates lighting, climate control, security and appliance management into a single network. Xiaomi’s main advantage is that it offers affordable price with high functionality. Unlike competitors (like Apple HomeKit or Google Home), you don’t need to buy expensive hubs: one Mi Home Gateway is enough to connect dozens of sensors and actuators.

But where to start? Many users are lost in the range: some choose motion sensors, others smart sockets, others immediately take the sets with cameras. In fact, the key element of any system is a gateway, without which most sensors simply will not work. It not only connects devices with each other, but also provides interaction with the cloud Mi Home or Home Assistant (if you prefer local control).

Xiaomi Gateway: which to choose and why it is needed

The gateway is the brain of your smart home system, and it has three key functions:

  • πŸ”„ Connects devices using the Zigbee protocol (low-energy standard for IoT devices) into a single network.
  • πŸ“‘ Connects to Wi-Fi by transferring data to the Mi Home cloud or local server.
  • πŸ”Š Works as a speaker for alerts (e.g., alarm when a smoke sensor is triggered).

Xiaomi has several gateway models for 2026, but two options are relevant for most users:

ModelSupport for ZigbeeWi-FiAdditionally.Price (roughly)
Xiaomi Mi Home Gateway 3Zigbee 3.02.4 GHzBuilt-in speaker, RGB-lighting2 500–3 000 β‚½
Xiaomi Aqara Hub M2Zigbee 3.02.4/5 GHzSupport for HomeKit, Ethernet port4 000–4 500 β‚½
Xiaomi Mi Smart Home Gateway (1st generation)Zigbee 1.22.4 GHzOlder model, no updates1 500–2 000 β‚½

If you're just starting out, take the Gateway 3, which supports all of the latest sensors and has stable software. The Aqara Hub M2 is for those who are planning to integrate with Apple's HomeKit or want to connect the gateway via cable (via Ethernet), but the old model is not worth buying: it's not only outdated, but it may not support new devices.

⚠️ Note: Xiaomi Gateway only works on 2.4GHz network.If your router only broadcasts 5GHz, the smart home won't work!

πŸ“Š What Xiaomi Gateway Are You Planning to Use?
Mi Home Gateway 3
Aqara Hub M2
There is already a 1st generation gateway
Another option

What sensors and devices to choose for the start

Once you've bought a gateway, you need to pick up the sensors, don't chase the numbers, start with the basic devices that solve the specific problems, and here's the minimum set for a comfortable start.

  • πŸ”¦ Motion Sensor (Xiaomi Motion Sensor) – turns on light when a person appears, works up to 2 years on a battery.
  • πŸšͺ Opening sensor of doors/windows (Xiaomi) Door/Window Sensor – signals penetration or draft.
  • 🌑️ Xiaomi Temperature and Humidity Sensor – Helps monitor the microclimate.
  • πŸ’‘ Smart light bulb (Xiaomi Yeelight or Philips Hue with Mi Home support.
  • ⚑ Smart socket (Xiaomi Smart Plug) - allows you to remotely control household appliances.

If you have a budget, start with a motion sensor and one smart light bulb, which will allow you to set up basic automation (for example, the lights in the hallway will turn on at night when you appear), later you can add a water leak sensor (Xiaomi Water Leak Sensor) or a camera (Xiaomi Mi Home Camera) if you need video surveillance.

πŸ’‘

Before buying sensors, check their compatibility with your gateway in the official Mi Home app. Some devices (such as Aqara) may require the gateway to be firmware up to the latest version.

Connecting the gateway to the Internet: step-by-step instructions

Now, to the most critical stage, which is the setting up of the gateway, you'll need to do this.

  • πŸ“± Smartphone with Mi Home app (download to Google Play or App Store).
  • πŸ”Œ 2.4GHz router (if you have dual-band Wi-Fi, make sure the 2.4GHz network is on and has a unique name).
  • ⚑ Power supply for the gateway (comes complete).

Follow the instructions:

  1. Connect the gateway to the outlet. Wait until the blue light light comes on (this means that the device is ready to be set up).
  2. Open the Mi Home app, register or log in to your account. Choose the region of Russia (important for proper operation!).
  3. Click + β†’ Add Device β†’ Gateway and select your gateway model.
  4. Bring the smartphone to the gateway (at a distance of 5-10 cm) – the application will automatically connect to it via Bluetooth.
  5. Select your 2.4GHz Wi-Fi network and enter a password. Wait until the setup is complete (may take up to 3 minutes).

If the gateway is not connected:

  • πŸ”„ Reboot router and gateway.
  • πŸ“Ά Check that the 2.4GHz network is not hidden (SSID broadcast).
  • πŸ›‘οΈ Turn it off for setup time VPN firewall.

β˜‘οΈ Check before setting up the gateway

Done: 0 / 4

⚠️ Note: If the gateway is permanently disconnected from Wi-Fi after setting up, check the settings DHCP Some models (e.g. TP-Link in mode) AP) fail IP-Solution: Enable Router mode or fix it IP lock-room.

How to add sensors and set up automation

When the gateway is connected, you can add sensors, and the process is almost the same for all devices.

  1. In the Mi Home app, click + β†’ Add the device.
  2. Select a category (e.g., Motion Sensors β†’ Motion Sensor).
  3. Activate the sensor (usually press and hold the button on the case for 3-5 seconds until the indicator blinks).
  4. Wait for the app to find the device and confirm the addition.

And then you add sensors, you go to automation, and you can set up, for example:

  • πŸ’‘ Smart lighting: the light bulb is turned on when the motion sensor is triggered from 18:00 to 23:00.
  • 🚨 Security mode: when the door is opened, the lock siren is turned on and a notification arrives on the phone.
  • 🌿 Climate control: humidity below 40% is turned on humidifier (through a smart socket).

To create automation:

  1. In Mi Home, go to Profile β†’ Automation β†’ Create.
  2. Select the Condition (for example, motion sensor activation).
  3. Add Action (turn on the light bulb).
  4. Save the script and test it out.
What to do if the sensor is not added?
1. Check the battery (in some sensors it may be installed incorrectly from the factory). 2. Bring the sensor as close as possible to the gateway (ideally, 1-2 meters away). 3. Reset the gateway (remove the plug from the socket for 10 seconds). 4. Make sure you have the latest version of the Mi Home app (sometimes older versions don't see new devices).

Common Mistakes and How to Avoid Them

Even with the right setup, users face problems, and here are the most common ones and ways to solve them:

Problem.Reason.Decision
Gateway does not connect to Wi-Fi5 GHz network or hidden SSIDTurn on 2.4GHz and make the network visible
Sensors shut down every other day.Zigbee weak signal or interferenceMove the gateway to the center of the apartment, avoid metal obstacles
Automation is delayedPoor Internet connection or Mi Home cloud servers overloadedConfigure local scripts (if the gateway supports) or use Home Assistant
The gateway squeaks for no reason.The sensor went off, but the notification didn't come.Check the Alert Settings in Mi Home β†’ Device β†’ Gateway Settings

Another common mistake is network congestion, and if you have more than 30 Zigbee devices, the gateway can start to slow down.

  • πŸ“Ά Divide the devices into several gateways (for example, one for the first floor, the other for the second floor).
  • πŸ”„ Update the gateway firmware to the latest version (Mi Home has the option to check for updates).
  • πŸ› οΈ Use Zigbee-repeaters (for example, Xiaomi smart sockets can act as signal amplifiers).

πŸ’‘

If the sensors are unstable, the first check is the Zigbee signal level. In the Mi Home app, open the sensor information: if the signal level is below 70%, move the gateway or device.

Advanced Settings: Local Management and Home Assistant

The Mi Home cloud is convenient, but it depends on the Internet. If you need local management (without the cloud), consider two options:

  1. Mi Home Local: Some gateways (such as the Aqara Hub M2) support non-internet scripting. Select Local Execution in the automation settings.
  2. Home Assistant: An open platform for smart homes that integrates with Xiaomi through the Xiaomi Mi Home Integration plugin. Allows you to create complex scenarios that are independent of the cloud.

To connect to Home Assistant:

  1. Install Home Assistant on Raspberry Pi or other server (instructions on the official website).
  2. In the configuration file configuration.yaml add:
xiaomi_aqara:


gateways:




- key: YOUR_GATEWAY_KEY

(The key can be retrieved from Mi Home by opening the gateway information and selecting Shared Access).

The advantages of Home Assistant:

  • πŸ”’ Full Data Control (Nothing Goes to Xiaomi Cloud).
  • ⚑ Fast execution of scripts (no delays due to cloud).
  • πŸ”§ Integration with other systems (e.g. Google Home or Amazon Alexa).

⚠️ Note: When using Home Assistant, disable cloud sync in Mi Home to avoid conflict. Otherwise, scripts may be duplicated or not work correctly.

FAQ: Answers to Frequent Questions

Can you use the Xiaomi gateway without the internet?
Yes, but with reservations. The gateway will run on the Zigbee LAN, but: Smartphone control will only be possible via the LAN (Mi Home requires Internet to log in). Automation configured through the cloud will not work. Use local scenarios (if the gateway supports); Notifications to the phone will only come when connected to the Internet. For full offline work, it is better to use Home Assistant.
How many sensors can be connected to a single Xiaomi gateway?
The official limit is 128 devices per gateway. However, in practice: When connecting more than 30 to 40 devices, there can be delays and communication losses. Each Zigbee device increases the load on the network. If the sensors are far from the gateway, the signal weakens. Solution: use multiple gateways or Zigbee repeaters (for example, smart sockets).
How to reset the Xiaomi gateway to factory settings?
If the gateway is not working properly, reset: Turn off the gateway from the power. Press the button on the case and hold it, connect the gateway to the socket. Hold the button for 10-15 seconds until the indicator flashes yellow quickly. Release the button, the gateway will reset and be ready for a new setup. After reset, all devices and automation will have to be reconfigured!
Can I connect a Xiaomi camera to the gateway?
No, Xiaomi cameras (like the Mi Home Camera) connect directly to Wi-Fi and don't interact with the Zigbee gateway. However, you can: Use the camera and gateway in one Mi Home app for centralized control. Set up automation through Home Assistant (for example, when the motion sensor is triggered, the camera will start recording).
Why Xiaomi sensors are fast planting batteries?
Main causes: πŸ“Ά Zigbee weak signal: sensor constantly tries to communicate with the gateway, consuming charge. πŸ”„ Frequent surveys: If the sensor sends data every minute (such as a temperature sensor), the battery will sit down in 2-3 months. 🧲 Extreme temperatures: in cold or heat, batteries discharge faster. Solution: Move the gateway closer to the sensors. In sensor settings (if any), increase the survey interval (for example, once every 10 minutes). Use batteries of famous brands (Duracell, Energizer).