Diagnosis
This is almost always a pairing mode timing issue. The hub and the sensor have a short window to find each other, and if you trigger one too early or too late, they'll miss each other.
How to Fix It
First, bring the sensor right next to the hub. In the Aqara app, start the "Add Accessory" process and choose your device type. Wait until the app specifically tells you to put the sensor into pairing mode—usually with a spinning animation on screen—*then* perform the sensor's pairing action (like pressing a button three times or holding it down). Don't initiate pairing on the sensor first. Keep them within a foot of each other until the app confirms success.
If That Didn't Work
Some third-party Zigbee devices use non-standard pairing methods or profiles the M2 doesn't fully support. The M2 is optimized for Aqara's own Zigbee 3.0 devices. While it can work with others, compatibility isn't guaranteed. For non-Aqara gear, you might be out of luck.
Heads Up
If you're trying to add a device that was previously paired to another hub (like an old Aqara hub or a different brand), you *must* reset it first. Most Aqara sensors are reset by pressing the button 10 times quickly, confirmed by a blink.