Xiaomi motion sensor integration in Home Assistant: a complete guide from model selection to automation setup

Xiaomi’s motion sensors (including its Aqara sub-brand) have long been the de facto standard for low-end smart home systems, thanks to a combination of low-price, compact size, and stable performance. But their connection to Home Assistant, an open automation platform, often raises questions for beginners. Unlike proprietary ecosystems like Mi Home or Apple HomeKit, there is no magic button, but there are limitless customization possibilities.

In this article, we will analyze all the current methods of integration: from the classic connection through the Xiaomi Gateway to direct connection via Zigbee using the use of the new system. Zigbee2MQTT or ZHA. We will pay special attention to common errors, for example, why the sensor may not be detected in the network after updating Home Assistant 2026.6 firmware.+ And you'll find ready-made examples of automation (lights on, notifications sent) and a comparison table of compatibility between sensor models with different protocols.

If you are just starting out with Home Assistant, don’t be intimidated by terms like YAML-configuration MQTT-We're going to explain it in simple terms, and for advanced users, we've prepared advanced life hacks, like how to get around the limit on the number of connected devices to one coordinator. CC2531 How to get the sensor to send data more than the standard 60 seconds.

1.What motion sensors are Xiaomi compatible with Home Assistant?

Not all Xiaomi devices are equally useful for integration, and the main criterion is the communication protocol, and in 2026, three types of sensors are relevant:

  • πŸ”Ή Zigbee: The most reliable and energy efficient, run through a coordinator (gateway or gateway) USB-Examples: Aqara FP1, Mi Motion Sensor 2 (model) RTCGQ11LM).
  • πŸ“Ά Wi-Fi: Connect directly to the router, but consume more power. Example: Xiaomi Mi Motion Sensor (Wi-Fi version) is a rarity, usually found in smart home kits.
  • πŸ”„ Bluetooth LE: Requires a constant connection to the hub (e.g. Xiaomi Gateway 3). FP2 (Hybrid sensor with Thread support).

For Home Assistant, Zigbee sensors are the best choice. They are independent of Xiaomi cloud, run locally and are supported by most integrations. Here are the key models with their features:

ModelProtocolRange, m.Viewing angleFeatures
Aqara FP1Zigbee 3.010120Β°HomeKit support, low power consumption
Mi Motion Sensor 2 (RTCGQ11LM)Zigbee7170Β°Budget, no support for HomeKit
Aqara FP2Bluetooth LE / Thread15140Β°Hybrid, requires Gateway 3 or HomePod Mini
Xiaomi Mi Home Motion Sensor (Wi-Fi)Wi-Fi 2.4 GHz10110Β°Rare model, dependent on cloud

Important! Bluetooth sensors. LE (for example, Aqara FP2) You can only connect to Home Assistant via Xiaomi Gateway 3 with Alternative Firmware firmware (such as OpenMQTTGateway.

⚠️ Warning: If you buy a sensor from AliExpress or other sites, check the region of the device (CN) The system may not work with European/US gateways due to differences in Zigbee radio frequencies.

πŸ“Š What protocol do you prefer for a smart home?
Zigbee
Wi-Fi
Bluetooth LE
Thread
I don't know.

2.How to connect Xiaomi sensor to Home Assistant

The choice of integration method depends on the protocol of your sensor and the available equipment.

2.1 via Xiaomi Gateway (Mi Home Gateway)

The easiest way, but with limitations. The Xiaomi Gateway (of any version) connects to the Home Assistant through the official Xiaomi Miio integration.

  • πŸ”΄ Data passes through the Xiaomi cloud (1-3 seconds delay).
  • πŸ”΄ Not all sensor models are supported (e.g. Aqara) FP2 It will not work without an alternative firmware).
  • 🟒 Plus: you don’t need to set up Zigbee-network separately.

Instructions:

  1. Add the gateway to the Mi Home app and tie the sensor.
  2. In Home Assistant, go to Settings β†’ Devices and Services β†’ Add Integration.
  3. Select Xiaomi Miio, enter the username / password from the Xiaomi account.
  4. After synchronization, the sensor will appear in the list of devices.

2.2 Direct connection via Zigbee (ZHA or Zigbee2MQTT)

Optimal for local work without cloud. requires a Zigbee coordinator (e.g. Sonoff ZBDongle-E, CC2531 or ConBee II).

Steps for Zigbee2MQTT:

  1. Install the addon Zigbee2MQTT Home Assistant through Settings β†’ Supplements.
  2. Connect the Zigbee adapter to the Raspberry Pi or another device with Home Assistant.
  3. In the configuration file configuration.yaml add: zigbee2mqtt: data_path: /share/zigbee2mqtt devices: devices.yaml mqtt: base_topic: zigbee2mqtt server: mqtt://core-mosquitto
  4. Put the sensor in pairing mode (usually hold the button for 5-10 seconds until the blue LED flashes).
  5. In the web interface Zigbee2MQTT Press Permit Join and wait for the device to appear.

Steps for ZHA (built-in integration):

  1. Go to Settings. β†’ Devices and services β†’ Add integration β†’ Zigbee Home Automation.
  2. Select the port of your Zigbee adapter (for example, /dev/ttyACM0).
  3. Activate the pairing mode on the sensor and wait for its detection.

Update the coordinator’s firmware (for example, for CC2531 Use the Z-Stack 3.x.0)

Check the power of the sensor (the battery must be charged) >50%)

Make sure the distance to the coordinator is less than 10 meters.

Disable other Zigbee devices while pairing (to avoid conflict)-->

2.3 Through MQTT (for advanced users)

If you use Zigbee2MQTT OpenMQTTGateway, the sensor data will be transmitted over the protocol. MQTT. This allows for flexible handling of events.

Example of a Topics for Aqara FP1:

zigbee2mqtt/[FRIENDLY_NAME]


{




occupancy: true, // movement detected




Linkquality: 100, // quality of communication




Battery: 85// Battery level




}

To use this data in automation, create MQTT-sensor in configuration.yaml:

sensor:


- platform: mqtt




name: "Kitchen motion sensor"




state_topic: "zigbee2mqtt/kitchen_motion/occupancy"




value_template: "{{ value_json.occupancy }}"

2.4 Alternative methods

For rare models (for example, Wi-Fi sensors) you can use:

  • πŸ”Œ ESPHome: Sensor firmware based ESP8266/ESP32 Wi-Fi-based.
  • πŸ–₯️ Home Assistant Cloud: Through Cloud Webhook (not recommended due to delays).

πŸ’‘

If the sensor is not detected in Zigbee2MQTT, Try resetting it to factory settings: hold the button for 20 seconds until the LED blinks quickly (3 times).

3. Set up automations with motion sensor

Once the sensor is successfully connected, it can be used in scenarios, and let's look at two popular examples: light control and notification.

Lighting when driving

Create automation in the Home Assistant:

  1. Go to Settings. β†’ Automation β†’ Create automation.
  2. Select the trigger: Device β†’ [Your sensor] β†’ Movement detected.
  3. Add a condition (optional): for example, time β†’ 18:00 to 23:00.
  4. Add action: Device β†’ [Your lamp] β†’ Turn on.
  5. Set up a shutdown delay (for example, 2 minutes after the last movement).

Example YAML-code for automations.yaml:

alias: "Light in the corridor by traffic"


trigger:




- platform: state




entity_id: binary_sensor.kitchen_motion_occupancy




to: "on"




action:




- service: light.turn_on




target:




entity_id: light.corridor_lamp




- delay: "00:02:00" #2 minutes




- service: light.turn_off




target:




entity_id: light.corridor_lamp

3.2 Notifications in Telegram when motion is detected

This requires a pre-setting Telegram bot in Home Assistant.

  1. Install Telegram integration through HACS manually.
  2. Create automation with a trigger from the sensor.
  3. Add the Call of Service action β†’ Telegram bot: send_message.
  4. Include the text of the notification, for example: Movement detected in {{ trigger.to_state.attributes.friendly_name }}! Time: {{now().strftime("%H:%M") }}
How to reduce the number of false positives?
Use the "I" condition with a light sensor (e.g., Aqara Light Sensor) so that the lights are turned on only during the dark. FP1/FP2 You can use their proprietary app, "Sensitivity," and you can put the sensor up. 2–2.5 Meter – this reduces the response from pets.

3.3 Advanced scenarios

A few ideas for automation:

  • πŸŽ₯ Camera recording: When driving in the entrance, turn on the recording on Xiaomi Camera and save the video in the camera NAS.
  • πŸ”Š Audible Alert: Play voice messages through Google Assistant or Sonos.
  • 🌑️ Climate Control: Turn on the fan when driving in the genre with temperatures above 25Β°C.

⚠️ Note: If the motion sensor is triggered too often (for example, due to drafts), add the delay between reruns condition to the automation (cooldown parameter in the system). YAML). This will prevent the rattles of light.

4. Solving common problems

Even with the right setup, errors can occur, and here are the most common ways to fix them:

Problem.Possible causeDecision
The sensor is not detected when pairingZigbee weak signal, channel conflict with Wi-FiChange the Zigbee channel in the coordinator settings (e.g. 11 to 20)
The sensor shuts down in a few hours.Sleepy device or discharged batteryReplace your battery with a new one (Energizer Lithium recommended)
Delayed response >5 secondsCloud integration (Xiaomi Miio) or congested MQTT-brokerGo to local connection (ZHA or Zigbee2MQTT)
The sensor shows unavailableLoss of contact with the coordinator or configuration errorRestart the Zigbee adapter and check logs for errors

Diagnosis through logs:

If the sensor is not working, check the logs. Zigbee2MQTT or ZHA:

  1. In Home Assistant, go to Settings β†’ System system β†’ Magazines.
  2. Filter your posts by keywords: zigbee, join, failed.
  3. Note errors like β€œDevice interview failed” that indicate compatibility issues.

Example of a log with a successful connection:

INFO: Zigbee2MQTT:device_joined


{




"friendly_name": "hallway_motion",




"ieee_address": "0x123456789abcdef0",




"model": "RTCGQ11LM"




}

If the logs have the line "No network key received", the coordinator does not issue the network key.

  1. Re-question the coordinator (for example, CC2531 The latest version of Z-Stack).
  2. Make sure that in the settings Zigbee2MQTT switched on permit_join: true.

πŸ’‘

If the Aqara sensor FP1 not defined Zigbee2MQTT, Try adding it manually through the device.yaml file with model indication: "lumi.motion.ac02".

5. Optimization of the sensor

To ensure that the sensor works stably and economically consumes the battery, follow these recommendations:

Sensor settings

Many sensors Xiaomi/Aqara You can change the settings through Zigbee commands, for example, for Mi Motion Sensor. 2 (RTCGQ11LM) tune in:

  • πŸ•’ Data sending interval (default: 60 seconds).
  • πŸ”‹ Response threshold (sensitivity).
  • πŸ“‘ Transmission power (to increase range).

Example of a command to change the survey interval (through Zigbee2MQTT):

topic: zigbee2mqtt/[FRIENDLY_NAME]/set


payload:




{




"reporting_interval": 30 // seconds




}

Extension of battery life

Standard battery. CR2450 Xiaomi's sensors last 1-2 years to extend its life:

  • ⚑ Use Lithium batteries (e.g. Panasonic) CR2450L).
  • πŸ“‰ Reduce the survey interval to 120-180 seconds (unless you need high accuracy).
  • πŸ›‘ Turn off unnecessary attributes (such as temperature if the sensor is used only for movement).

To disable sending temperature to Aqara FP1:

topic: zigbee2mqtt/[FRIENDLY_NAME]/set


payload:




{




"temperature_reporting": false




}

5.3 Improved stability of the Zigbee network

Zigbee is sensitive to interference, and the following steps will help avoid problems:

  • πŸ“Ά Place the coordinator (Sonoff ZBDongle, ConBee) in the center of the house, away from the Wi-Fi router.
  • πŸ”Œ Use Zigbee repeaters (e.g. Aqara Wall Switch or Aqara Wall Switch) IKEA Tradfri).
  • πŸ“Š Set up a separate Zigbee channel (such as 20 or 25) that doesn’t overlap with Wi-Fi.

Check the quality of the connection through the linkquality attribute in Zigbee2MQTT:

  • linkquality > 80: Excellent signal.
  • 50–80: Acceptable, but delays are possible.
  • < 50: Critically low level - repeater required.

6. Alternative firmware and customization

For experienced users, there are ways to expand the functionality of Xiaomi sensors:

6.1 Tasmota firmware on ESP8266

If you have a Wi-Fi motion sensor (for example, on the base). ESP8266), It can be flashed by Tasmota's alternative firmware to work without the cloud:

  • πŸ”§ Complete control over the logic of the work.
  • πŸ“ˆ Sending data directly to MQTT.
  • πŸ› οΈ Possibility of modifying the code to your needs.

Instructions:

  1. Connect the sensor to the computer through USB-TTL adapter.
  2. Download the firmware Tasmota with support for motion sensor (tasmota-sensors.bin).
  3. Please contact us via esptool: esptool.py --port /dev/ttyUSB0 write_flash 0x0 tasmota-sensors.bin
  4. Set up. MQTT in the Tasmota web interface.

6.2 Modification of Zigbee sensors

Some users are modifying Aqara sensors to:

  • πŸ”‹ Replacement of the battery with a charging battery USB-C.
  • πŸ“‘ Installation of an external antenna to increase the range.
  • 🎨 Repainting the body for the interior.

⚠️ Warning: Sensor modifications take away warranty and may cause failure!, for example, soldering to Aqara battery contacts FP1 You can easily damage the power chip. Use a soldering iron with a temperature not higher than 300.°C and flux no-clean.

Integration with other systems

Xiaomi sensors can be used not only in Home Assistant, but also in:

  • 🍎 Apple HomeKit: via HomeKit Bridge integration or HOOBS.
  • πŸ€– Google Home: via Nabu Casa cloud service or local Google Assistant SDK.
  • 🌐 OpenHAB: via MQTT-binding or Zigbee-binding.

Example of HomeKit Bridge configuration in configuration.yaml:

homekit:


- name: HomeKit Bridge




port: 51827




filter:




include_entities:




- binary_sensor.hallway_motion




- light.corridor_lamp

7.Comparison with sensors from other brands

Sensors. Xiaomi/Aqara β€” It's not the only option for Home Assistant:

Brand/ModelProtocolPrice, β‚½PlusesCons
Aqara FP1Zigbee 3.01 500–2 000Compact, low power consumption, support for HomeKitSmall angle of view (120)Β°), no adjustment of sensitivity
Philips Hue MotionZigbee4 000–5 000High accuracy, sensitivity zone setting, Thread supportHoney, demands Hue Bridge hub
IKEA Motion SensorZigbee1 000–1 300Cheap, compatible with TrΓ₯dfri Home Assistant and Home AssistantLow build quality, frequent false positives
Shelly MotionWi-Fi2 500–3 000Local work without cloud, support MQTTHigh energy consumption, requires a power outlet

Conclusion: Sensors Xiaomi/Aqara They're better at price/quality, but they're less than Philips Hue in accuracy and Shelly in flexibility.

πŸ’‘

If you want maximum reliability, combine sensors: for example, Aqara. FP1 for corridor (cheap, compact) and Philips Hue Motion for living room (precise, with zone settings).

FAQ: Frequent questions about Xiaomi sensors in Home Assistant

πŸ”Ή Why Xiaomi’s motion sensor works on pets?
Sensors. Xiaomi/Aqara use PIR-A sensor that responds to changes in infrared radiation: medium-sized cats and dogs (weighted from the surface of the body) 10 Solutions: Hang the sensor above (2.5–3 This will reduce the angle of view for animals. Use sensors with sensitivity settings (for example, Aqara). FP2). Add to the automation the condition by weight: if the movement is fixed, but the temperature change in the sensor area is minimal (less than the temperature). 0.5Β°C), ignore the event.
πŸ”Ή How to update the firmware of the Xiaomi sensor?
Xiaomi does not officially provide tools for manual firmware updates