Xiaomiβs temperature sensors have become an integral part of smart homes due to their accuracy, compactness and affordable price, but many users have difficulty connecting them to the gateway via Bluetooth Low Energy (BLE). Unlike traditional Zigbee connectivity, BLE requires a special approach: here it is important not only the correct settings, but also the compatibility of devices, the firmware version and even the distance between gadgets.
In this article, we'll look at the whole process, from checking the compatibility of the sensor and the gateway to configuring automation in the Mi Home or Home Assistant, and focus on the typical errors that make the sensor undetectable, from outdated software to conflicts with other Bluetooth devices, and if you've tried to connect, but you see a message in the application saying "Device not found" or "Can't be added," here you'll find solutions.
Important: the instruction is relevant for the Mijia Bluetooth Temperature and Humidity Sensor series (models) LYWSD03MMC, LYWSD02, MHO-C301 and similar), as well as for gateways Xiaomi Gateway 3, Aqara Hub M2 and other supportive BLE. If your gateway only works on Zigbee, connect via BLE It will be impossible β an additional hub will be required.
1. Verification of the compatibility of the sensor and the gateway
Before you start connecting, make sure your sensor and gateway support BLE-Not all Xiaomi models work on this protocol: for example, old sensors. WSDCGQ01LM They only use Zigbee and will not be suitable for this instruction.
Here is a list of compatible devices:
- πΉ Temperature sensors: LYWSD03MMC (most popular), LYWSD02, MHO-C301, MHO-C401 (with display), ClearGrass CGDN1 (clone from AliExpress).
- πΉ Gateways with support BLE: Xiaomi Gateway 3, Aqara Hub M2, Aqara Camera Hub G2H/G3, Mi Smart Multimode Gateway.
- πΉ Alternative hubs: Home Assistant with Bluetooth adapter (e.g., Home Assistant, CC2652), Zigbee2MQTT s BLE-plug-in.
If your gateway doesn't support BLE, But you have an Android smartphone or a Raspberry Pi, and you can use it as a middle ground, and for example, the Home Assistant app lets you read data from the sensor through your phone and send it to your smart home system.
2. Preparation of devices for connection
Before you start setting up, follow the following steps:
Update the lock firmware to the latest version
Make sure the sensor is charged (if battery-operated)
Disable other Bluetooth devices within a 5-meter radius
Reboot the gateway and smartphone
-->
Pay particular attention to the gateway firmware. Outdated versions often don't support new sensors. For example, for Xiaomi Gateway. 3 minimum version required β 1.5.6_0036. You can check it in the Mi Home app:
- Open Mi Home β select your gateway.
- Go to Settings β About the device β The firmware version.
- If the version is outdated, update it through the Firmware Update menu.
Also check the battery power of the sensor. If the level is below 20%, the connection may be interrupted (LYWSD03MMC) Use high-quality power cells (e.g. Duracell or Energizer (MHO-C401) charge to 100%.
π‘
If the sensor doesn't turn on, try removing the battery for 10 seconds, then inserting it back in, which will reset its settings and often helps with connection problems.
3. Step-by-step instructions for connecting through BLE
Now, to the process itself, we're going to look at two options: through the official Mi Home app and through the Home Assistant (for advanced users).
Method 1: Connecting through Mi Home
This method is suitable for most users. Follow the instructions:
- Open the Mi Home app and make sure you are in the same region as your account (e.g., Russia or Mainland China).
- Press. + β Add the device β Temperature and humidity sensor.
- Select your sensor model (e.g. Mijia Bluetooth Temperature and Humidity Sensor).
- Click Next and wait until the app starts searching for devices.
- When the sensor appears in the list, click on it. If they request confirmation, hold the button on the sensor (if any) for 5 seconds.
- Once connected successfully, the sensor will appear in the main menu, and now it can be attached to the gateway.
To tie the sensor to the gateway:
- In the main Mi Home menu, click on the gateway.
- Go to Settings. β Connected devices β Add the device.
- Select your sensor from the list. If it's not there, update the list or reboot the gateway.
Method 2: Connecting with Home Assistant
If you use Home Assistant, it's a little bit more complicated, but it's a little more flexible.
- π± Bluetooth adapter on the gateway (e.g. built-in in the Raspberry Pi 4 or external) CSR 4.0).
- π§ Installed Bluetooth in Home Assistant Configuration.
- π¦ Xiaomi integration BLE (set up HACS).
Add the following lines to the configuration.yaml file:
bluetooth:
devices:
hci0# or other interface, check via hciconfig command
xiaomi_ble:
devices:
- mac: "XX:XX:XX:XX:XX:XX" # MAC- address of your sensor
bindkey: "your_bind_key" #Basic Key (optional)
temperature_precision: 1
humidity_precision: 1To find MAC-Sensor address, use command:
sudo hcitool lescanOnce the Home Assistant is rebooted, the sensor will appear on the device list, and it can be used in automation and dashboards.
How to get a bindkey for a sensor?
4. Typical errors and their solutions
Even if you follow the instructions correctly, the connection may fail, and let's look at some of the most common problems and how to fix them.
| Mistake. | Possible cause | Decision |
|---|---|---|
| Sensor not found in search | Weak signal. BLE, interference from other devices | Bring the sensor closer to the gateway (maximum) 1-2 Meter), disable other Bluetooth devices |
| The connection is cut off in a few seconds. | Low battery charge or outdated firmware | Charge/replace the battery, update the lock and sensor firmware |
| The sensor connects but does not transmit data. | Mi Home is not in the right region or there is no bindkey | Change region to Mainland China, check Home Assistant settings |
| Error "The device is already tethered" | The sensor was previously connected to another account. | Reset the sensor to factory settings (hold the button) 10-15 seconds) |
Critical feature of sensors LYWSD03MMC: They only support one active person at a time. BLE-So that means that if the sensor is already connected to the smartphone, the gateway won't be able to connect to it!
π‘
If the sensor is not detected, try using an alternative app like Aqara Home or Yeelight. BLE-devices than Mi Home.
5. Setup of automations with temperature sensor
Once connected successfully, the sensor can be used to create smart home scenarios, such as:
- π₯ Smart heating: turn on the heater if the temperature has dropped below 20Β°C.
- βοΈ Control of the air conditioner: turn it off when a comfortable temperature is reached.
- π§ Moisture alert: Send a notification if the humidity exceeds 70% (mould risk).
- πͺ Safety: turn on ventilation if the temperature in the room with server equipment exceeds 25Β°C.
Example of automation in Mi Home:
- Open the Automation tab β Create β Smart scene.
- Select the condition: Temperature [your sensor] < 20Β°C.
- Add the action: Turn on [heater].
- Save the script and activate it.
In Home Assistant, a similar scenario is created through YAML:
automation:
- alias: βLow temperature heatingβ
trigger:
platform: numeric_state
entity_id: sensor.temperature_lywsd03mmc
below: 20
action:
service: switch.turn_on
target:
entity_id: switch.heaterFor more complex scenarios, you can use conditional operators, such as turning on the heat only at certain times of the day or if there are people in the room (according to the motion sensor).
6. Alternative ways of connecting (if) BLE doesn't work)
If your gateway doesn't support BLE or the connection is constantly broken, there are workarounds:
Option 1: Use of the Zigbee bridge
Some sensors (e.g, LYWSD03MMC) You can flash it with an alternative firmware, you can add Zigbee support:
- π§ Programmer CC2531 or CC Debugger.
- π» Custom Firmware for Firmware LYWSD03MMC (available on GitHub).
- π Sales for connecting to sensor contacts.
Once firmware is in place, the sensor will run through Zigbee and connect to any Xiaomi or Aqara gateway.
Option 2: Connecting via smartphone as an intermediate link
If you don't have a gateway with BLE, But there is an Android smartphone, you can use it to transfer data:
- Install the Home Assistant app on your phone.
- Enable Permanent Bluetooth Scanning in the settings.
- Set up Mobile App integration to transfer data from phone to server.
The disadvantage of this method is that the phone must always be near the sensor.
Option 3: Purchase of a specialized hub
If you plan to deploy a large smart home system, consider buying support hubs. BLE:
- π Aqara Hub M2 β It supports up to 128 devices, including BLE.
- π Home Assistant Green β a ready-made solution with Bluetooth and Zigbee.
- π Sonoff Zigbee 3.0 USB Dongle Plus is a budget option for Home Assistant.
7. Optimization of the sensor: tips for placement and setting
To ensure that the sensor is stable and transmits accurate data, follow these recommendations:
Set the sensor up at altitude. 1-1.5 floor-foot
Avoid direct sunlight and heat sources (batteries, cookstoves)
Place away from metal surfaces (they shield the signal) BLE)
Check the sensor calibration once in a while. 3-6 months
-->
The frequency of data update depends on the sensor model:
- π LYWSD03MMC: Updates data every 10 minutes (can be changed by firmware).
- π MHO-C401: Updates every 2 minutes, but drains the battery faster.
- π ClearGrass CGDN1: interval is adjusted from 1 to 60 minutes.
If you need more data, you can reduce the refresh interval with Home Assistant or custom firmware. 1-2 Minutes reduce battery life with 1-2 years 3-6 months.
To calibrate the sensor, use a reference thermometer:
- Place the sensor next to the reference thermometer in stable conditions (e.g., in a closed box).
- Compare the readings through 1-2 hour.
- If the difference is greater than 1Β°C, calibrate the sensor through Home Assistant or return it under warranty.
π‘
To increase the signal range BLE Use a Bluetooth repeater (for example, ESP32 This will help if the sensor is in another room or behind multiple walls.