Aqara Door/Window Sensor P2: Matter/Thread in Home Assistant
If you’ve got other Aqara sensors in your Home Assistant setup and you’re expecting the P2 to pair the same way, stop right there. The P2 is not a Zigbee device. It won’t show up in Zigbee2MQTT, ZHA won’t see it, and pointing your Aqara hub coordinator at it will get you nowhere. The P2 runs Thread over Matter, which is a completely different pairing path. Once you understand that, the setup is actually faster than Zigbee once your prerequisites are in place.
This guide walks through what you need, how to pair it, what entities you get, and how to handle the most common issues. I’ll also compare it to the E1 at the end, since the question of which sensor to buy keeps coming up.
What makes the P2 different from other Aqara door sensors
The short version: Thread and Zigbee are both mesh protocols, but they’re not interchangeable. The P2 speaks Thread natively and has no Zigbee radio at all. That means it pairs directly with any Matter controller, including Home Assistant, without needing an Aqara hub in the middle.
That’s actually the selling point. With Zigbee sensors like the E1, you need a coordinator: either a dedicated Zigbee stick (SkyConnect, Sonoff Zigbee 3.0) or the Aqara hub acting as a coordinator. The P2 sidesteps that entirely. If you already have a Thread Border Router in your setup, the P2 pairs straight to HA with no intermediary.
The trade-off is that Thread requires a border router, a device that bridges between the Thread mesh and your IP network. Your existing Aqara hub (say, an M2) is a Zigbee coordinator, not a Thread Border Router, and can’t serve that role for the P2. If you want the full picture on running Aqara gear without a hub, see our guide on Aqara Zigbee devices in Home Assistant without a hub.
What you need before you start
A Thread Border Router
This is the non-negotiable prerequisite. The P2 needs something on your network acting as a Thread Border Router. Confirmed-working options:
- Aqara Hub M3 — the one Aqara hub that does Thread. We cover it in detail in our Aqara Hub M3 Matter bridge guide.
- Apple TV 4K (3rd gen) — solid Thread Border Router; widely used
- HomePod mini — also acts as a border router when plugged in
- Google Nest Hub (2nd gen) — works but Google’s Matter implementation has had some quirks with non-Google devices
- Amazon Echo (4th gen) — confirmed working
- Samsung SmartThings Hub v3 — works
- Home Assistant SkyConnect or Yellow — when running Thread firmware, these can act as a border router directly within HA
If you already run an Apple TV 4K or HomePod mini for HomeKit, you’ve got what you need. If you’re purely HA with no Apple/Google devices, the HA SkyConnect running Thread firmware or an Aqara M3 are your cleanest options.
Home Assistant with the Matter integration
The Matter integration is built into Home Assistant and doesn’t require a separate add-on in recent HA versions. You do need HA 2023.x or later. If you’re running something older, update first.
The HA companion app on your phone is also needed for the QR code pairing step. The Matter integration onboarding uses the app’s camera to scan the QR code. You can also pair using the numeric setup code if you’d rather do it manually.
Firmware on the P2
Here’s the step that catches people. The P2 shipped with Matter 1.0 firmware, but Aqara released a Matter 1.4 update in 2025. Some units in stock at retailers are still on the older firmware. The Matter 1.4 update improves compatibility and stability, so you want it before commissioning into HA.
The catch is that you need the Aqara Home app to update the firmware. You can’t push the update from HA once it’s commissioned. So the workflow if your unit is on older firmware:
- Temporarily pair it through the Aqara Home app
- Let it update firmware
- Factory reset it (press and hold until the LED flashes)
- Re-pair to HA
If you open the box and it’s already on 1.0.2.0 or later, skip this step. You can check firmware version in the Aqara Home app during initial pairing.
Pairing the P2 to Home Assistant step by step
Once your Thread Border Router is running and HA is up to date:
- Go to Settings > Devices & Services > Add Integration and search for Matter
- Select Commission Matter device
- Open the HA companion app on your phone and scan the QR code on the P2’s packaging (or the one on the device itself, if you can find it)
- Alternatively, select “Enter code manually” and type in the numeric setup code from the packaging
- HA will find the device on the Thread mesh via the border router and commission it
- The device will appear as a new entry under the Matter integration
The process typically takes under a minute once the mesh is established. If it hangs at “Searching for device” for more than 30 seconds, the border router either isn’t running or isn’t reachable from HA’s Thread network.
After pairing, go to the device page and you’ll see two entities.
What entities you get
The P2 exposes two entities in HA:
binary_sensor.contact— the core sensor.offwhen closed,onwhen open. This is what your automations will key off.sensor.battery— percentage remaining on the CR123A battery.
One thing worth flagging: the P2 has a small programmable button on the side. In the current Matter implementation, that button does not appear as a separate entity in HA. If you were counting on using it to trigger additional automations, you can’t, at least not through HA’s Matter integration as of this writing.
The battery type is CR123A lithium, which is worth knowing if you’re comparing against the E1 (CR2) or T1 (CR2450). CR123A is less common in most households than AA/AAA, so stock up when you buy the sensor.
Automations with the P2
The binary_sensor.contact entity works like any other contact sensor in HA. A couple of useful examples:
Alert when a door has been left open:
alias: "Front door open more than 5 minutes"
trigger:
- platform: state
entity_id: binary_sensor.front_door_contact
to: "on"
for: "00:05:00"
action:
- service: notify.mobile_app
data:
message: "Front door has been open for 5 minutes."
Log door activity to a helper:
You can pair the binary_sensor with a history stats sensor to track how many times a door opens per day, which is useful for security monitoring without any cloud involvement.
Once the P2 is commissioned into HA, automations execute locally on the Thread mesh. There’s no Aqara server in the path. The device talks to the border router, the border router talks to HA, and that’s it. If you want the broader picture on what does and doesn’t survive an internet outage, see does Aqara work without internet.
Troubleshooting
Device keeps showing as “unavailable”
This is the most common complaint I’ve seen from people running the P2. The HA community forums have a thread on exactly this, where the sensor drops off and comes back intermittently. The cause is almost always Thread mesh coverage, not a bug in the sensor or the integration.
Thread is a mesh protocol, and the P2 is an end device. It sleeps to save battery, so it can’t route for other Thread devices. If your border router is far from where the P2 is installed, or if there aren’t enough Thread routers in your mesh to bridge the gap, the sensor will intermittently lose contact.
Fixes that work:
- Add more Thread routers to your mesh. Thread routers need to be always-on devices that can participate in mesh routing. Apple TV, HomePod mini, Echo 4th gen, or a second SkyConnect all work.
- Move your border router closer to the P2, or to a more central location
- Check that your border router firmware is current
If you’ve been running a single border router in one corner of your home, this is likely what’s happening.
Device shows in HA but state never updates
This points to a Thread connectivity issue between the sensor and the border router rather than a full disconnect. Try:
- Power-cycling the border router
- Checking that the Thread network credentials in HA match what the border router is advertising
- If using multiple border routers from different ecosystems (e.g., Apple TV and SkyConnect both running Thread), make sure they’re on the same Thread network partition
Can’t find the QR code
The QR code is printed on the packaging. If you’ve already discarded it, there’s also a numeric setup code on a sticker on the back of the sensor. Use the “Enter code manually” path in the Matter integration onboarding.
Privacy check — does the P2 call home?
Once the P2 is commissioned into HA and you’re not using the Aqara Home app with it, Aqara’s servers have no part in your automation path. The sensor communicates over Thread to your border router, which relays to HA. That’s all local.
The one exception: if you kept the Aqara Home app connected (e.g., to run firmware updates), the app itself maintains a connection to Aqara’s cloud. If you want a fully air-gapped setup, update the firmware, then remove the device from the Aqara Home app and manage it exclusively through HA going forward.
For belt-and-suspenders isolation, a firewall block on the Aqara server IPs is still worth adding, especially if you’re using an Aqara M3 as your Thread border router. The M3 will still sync time and check firmware through Aqara’s cloud even if the P2 itself is local-only. Our guide on putting Aqara and Xiaomi gear on an IoT VLAN covers how to do this without breaking discovery.
P2 vs E1 — which should you buy?
The honest comparison:
Aqara Door and Window Sensor E1 (Zigbee)
– Pairs with any Zigbee coordinator (Zigbee2MQTT, ZHA, Aqara hub)
– Exposes more entities in HA (including the button as a separate entity via Z2M)
– Battery is CR2 — easier to find
– Needs a Zigbee coordinator in your setup already
Aqara P2 (Thread/Matter)
– Pairs directly to any Matter controller, no hub required
– Fewer entities in HA (button not exposed through current Matter integration)
– Battery is CR123A — less common
– Needs a Thread Border Router in your setup
If you’re already running Zigbee2MQTT or ZHA for other sensors, the E1 is probably the better fit. It drops into your existing Zigbee mesh, you get the button entity, and you’re not adding a new protocol to manage. We have a full walkthrough for the Aqara Door and Window Sensor E1 in Zigbee2MQTT.
If you don’t have a Zigbee coordinator but do have a Thread Border Router (Apple TV 4K, HomePod mini, Echo 4th gen), the P2 gives you a quick path to a local contact sensor without adding Zigbee infrastructure.
The P2 makes the most sense when you’re building a Thread-native setup from the start, or when you specifically want to avoid hub dependencies entirely. For most people who already have a Zigbee mesh running in HA, the E1 is the easier choice.