How to set up a Xiaomi light with a motion sensor

Lighting integration into a smart home starts small, and most users start with automation of light in the hallway or bathroom. Xiaomi’s light in conjunction with the motion sensor allows you to create a comfortable environment where the lights turn on instantly when a person enters and go out when no one is in the room. This not only increases comfort, but also significantly saves energy by extending the life of LEDs. However, the process of pairing devices and setting up scenarios in the Mi Home application often raises questions for beginners due to the peculiarities of translation and the logic of the ecosystem.

There are several ways to do this, from using built-in smart lamps with proprietary algorithms to creating complex chains through a gateway or Bluetooth sensors. In this article, we will discuss each method in detail, paying special attention to the nuances of connecting devices of different communication protocols, such as ZigBee, Bluetooth Mesh and Wi-Fi. You will learn how to avoid typical delays and adjust the sensitivity of sensors to a specific room.

Before you start software setup, you need to make sure that all the physical components are ready to work. The motion sensor must be installed at a height of 1.8-2.5 meters, so that the viewing angle covers the entire area of activity, and the light source is in the line of sight of the sensor or gateway. Incorrect device location is the most common cause of unstable operation of automation when the light is late or, conversely, constantly on.

Preparation of equipment and installation of the Mi Home application

The foundation of any Xiaomi automation system is the right application. To control lighting and sensors, you will need the Mi Home utility (or Xiaomi Home depending on the region), which should be downloaded from the official App Store or Google Play stores. It is important to choose the right region in the application settings: if your devices are designed for the Chinese market, the server must be switched to China, otherwise the gadgets may not be determined in the list of available.

After installing and registering the account, you should prepare the devices themselves. The smart light or light bulb should be screwed into the cartridge and turned on through the switch, and the motion sensor is equipped with a fresh battery (usually CR2032). Before adding to the system, make sure that the smartphone is connected to a 2.4 GHz Wi-Fi network, since most smart home devices do not support the 5 GHz standard.

  • 🔋 Check the polarity of the battery in the motion sensor – this is a common mistake when you first start.
  • 📶 Make sure Bluetooth on your smartphone is activated for quick search of devices in the neighborhood.
  • 📍 Place your gadgets next to the router or gateway during the initial setup stage for a stable signal.

⚠️ Note: If you use devices from different ecosystems (e.g. Aqara sensor and Yeelight bulb), make sure they are added to the same region in the Mi Home app, otherwise creating scripts between them will not be available.

The process of adding devices to the application is standard: click on the plus in the upper right corner and select "Add device." The system will automatically start scanning the ether. If the automatic search did not give results, select the device from the list of popular brands or scan. QR-The pairing can take 10 to 60 seconds, at which time the indicator on the device usually flashes.

Connection Types: ZigBee, Bluetooth and Wi-Fi

Understanding the communication protocol is critical to the stability of the sensor-light bundle. Xiaomi devices and sub-brands (Aqara, Yeelight) use three basic standards, each with its own networking and gateway requirements.

ZigBee is an energy-efficient protocol that requires a gateway to connect to the Internet. ZigBee's motion sensors consume minimal power and create a mesh network where each device relays the signal, amplifying the coverage. ZigBee-enabled lights also require a gateway, but provide instantaneous response and operation even when there is no Internet (local scenarios).

Devices that run on Bluetooth Mesh or simply Bluetooth often don’t require a separate gateway if there’s a permanent “network keeper” in the home — like a speaker with Alice or a smartphone with Bluetooth enabled. However, such sensors can have a greater latency when lights are turned on compared to ZigBee. Wi-Fi devices connect directly to the router, without requiring gateways, but consume more power and can overload the wireless network with a large number of gadgets.

📊 What is the communication protocol of your devices?
ZigBee (loose needed)
Bluetooth Mesh
Wi-Fi (no gateway)
I don't know yet.

If you already have an Aqara Gateway or a Xiaomi Smart Home Hub gateway, the most logical way to use ZigBee sensors is to use it. If you don’t have a gateway and you don’t plan to buy it, you should look at Bluetooth Mesh motion sensors that can trigger lights directly or through the cloud, although the functionality will be slightly limited.

ProtocolWe need a lock.Energy consumptionResponse speed
ZigBeeYes (required)Very low.Instant (< 0.5 sec)
Bluetooth MeshNo (needs a keeper)Low.Medium (1-2 sec)
Wi-FiNo.High.Depends on the network.

There can be conflicts or delays when mixing protocols, for example, if a ZigBee motion sensor tries to turn on a Wi-Fi lamp via a cloud server, the delay can be as long as a few seconds, creating a stroboscope effect when entering a room. Local scenarios (ZigBee-to-ZigBee) are always faster and more reliable.

Setup automation through scripts in Mi Home

Once both devices are added to the app, it's time to create a logical link. In the Xiaomi ecosystem, this is done through the Smart tab. Click on the plus to create new automation. The logic of the work is based on the principle of "If... then..." (If... then...).

In the If (Condition) block, select your motion sensor and the Motion Detected event. It is important to set the time slots correctly. Often the default is a re-detection delay, which can interfere. In the To (Action) block, select your luminaire and the Turn on action. You also need to add a shutdown condition, otherwise the light will burn forever.

☑️ Checklist for script settings

Done: 0 / 4

The second scenario or advanced settings of the first one are used to implement the light switching off, and in modern versions of the application you can set the chain: "If movement is not detected within 1 minute, turn off the lights." This is a more stable method than using delay timers, since it is reset with each new movement.

  • 🕒 Set a “No Movement” time of 30 seconds to 2 minutes so that the lights don’t blink if you just freeze in the room.
  • 🌙 Add a time condition (e.g., “Only 20:00 to 07:00”) to prevent the sensor from reacting during the day.
  • 🔁 Use the “Single Run” mode if you need to avoid overlaying commands with frequent movement.

⚠️ Warning: When creating scripts, make sure that the "Enable Auto" switch is active. Often users forget this item, and automation is just hanging on the list, but not executed.

The important thing is to set the conditions (Validity), you can limit the script to certain days of the week or time intervals, for example, in the bathroom, the light on the sensor is only needed at night, and in the daytime, you do not need it, and in this scenario, you add a "Time" or "Sunset / Dawn" item.

Use of Yeelight smart lamps and direct pairing

Special attention should be paid to the smart lamps Yeelight, which have built-in function of working with motion sensors without the need to create complex scenarios in the cloud. Some models support direct pairing with the sensors Xiaomi or Aqara through the menu of the lamp itself. To do this, in the Yeelight or Mi Home application, you need to find the device and select the item “Motion Sensor” or “Flow”.

In Flow mode, you can program the behavior of the lamp: when you receive a signal from the sensor, it will smoothly turn on a given brightness and color, and then, on a timer of no movement, it will gradually go out. This creates a more pleasant visual effect than a sharp turn on through the standard Mi Home scenario. However, this method only works if the lamp and sensor are in the same subnet or have direct communication.

The secret function of Yeelight lamps
Some Yeelight lamps have a hidden pairing mode: quickly turn on and off the switch 5 times, the lamp will go into sensor search mode, which allows you to connect it to old sensors without a gateway in emulation mode.

The advantage of using Yeelight's native features is that it's responsive and independent of the Internet, and it's written into the device's memory, and if the Internet goes down, the automation will continue to work properly, because the commands are transmitted locally within the Wi-Fi or ZigBee network.

When you set up these lamps through the Yeelight app, the interface may be different from the standard Mi Home, where you can fine-tune the brightness of the lights on, the color temperature, and even the scene (like Nightlight or Reading) that is activated when you move, which gives you more flexibility than a simple binary on/off signal.

Problem Solving: Delays and False Positives

The most common problem users have is the delay of lights. A person walks into a room, waves their hands, and the lights only turn on after 2-3 seconds. This often involves putting the sensor to sleep to save energy or delaying the cloud server. For ZigBee sensors, the solution is one thing: using a local gateway and creating local scenarios.

The other extreme is false positives or the sensor's inability to let go of light, which can happen if the sensor is placed opposite a window (reaction to solar glare) or next to heating devices (reaction to heat flows). Infrared sensor (PIR) responds to changes in thermal radiation, so the flow of warm air from the battery can simulate movement.

  • 🔋 Replace the battery if the sensor is unstable – low charge increases network survey intervals.
  • 📡 Reconnect the device to the gateway if it is lost on the network (the indicator flashes red).
  • 🧹 Wipe the sensor lens away from dust, which can distort viewing angle and sensitivity.

⚠️ Attention: Motion sensors based on PIR (Infrared ones don't see through glass and plastic partitions, and if you put it in a closet or behind a decorative panel, it stops working.

If the delay persists, check the load on the gateway. Cheap gateways may not be able to handle multiple commands at once, in which case it helps to reboot the gateway (turn it off for 10 seconds) or update its firmware through the application.

Advanced scripting and integration with other devices

Setting up a light with a motion sensor is just the first step. Xiaomi's ecosystem allows you to create complex chains, for example, when you activate a sensor in the hallway at night, you can not only turn on the lights, but also start a smart socket with a humidifier or send a notification to your phone if you have a motion recorded in your absence.

Use the logic operators "E" and "OR" to fine-tune the scenario, which might look like this: "If (Motion Sensor went off) AND (Time between 23:00 and 06:00) AND (Light level < 5 lux), TO (Enable nightlight at 10%)" This will prevent bright lights from turning on in the middle of the night if you just went to drink water.

💡

Use the light sensor (built into many Xiaomi motion sensors) as an additional condition, which will allow the lamp to turn on only in the dark, saving the lamp life during the day.

Integration with voice assistants is also possible. By setting up a script in Mi Home, you can tie it to Alice or Google Assistant, giving you the ability to voice control the sensor mode (for example, the command “Switch off the sensor in the hallway”). This adds another layer of convenience and control over your smart home system.

💡

The key to stable work is local scripting, and try to make the Sensor > Gateway > Lamp bundle work inside your home network, not the cloud servers for the basic functions.

Why does the motion sensor not see a person in static?
PIR sensors, which are used in most Xiaomi devices, respond only to changes in thermal radiation. If a person enters a room and measures, the sensor will stop recording activity after a while (usually 15-30 seconds) as the thermal picture has stopped changing.
Can I use a regular Xiaomi motion sensor with a different brand lamp?
Yes, this is possible through scripting in the Mi Home app. The main thing is that both devices (sensor and lamp) are added to the same account and region.The lamp can be from any manufacturer that supports the Mi Home protocol or has integration through plugins, but for native work without delay, it is better to use the ecosystem devices.
How to reset the motion sensor if it is not connected?
To reset most Xiaomi/Aqara motion sensors, you need to find a small hole on the body (usually on the side or back). Press it with a paper clip and hold it for 5-10 seconds until the indicator flashes blue.