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:
| Model | Protocol | Range, m. | Viewing angle | Features |
|---|---|---|---|---|
| Aqara FP1 | Zigbee 3.0 | 10 | 120Β° | HomeKit support, low power consumption |
| Mi Motion Sensor 2 (RTCGQ11LM) | Zigbee | 7 | 170Β° | Budget, no support for HomeKit |
| Aqara FP2 | Bluetooth LE / Thread | 15 | 140Β° | Hybrid, requires Gateway 3 or HomePod Mini |
| Xiaomi Mi Home Motion Sensor (Wi-Fi) | Wi-Fi 2.4 GHz | 10 | 110Β° | 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.
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:
- Add the gateway to the Mi Home app and tie the sensor.
- In Home Assistant, go to Settings β Devices and Services β Add Integration.
- Select Xiaomi Miio, enter the username / password from the Xiaomi account.
- 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:
- Install the addon Zigbee2MQTT Home Assistant through Settings β Supplements.
- Connect the Zigbee adapter to the Raspberry Pi or another device with Home Assistant.
- In the configuration file configuration.yaml add: zigbee2mqtt: data_path: /share/zigbee2mqtt devices: devices.yaml mqtt: base_topic: zigbee2mqtt server: mqtt://core-mosquitto
- Put the sensor in pairing mode (usually hold the button for 5-10 seconds until the blue LED flashes).
- In the web interface Zigbee2MQTT Press Permit Join and wait for the device to appear.
Steps for ZHA (built-in integration):
- Go to Settings. β Devices and services β Add integration β Zigbee Home Automation.
- Select the port of your Zigbee adapter (for example, /dev/ttyACM0).
- 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:
- Go to Settings. β Automation β Create automation.
- Select the trigger: Device β [Your sensor] β Movement detected.
- Add a condition (optional): for example, time β 18:00 to 23:00.
- Add action: Device β [Your lamp] β Turn on.
- 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_lamp3.2 Notifications in Telegram when motion is detected
This requires a pre-setting Telegram bot in Home Assistant.
- Install Telegram integration through HACS manually.
- Create automation with a trigger from the sensor.
- Add the Call of Service action β Telegram bot: send_message.
- 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?
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 cause | Decision |
|---|---|---|
| The sensor is not detected when pairing | Zigbee weak signal, channel conflict with Wi-Fi | Change the Zigbee channel in the coordinator settings (e.g. 11 to 20) |
| The sensor shuts down in a few hours. | Sleepy device or discharged battery | Replace your battery with a new one (Energizer Lithium recommended) |
| Delayed response >5 seconds | Cloud integration (Xiaomi Miio) or congested MQTT-broker | Go to local connection (ZHA or Zigbee2MQTT) |
| The sensor shows unavailable | Loss of contact with the coordinator or configuration error | Restart the Zigbee adapter and check logs for errors |
Diagnosis through logs:
If the sensor is not working, check the logs. Zigbee2MQTT or ZHA:
- In Home Assistant, go to Settings β System system β Magazines.
- Filter your posts by keywords: zigbee, join, failed.
- 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.
- Re-question the coordinator (for example, CC2531 The latest version of Z-Stack).
- 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:
- Connect the sensor to the computer through USB-TTL adapter.
- Download the firmware Tasmota with support for motion sensor (tasmota-sensors.bin).
- Please contact us via esptool: esptool.py --port /dev/ttyUSB0 write_flash 0x0 tasmota-sensors.bin
- 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_lamp7.Comparison with sensors from other brands
Sensors. Xiaomi/Aqara β It's not the only option for Home Assistant:
| Brand/Model | Protocol | Price, β½ | Pluses | Cons |
|---|---|---|---|---|
| Aqara FP1 | Zigbee 3.0 | 1 500β2 000 | Compact, low power consumption, support for HomeKit | Small angle of view (120)Β°), no adjustment of sensitivity |
| Philips Hue Motion | Zigbee | 4 000β5 000 | High accuracy, sensitivity zone setting, Thread support | Honey, demands Hue Bridge hub |
| IKEA Motion Sensor | Zigbee | 1 000β1 300 | Cheap, compatible with TrΓ₯dfri Home Assistant and Home Assistant | Low build quality, frequent false positives |
| Shelly Motion | Wi-Fi | 2 500β3 000 | Local work without cloud, support MQTT | High 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).