How to set up Xiaomi motion sensor: from connectivity to automatic scripts

Xiaomi’s motion sensors are among the most popular smart home devices, thanks to their combination of low price, compact size, and wide integration capabilities: Not only can they detect indoor movement, but they can also work in conjunction with lamps, sockets, cameras, and even security systems. However, many users face problems already at the connection stage: the sensor is not detected in the application, falsely works on pets or refuses to work after a few days.

In this article, we’ll look at all the steps of setting up, from unpacking to creating complex automations, and reveal hidden features that aren’t written about in the official instructions. We’ll focus on common bugs (such as why the Mi Motion Sensor 2 sensor stops sending notifications in a week) and how to fix them. If you want the device to work steadily for years, read on.

What models of motion sensors Xiaomi produces

Under the Xiaomi brand and its sub-brand Aqara, several types of motion sensors are produced, differing in terms of operation, detection range and compatibility with ecosystems.

  • πŸ”Ή Mi Motion Sensor 2 - Basic model with infrared sensor, range up to 7 m, viewing angle 170Β°, battery-powered CR2450. It only supports Mi Home.
  • πŸ”Ή Aqara Motion Sensor (HP2500) β€” Improved version with false positive protection on animals, range up to 9 m, compatible with Mi Home, Home Assistant and Apple HomeKit.
  • πŸ”Ή Aqara Motion Sensor P1 β€” Premium model with PoE support (Ethernet power), range up to 12 m, viewing angle 360Β°, perfect for offices.
  • πŸ”Ή Mi Smart Sensor Set – a set of motion sensor + door opening sensor, often sold in a set with the Xiaomi Gateway hub.

For home use, the most common choice is Mi Motion Sensor 2 or Aqara. HP2500. The first is cheaper, but the second is more reliable, and it has a built-in accelerometer that reduces false positives. If you want maximum accuracy (for example, for security), look at Aqara. P1 β€” It is free of the shortcomings of infrared sensors.

πŸ“Š What is the Xiaomi motion sensor you have?
Mi Motion Sensor 2
Aqara Motion Sensor (HP2500)
Aqara P1
Other
I haven't bought it yet.

Important: all Xiaomi motion sensors require a central hub (gateway) to work – for example, Xiaomi Gateway 3 or Aqara Hub M2. Without it, your device won’t be able to transmit data to the network even if you connect it to Mi Home.

What is included in the kit and how to prepare for installation

Before setting up, check the sensor configuration. The box should include:

  • πŸ“¦ The motion sensor itself (usually white or black).
  • πŸ”‹ Battery (e.g., battery, CR2450 Mi Motion Sensor 2).

If something is missing (such as a battery), don’t rush to return the device – sometimes the manufacturer puts spare elements in a box with a hub.

  • πŸ“± Smartphone with Mi Home app installed (or Aqara Home if you have an Aqara sensor).
  • 🌐 Stable Wi-Fi connection (2.4 GHz – mandatory!).
  • πŸ”§ Screwdriver (if you plan to attach the sensor to the screws).
  • πŸ“ Roulette or ruler for measuring the height of the installation.

πŸ’‘

If you already have other Xiaomi devices (like light bulbs or sockets), add a motion sensor to the same Mi Home account – this will make it easier to create automation scenarios.

And critically, Xiaomi's motion sensors don't run directly over Wi-Fi, they use Zigbee or Thread (in the newer models), which means that without a hub, the device will be useless. If you don't already have a gateway, you'll have to buy one, like the Xiaomi Gateway 3 or the Aqara Hub. M1S.

Step-by-step: how to connect the motion sensor to the Mi Home

The connection process takes no more than 5 minutes if done correctly.

  1. Put the battery in the sensor. There's a special slot on the back of the device -- gently slap the lid with your nail or a flat screwdriver. Put the battery in. CR2450 (or other, depending on the model, by the pole "+" upward.
  2. Download and install the Mi Home app (for Android or iOS) sign up or log in to your account.
  3. Connect the Xiaomi Gateway to the socket and wait until it flashes blue. Then add it to Mi Home via the Devices menu. β†’ Add the device β†’ Gateway.
  4. In the app, click + β†’ Add the device β†’ Motion sensor. Select your model from the list.
  5. Press and hold the button on the sensor (usually located on the back) for 5 seconds until you hear an audible signal or see the indicator flashing.
  6. Wait for the app to find the device and follow the further instructions on the screen (usually confirm the add-on and select a room).

Battery installed (polarity "+" upward)

Xiaomi Gateway Connected to Network and Added to Mi Home

Smartphone connected to Wi-Fi 2.4 GHz

Bluetooth enabled on your phone (required to search for devices)

-->

If the sensor is not located, try the following steps:

  • πŸ”„ Reset the gateway (remove the plug from the socket for 10 seconds).
  • πŸ“± Reinstall the Mi Home app.
  • πŸ“Ά Make sure the phone and gateway are on the same Wi-Fi network (2.4 GHz!).
  • πŸ”‹ Check the battery – sometimes it’s discharged out of the box".
What if the sensor is connected but does not respond to movement?
The problem is probably the location of the device. Xiaomi sensors are sensitive to: - Direct sunlight (infrared sensor goes blind). - Heat sources (batteries, heaters) - they cause interference. - Too high installation (optimally 2-2.5 m from the floor). Try to move the sensor to another place and check the reaction in the application in real time.

Optimal placement of the sensor: where and how to fasten

The place of installation determines 80% of the efficiency of the sensor, and if you hang it up incorrectly, the device will either ignore the movement or fire on pets.

  • βœ… Height: 2-2.5 meters from the floor (at the level of the door jamb). If you hang above, the angle of view will narrow.
  • βœ… Inclination angle: the sensor should "look" down at an angle of 15-30Β° (not strictly parallel to the floor!).
  • βœ… Distance from obstacles: no closer than 1 meter from walls, furniture or curtains.
  • ❌ Avoid: Direct sunlight, air conditioners, fans and heating appliances.

Use double-sided tape (comes with it) or screws to mount the mount, and if the wall is uneven, you'd better choose screws, the sensor won't move.

The premisesRecommended seatPurpose of use
The hallwayAngle opposite the front door (2.2 m from the floor)Turning on the light at the entrance, notification of movement
corridorCeiling in the middle of the corridor (if length) < 5 m m)Automatic lighting at night
Living roomAbove the TV or at the entrance to the roomActivity control, switching on a smart socket
Bedroom.Over the door (but not over the bed!)Nightlight, night traffic alert

Professional Lifehack: If you have pets, set the Aqara Motion Sensor to 1.5m high and tilt it down at a 45-angleΒ°. This model has a function to ignore small objects (up to 10 kg), but it works only when properly placed.

πŸ’‘

Xiaomi sensors are not designed for outdoor use – they don’t have moisture protection (IP-rating IP42). When installing on a balcony or veranda, use a sealed casing.

Set up sensitivity and other parameters in Mi Home

Once connected, the sensor will work with default settings that are not always optimal, such as the standard 30 seconds delay, which is too long for the hallway, but not enough for the bedroom, to change the settings:

  1. Open the Mi Home app and select your motion sensor.
  2. Click on the three dots in the upper right corner β†’ Device settings.
  3. Here are the following parameters available: πŸ•’ Delayed response (5 to 300 seconds) – the time during which the sensor will not respond to repeated movement. πŸ“Š Sensitivity (low/medium/high) – at the maximum level, the sensor will fire even for small movements (for example, a wobbly curtain). πŸ”” Notifications – Enabling/disabling push messages when motion is detected. πŸŒ™ Night mode – the sensor will be active only in the dark (determined by time or illumination).

Recommended settings for different scenarios:

  • πŸšͺ Corridor/ hallway: sensitivity - medium, delay - 10 seconds.
  • πŸ›‹οΈ Living room: low sensitivity (so as not to react to the TV), latency - 60 seconds.
  • πŸ›οΈ Bedroom: sensitivity – high, delay – 300 seconds (so as not to wake up at night), night mode – on.

πŸ’‘

If the sensor is too often triggered for no reason, try to reduce the sensitivity and move it away from the heat sources. 90% of the time, false positives are due to improper placement.

Some Mi Home firmware has hidden settings that don't appear in the main menu.

  1. Go to the sensor settings.
  2. 5 times quickly click on the field with the firmware version.
  3. There will be a menu Additional settings where you can configure:

Creating Automations: Communication with lamps, sockets and other devices

The most useful feature of the motion sensor is the ability to start other smart home devices, such as setting up the automatic lights on in the hallway when someone walks in, or sending a notification to your phone if the sensor is working at night. Consider two ways to create automation: through Mi Home and through Home Assistant (for advanced users).

Method 1: Automation in Mi Home (Simple)

  1. Open Mi Home β†’ Go to the Automation tab (badge) βš™οΈ down).
  2. Click + β†’ Create automation.
  3. Choose If β†’ Motion sensor β†’ Traffic detected.
  4. Click Add Condition (optional). For example, you can specify the time (from 18:00 to 07:00) or the level of illumination (If it is dark).
  5. Choose To. β†’ Add a device (such as a smart lamp) β†’ Turn on).
  6. Save the automation and test it.

Examples of useful scenarios:

  • πŸ’‘ Night in the corridor: If traffic + darkly β†’ light up the lamp at 20% brightness.
  • 🚨 Security system: If traffic + No one's home. β†’ activate the siren and send a notification.
  • β˜• Smart coffee maker: if the movement in the kitchen from 6:00 to 9:00 β†’ plug in.

Method 2: Automation in Home Assistant (Advanced)

If you use Home Assistant, the automation capabilities are multiplied, such as:

  • Delaying the lights off depending on the time of day.
  • Ignoring movement if no one is home (by geolocation).
  • Integration with cameras (recording video when triggered).

Example of code for automations.yaml:

"Corridor: Light by Movement at Night"


trigger:




- platform: state




entity_id: binary_sensor.motion_sensor_158d0001234567




to: "on"




condition:




- condition: sun




after: sunset




before: sunrise




action:




- service: light.turn_on




target:




entity_id: light.corridor_light




data:




brightness_pct: 30




- delay: "00:01:00" # in 1 minute turn off




- service: light.turn_off




target:




entity_id: light.corridor_light

πŸ’‘

In Home Assistant, you can use templates to adjust flexibly, such as turning on the lights only if the last movement was more than 5 minutes ago to avoid flashing lamps.

Typical problems and their solutions

Even when set up properly, Xiaomi’s motion sensors can be unstable, and here are the most common problems and ways to fix them:

Problem.Possible causeDecision
Sensor's not responding to movementLow battery charge, wrong installation angleReplace the battery, check the location (height 2-2.5 m)
False positivesHigh sensitivity, interference from animals or a fanReduce sensitivity, move the sensor away from heat sources
The sensor shuts down in a few days.Zigbee communication issues (too far from the hub)Move the hub closer or add a Zigbee repetitor (like a smart lamp)
No notifications coming.Push disabled in Mi Home or phone settingsCheck permissions for the application, enable notifications for the sensor
The sensor flashes red, but does not connectFirmware failure or conflict with the hubReset the sensor (press the button for 10 seconds), reconnect

A special case: if the sensor stopped working after updating the firmware hub, try rolling back the software version.

  1. At Mi Home, go to the hub settings.
  2. Find the Firmware Update item β†’ Versions.
  3. Select the previous stable version and wait for the rollback.
What if the sensor is β€œhang” and does not respond to reset?
In some cases, hard reset helps: 1. Remove the battery. 2. Press and hold the button on the sensor for 15 seconds. 3. insert the battery back. 4. Connect the sensor again through Mi Home. If this does not help, contact Xiaomi (possibly defective Zigbee module).

Attention! ⚠️ If you use a sensor in a security system (for example, for intrusion alerts), don’t rely on it alone. Xiaomi motion sensors are not designed for professional security systems – they can give false positives or β€œfall asleep” in prolonged inactivity. For reliable protection, combine them with door opening sensors and cameras.

FAQ: Frequent questions about Xiaomi motion sensors

Can I use Xiaomi’s motion sensor without a hub?
No, all Xiaomi and Aqara sensors are Zigbee or Thread, so they definitely need a gateway (hub) to communicate with the phone and other devices.Without a hub, the sensor will just blink when motion is detected, but will not be able to send notifications or control lamps.
How to increase the range of the sensor?
To improve communication, move the hub closer to the sensor (maximum distance of 10-15 m in line of sight). Add a Zigbee repeater (such as a Xiaomi smart lamp or outlet); remove obstacles (metal, concrete walls weaken the signal); If the sensor is at the edge of the coverage area, it can periodically fall off the network.
How long does the battery in the sensor last?
Battery life depends on model and frequency of operation: Mi Motion Sensor 2: 1-1.5 years (CR2450). Aqara Motion Sensor: 2–3 years (battery) CR2450 or CR2477). Aqara P1: No battery (PoE powered) To extend the life of the battery, reduce the sensitivity of the sensor and increase the delay of the operation.
Can I connect the Xiaomi sensor to the Apple HomeKit?
Yes, but only Aqara models (like the Aqara Motion Sensor) HP2500). To do this: Connect the sensor to the Aqara hub (e.g. Hub) M2). In the Aqara Home app, go to the hub settings. Select Add to HomeKit and scan. QR-Normal Mi Motion Sensors do not support HomeKit.
How to reset the motion sensor to factory settings?
To reset the sensor: Remove the battery. Press and hold the button on the back for 10-15 seconds (until the indicator flashes). Put the battery back in. After the reset, the sensor will be ready to reconnect to the Mi Home.