Aqara Door and Window Sensor P2 with Thread and Matter becomes unavailable and comes back als the time

Hey there,

last week Aqara launched its new Thread and Matter powered door and window sensor P2.
On the advertisement sheet at Amazon is printed that it works with Home Assistant so I ordered one of them day one.

I installed the Matter (Beta) Add On and as I am using the Skyconnect Multipan, I think I have all the correct dependencies installed in my Home Assistant OS installation on an Intel Nuc. The pairing was a charm with the iOS Companion App and I got my first Matter Device paired in my Home Assistant.

Unfortunately I have the problem that every around four minutes the sensor becomes unavailable and connects back a few seconds later. This a) spams the log and b) makes time based automations not usable.

Has anybody an idea to circumvent this behaviour?

1 Like

Had the same issue.

In the OpenThread Border Router Configuration disable the OTBR firewall and you should be good.

1 Like

Hey Gavin, thanks for your reply. Unfortunately this didn’t do the trick:

14:51 was the time where I disabled the OTBR firewall in the Multiprotocol Add-On. Looking into the Multiprotocol Add-Ons log, I find many errors after starting it, failing to update ipsets:

otbr-agent[301]: 00:00:00.108 [N] BorderRouter--: BR ULA prefix: fdf6:c790:cf06::/48 (loaded)
otbr-agent[301]: 00:00:00.108 [N] BorderRouter--: Local on-link prefix: fd4b:f006:ff9b:35a::/64
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:00.115 [W] Platform------: Failed to update ipsets: Failed
otbr-agent[301]: 00:00:00.127 [N] Mle-----------: Role disabled -> detached
otbr-agent[301]: 00:00:00.130 [N] Platform------: [netif] Changing interface state to up.
s6-rc: info: service otbr-agent successfully started
s6-rc: info: service otbr-agent-rest-discovery: starting
[14:51:52] INFO: Successfully sent discovery information to Home Assistant.
s6-rc: info: service otbr-agent-rest-discovery successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Listening on port 9999 for connection...
Accepting connection.
Accepted connection 7.
otbr-agent[301]: 00:00:27.070 [N] Mle-----------: RLOC16 2c00 -> fffe
otbr-agent[301]: 00:00:27.074 [W] Platform------: [netif] Failed to process request#5: Unknown error -95
otbr-agent[301]: 00:00:27.454 [N] Mle-----------: Attach attempt 1, AnyPartition reattaching with Active Dataset
otbr-agent[301]: 00:00:33.955 [N] RouterTable---: Allocate router id 11
otbr-agent[301]: 00:00:33.955 [N] Mle-----------: RLOC16 fffe -> 2c00
otbr-agent[301]: 00:00:33.959 [N] Mle-----------: Role detached -> leader
otbr-agent[301]: 00:00:33.959 [N] Mle-----------: Partition ID 0x4b76e5bd
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:33.977 [W] Platform------: Failed to update ipsets: Failed
otbr-agent[301]: 00:00:33.979 [W] Platform------: [netif] Failed to process request#6: Unknown error -17
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:34.497 [W] Platform------: Failed to update ipsets: Failed
otbr-agent[301]: [NOTE]-BBA-----: BackboneAgent: Backbone Router becomes Primary!
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:34.605 [W] Platform------: Failed to update ipsets: Failed
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:36.195 [W] Platform------: Failed to update ipsets: Failed
ipset v7.10: The set with the given name does not exist
otbr-agent[301]: 00:00:43.453 [W] Platform------: Failed to update ipsets: Failed

The Thread Service lists two different Thread Networks, I hope that this is correct?

Damn… I was hoping to be the hero.

Did you restart the addon’s after disabling the setting (or even better just reboot HA)? I had to restart for it to take effect.

1 Like

Hey Gavin,

I restarted the Add-On again and also the whole Home Assistant instance. Unfortunately the behaviour is still the same.

One last suggestion. Try a battery pull and see.

Only suggesting because yesterday after a power blip all my matter devices (all 2 of them) became unavailable and eventually when I decided to do a battery pull they came back online. Others have also reported similar findings.

Doesn’t hurt to try.

1 Like

Updating the Matter Server to 4.8.3 solved the issue for me.

2 Likes

how can you pair your device? if i want to do it in homeassistant web it says it needs the companion app,

if i use the iphone WITH THE APP it says i need to companion app

if i use Android it finds the device, it generate matter logon data and then it says no connection to network home-assistant possible.

i am lost
please help

I use the app. I go to settings → devices and services → devices and click on add device.
At the top you should see matter.
I select that and it brings up the camera to scan the matter code and I go from there.

2 Likes

Unfortunately this also didn’t help.

1 Like

Yes, that’s it. Now the connection is stable since more than an hour.

Now I’d like to share that sensor to my Homekit Matter instance is that possible, or do I have to go the other way round. Pairing first with Homekit and then Sharing to Home Assistant?

May I ask… as I understand it, the HA iOS Companion App in its current state will not store and pass the Thread credentials to the device and thus the device can not join an HA based Thread network. So I hope you don’t mind if I ask, did you use the HA iOS Companion App to commission the device to HA’s Thread network? (or did you mean some other companion App?) If you used the HA iOS Companion App then great! (I just don’t understand how)

I have the Skyconnect stick and use the multi network Firmware and AddOn for the Thread and Zigbee capabilities. So I can run ZHA and Thread simultaneously.
I was able to pair that sensor with the iOS companion app as it is described in the official documentation: Matter (BETA) - Home Assistant

OK…I’m thinking of getting one of these sensors. So sorry to be a pain, but I am wondering since you have Apple TBRs (I don’t), if you’re device actually joined an Apple Thread Network instead of the HA SiLabs Multiprotocol Thread Network. If you don’t mind conducting an experiment some time, by shutting down the SiLabs Multiprotocol Add-ON and see if you can still get events from the Aqara Sensor?
Again sorry to be a pain, and Best Regards.

So I got one of these Aqara D&W Sensor P2 and thought I would share my experience with pairing to HA Thread/Matter (I have no other Thread network). I’m only using SiLab multiprotocol Add-On and SkyConnect for Thread networking and using HA Matter Server.

  • After pulling the tab from the battery, the LED (mine was blue-ish) starting “breathing” as expected. I got sidetracked on a problem and I ended up having to powerdown/up HA. By the time I got back to the P2, the LED was no longer breathing (it will breath for around 12 minutes). I decided now was a good time to do a factory reset (tap the button 10 times), and after about 15 seconds or so I press-held the button for 5 seconds until the LED started breathing again. So with the LED breathing, it is now time to pair. I placed the P2 next to the SkyConnect so as to avoid any potential issues traversing another Thread node.
    • As a Note: when the P2’s LED starts breathing, my Android device immediately picks up the bluetooth advertisement and asks if I wanted to add the device. I was curious and said yes, and after scanning the QR code it took me to a menu to select either a Google Home App or an Aqara App, neither of which I wanted to select, so I exited out.
  • I next tried the iOS HA Companion App but it failed (It said I needed a Thread Network). From previous experiences trying to add other devices to HA’s Thread/Matter using the iOS HA Companion App, The App is able to get the HA Thread network’s name and PAN-id but it is unable to get the Network Key, Dataset, etc. and this prevents a device from being added to HA’s Thread network. This is a known issue with the iOS HA Companion App. There is an entitlement issue in that Apple will not let NabuCasa’s iOS Companion App extract and store the Thread credentials for HA Thread network (works fine for Apple based Thread network). There is work being done to fix this.
  • Next I tried the Android HA Companion App and after scanning the QR code (once commissioning gets going you’ll see the LED go through a flashing phase) you’ll see the App go through various phases. It worked the first time. Pleasantly surprised :slight_smile: .
2 Likes

After August core update my Aqara Door and Window Sensor P2 has become unknown.

I’ve deleted Matter, Thread and Open Thread and let it find everything again, also finds the door contact but remains unknown.

Also tried a reset on the device but cannot re-add, HA/Andoid matter setup just spins away on checking network credentials. Device remains and remains unknown

Any suggestions folks, or just wait until development moves forward?

I also have an Aqara P2 for testing-purposes and experienced the same issue like you. I tried everything and the entity becomes unavailable from time to time, sometimes just 2 seconds, sometimes between 10 minutes up to several hours.

You may check your logs again, I think there are two possible reasons.

First: Matter is still beta and maybe the issues resolves itself once a day
Second: The sensor itself has an issue with more than one gateway (HA and Homekit directly)

I use a Homepod mini as an OTBR and only paired the sensor within Homekit. Then I built an automation which switches an input.boolean on or off (based on the state in Homekit). Finally I used a template sensor which mimicks a window within HA.

  - platform: template
    sensors:
      window_virtual_andreas:
        unique_id: XXX
        friendly_name: "window virtual andreas"
        device_class: opening
        value_template: >-
          {{ is_state('input_boolean.window_andreas', 'on') }}

its very important to give the template-sensor a unique ID.

since then, the connection is rock-solid and it works very fast. Its kind of nonsense to use the automation within Homekit but at least it works really well so far.


1 Like

I have HomeAssistant with OTBR and Matter with SkyConnect running since a few weeks and it’s stable and working flawlessy.
Eve Motion, Door and Plug, Nanoleaf Bulb and Strip, Aqara door, Onvis plug, door and button. (no Google, Apple or Amazon smart home devices in my house)

I also had lots of troubles at first but after a while I figured it out.
The nrfConnect Android app (also available for other platforms) helped a lot to see if devices are advertising over Bluetooth.

I paired all devices over the HA companion app.
At first the Google home app kept interfering. After removing and reinstalling this app it got better. I don’t use it, but without it Android didn’t notify about new devices. In the pairing assistant there is a step where an “other” app can be used to pair where I chose the companion app. Sometimes HA notified about new devices and I started pairing from there (this usually happened after restarting HA).

Recently I had still quite some troubles to make the Onvis Thread (Homekit) door sensor and button work reliably over Thread (they work fine over Bluetooth). When I commissioned them to Thread they became unavailable or they became available but after renaming or moving them to a difference room they became unavailable or just became unavailable without any cause after a few days.
I haven’t fully figured out what caused this, but it looks like mDNS was the culprit.
When one of the devices were reported by mDNS more than once, they became unavailable. So I had to wait until mDNS forgot about them and only then pair again.

I also had to make sure I could ping the devices over the IP addresses reported by mDNS. I added a route on my internet gateway that directs the Thread IPv6 prefixes over the OTBRs IPv6 address.

I’m not entirely sure if the mentioned measures were actually what fixed it in the end or if something else was the cause.
I made a lot of changes in my network during all the experimentation. I run HA in Docker and have another HA on a Raspi that I only use for the Thread and Matter add-ons, because I miserably failed at setting up Thread and Matter in Docker.
Before that I tried setting up HAOS with Thread and Matter add-on in KVM but that also didn’t work out. I also changed a lot related to IPv6 because I haven’t used it before and wanted to set it up properly not only for Thread. There were issues with Starlink that doesn’t officially support IPv6 yet. So it all was a big construction site with a lot going on and therefore difficult to pin down specific changes that made things work, especially with the Onvis Thread+Homekit devices that I experimented with for several weeks.
When I’m adventurous I’ll make another attempt to make OTBR+Matter run in Docker instead of Raspi. That should now be much easier after I know that the rest of my network is configured properly.

My biggest issue now is that I do not have a working mobile app for any of the Thread devices except Nanoleaf. The Nanoleaf app works reasonably well on Android and I could use it to configure the devices and install firmware updates.

The Aqara app looks good on Android as well except there is no support for the P2 sensor yet.

There are no Onvis or Eve apps for Android.
The iOS versions can’t be installed on the old iPhone 6 we have laying around because it requires a newer iOS than 12 which is the highest supported.
I could install them on my wife’s newer iPhone 12 though, but both apps didn’t show any useful functionality at all. Onvis only shows “unspecified error” or does nothing on any of the menus and buttons and the Eve app doesn’t let me add devices.

Hi there, let me just preface that I am brand new when it comes to Home Assistant so please bear with me.

I just received my HA Green in the mail the other day. I am thrilled to finally setup my first automation with my eufy smart lock and have my Lutron lights power on when I unlock the front door at night. Albeit that whole scenario took about over night to do. Learning curve is steep but I’m getting there. :stuck_out_tongue_closed_eyes:

Anyways, I want to utilize these same door/window sensors. I actually bought these while waiting for my HA Green to arrive. I’ve had about a month to play with them so far and I even went as far as to purchase an Echo 4th Gen to act as a border router. It was a little tricky to pair as some of you have experienced in this thread, but now that it is paired through Amazon Echo it works flawlessly. Fast forward to earlier this week when I got my HA green and noticed that it won’t recognize the Aqara door and window sensors. I’ve been looking at this thread and scratching my head. Wondering if I need to purchase a skyconnect dongle. I don’t have a HomeKit or anything of that nature, so I guess my question is this…

will I be able to connect these door and window sensors using just the HA Green and the sky connect dongle?

Thank you

1 Like

I have a couple of Aqara door and window sensors P2, and my experience with them is frustrating, to say the least.

Initially, I installed them using SmartThings, and everything was fine … until one day, they stopped reporting battery (~3/4 months ago - Sept/Oct 2023).

After this, I said that let me add them directly to HA, and they installed and worked for a couple of months … state and battery nicely reported.

Now, there are a couple of days (I suppose after the update to HAOS 11.5 or the core, as of 4/5 Feb 2024) where, randomly, some of them report unavailable. I did a complete system restart; I did a normal restart … what that does is make other sensors become available and others unavailable.

In the end I decided to re-install them … no luck with HA I couldn’t install them. Instead, I installed them again with SmartThings, and I’m back to my initial problem: the battery is not reported.

To conclude, I will purchase new contact sensors and throw those away, staying away from Awara door and window P2 sensors.