[U400 Smartlock]: Integration with Aqara Hub & Homekit + Home Assistant

Home Assistant is my main automation.
I also want to use UAB feature with the U400 Smartlock.
I currently have the lock paird to my Aqara M3 Hub, and connected to Home Kit.

Altough it is paird to my Aqara M3 Hub, which is integrated into Home Assistant. I do not see it exposed from the hub, to Home Assistant.

Because I want to use the UAB feature, I have to pair to Home Kit. But, I am unsure how to still get exposed to Home Assistant or Alexa.

Thanks

7 Likes

From Apple home you should be able to go to the lock’s settings and share device. You can also go to the locks settings in Aqara home and scroll down to matter which would give you a code. You’d then use that matter code in home assistant to add as a matter device. If possible post screenshots so we can assist further

Currently, my U400 lock is bound to Aqara - M3 Hub and then added to Home(kit) from the Aqara app. This works fine and approaching the lock works and door opens.

Lock is just not in Home(kit) or Alexa.

ISSUE #1 - Trying to go to the Aqara app and getting a QR code to then use to bind to Home Assistant fails with an error message. I guess this is because it is already bound via Matter to the Aqara M3 Hub (according to Claude)

Claude is telling me that because the lock’s main ecosystem is the Aquara/Matter connection that it has already connected via Matter. And that the lock is not exposed to Home Assistant via the Matter Integration in Home Assistant.

ISSUE #2 - When looking at the lock in Apple Home(kit), I do not see an option to “Share Device” - I do see an option to “Turn on Pairing Mode”. This code of course I am guessing is not a Matter code, but a Home Kit code - but this code fails when trying to use as well.

CLOSEST METHOD I HAVE FOUND is if I go into Home Assistant on my phone, to the Matter integration and select ADD NEW DEVICE and then select MORE OPTIONS…I can see my other Matter devices, INCLUDING the U400 Smart Lock. But, selecting the lock device to add never connects and gives the error “Unable to Add Accessory.”

2 Likes

Sorry, lock is not in Home Assistant or Alexa.

1 Like

Hmmmm, and yet somehow…Alexa has discovered My Aqara Hub and Smart Lock. But then it tells me to add the devices, which then gives instructions to put the device in “pairing” mode. So, i play the game and go to the Aqara U400 lock and press the SETUP button on the back, gives me instructions provide ADMIN fingerprint, but tells me to use the APP to pair the device. #smh #ughh

Here is what I see in Alexa. I have no idea how Alexa discovered the devices.

Unfortunately Amazon Alexa is a service I do not use but I’m certain someone will be able to respond to that.

In Apple Home the correct term is turn on pairing mode which will generate a matter code for other ecosystems. (Apologies, I used the term share device but that is actually in home assistant)

If you generate that code in Apple Home then go to Home Assistant-settings-devices-integration-matter-add a device it should ask if it’s in use-select that-pick Apple and then you should have an option to paste the code. It should then go through the setup process.

Please let me know if you have issues and I’ll try and help you

Cheers USBen!

When I use the “Matter Code” created by going to the lock in Apple Home and selecting “Turn on pairing mode” this code fails when attempting to use in Home Assistant.

But, if I reset the entire lock, And DO NOT join to the Aqara Hub, and Homekit, I can easily pair to Home Assistant via Matter, and this works. I tested this on a test HA environment I have/created. And then I tested on my production environment - and this worked - before restoring it.

1 Like

Nice! I was going to suggest resetting next :wink: If you go into the settings-general-matter accessories you should see the U400 (it’s the old setup) still in there. If you delete that and then go into home assistant for the u400 you can select share device using the code it provides to add into Apple home. You should be able to then add it into Aqara home as well.

1 Like

I’ve done the reverse before. Apple Home-Home Assistant-Aqara. It will give you the beauty of HA automations, UWB on Apple and the settings, automations and firmware updates in Aqara

1 Like

My automation and everything is really controlled and managed by Home Assistant. I have only a few in Apple Home Kit (HK).

I bought another U400, and I am going to pair to Home Assistant (HA) or Apple Home first, then add to Aqara last. From HA I can expose to Alexa. But, I will figure it out tomorrow.

Thanks! I will let you know what I finally do.

1 Like

Looking forward to hearing how you set it up

Okay, got it setup. So, one thing I did not notice was that my IOT VLAN that has all of my home auotmation and things was not getting IPV6 address or on my IPV6 network because the UNIFI LAYER3 switch does not pass IPV6 addresses. So, after a lot of failures, I changed the IOT VLAN to use the UDM-SE as its router and that enabled the IPV6 address and routing.

After that, you can kinda go on about your business in several ways.

Now, my Home Assistant runs in a Proxmox VM (not LXC) so this guy needs to be able to see or use MATTER and THREAD. But it needs a Thread Controller.

Because I have my HA VM in a Proxmox Cluster, I really do not want to use a USB dongle. Instead, I want something on the network. I have an SLZB for my Zigbee integration, so I got another one and put it in MATTER-OVER-THREAD mode. Well, apparently this does not work or is not stable with MATTER over ETHERNET. So, that was scrapped. But in the mean time, I tried it as a USB device. But, this also kept failing because apparently there is some bug int he chipset, so when adding the USB device to my HOME ASSISTANT VM, it would disconnect. So, no go for either USB or ETHERNET option.

I tried another vendor USB Zigbee + Thread adapter only because I could get it next day for $35. But, this had the same USB evication failures.

I have a Nabu Casa ZBT-2 on order, but it won’t get here for another 10 days. I have the ZWA-2 for Zigbee and it connects to fine. Although, I am no longer using it as I have the SLZB-06M connected on the network which is perfect for moving the VM in the cluster.

So, I tried setting up my Apple TV 4k 3rd-Edition as a Thread Controller. So, I paired an Aqara Door Device to it Home Kit with the Apple TV as the Home Hub. That created the Thread network, which Home Assistant could now see.

I used my Apple iPhone and shared the Apple Thread created network to my Home Assistant.

I then went to the Aqara U400 door lock and paired it first to Apple Home. Then went into Apple Home and selected to get the pairing code.

Then went into Home Assistant → Devices and Services → Matter and selected to add a new device, entered the pairing code from Apple Home and that let Home Assistant see the Aqara lock from Apple Home - in the Apple Thread network and added it to Home Assistant which then had IPV6 enabled.

So, wew! That was a fun3-4 days!

  • Aqara U400

  • Apple TV 4k 3rd Edition w/ Thread Support

  • Paired the U400 to Apple Home. You can actually pair in any order as I have 2 U400 locks. One I first paired to Aqara M3 Hub and the 2nd I first paired to the Apple Home - which was using its newly created Thread Network.

  • Got the pairing code from Apple Home

  • Corrected my IPV6 network which was not being seen by my Home Assistant VM on Proxmox.

  • Added the lock from Apple Home, into Home Assistant by geting the pairing code from Apple Home for the device.

And it all works very stable and my HOme Assistant VM is using a network device at no USB adapter - so if it moves in the cluster nothing breaks.

1 Like

Ma has it been a journey for you but I’m glad to hear you have it working great! I’ve been interested in moving my HA to proxmox and it’s reassuring to see you have it operating smoothly

What was actually messing me up is that I did not realize that when I moved the iOT vlan to use the LAYER 3 switch for routing, that it was no longer routing any IPV6 address which is needed for Thread.

And what was really throwing me off from this is I could add the devices to Aqara and Homekit and they worked 100% as designed. But this was because they were paired to the Aqara Hub which had setup its own Thread network.

So when I came to PAIR to Home Assistant, things would do the initial Bluetooth connection, pause and pause and pause and then FAIL to add the acessory.

It wasn’t until I looked at the Matter log in Home Assistant that I saw it could not connect to the LOCK and it showed an ipv6 address…

1 Like

I’m running into similar issues and have been pulling my hair out. I have one question that I hope you would be able to answer… Were all of your devices on the same network/vlan? Specifically, your AppleTV, Aqara Hub, iPhone, Home Assistant, etc.

Yes, ALL of my home automation devices are on the same VLAN. What do you have working and what is not working? Pairing to the Aqara Hub I am going to guess is working as it is its own edge Thread router and this will be done with IPV6 although you may not know.

To pair to HOME KIT will work without any issues after paird to Aqara Hub. This will have no problem.

The only other issue will be pair still to Home Assistant. HA needs some boarder Thread router to in order to work. You can either get the Nabua Casa ZBT-2 Zibbee or Thread USB device - in this case Thread of course. And connect to your HA via USB.

I did not want to use a USB device because my HA is in a Proxmox Cluster. So, I wanted something that was on the Network. I tried the SLZB-06 in eithernet mode - but a lot of messages of Thread via Ethernet not working fully. I tried and it did not work.

I still wanted a device on the network - so I choose an AppleTV 4K 3rd generation. After pairing a Thread device directly to the AppleTV it enables the Thread Router, which can then be seen in HA under THREAD. Doing this allowed me to go into Matter in Home Assistant, and use the Matter pairing code on the device to add the locks into Home Assistant as well.

1 Like

Did you have to do any firewall rules? I’m running a UDM Pro, HA machine lives on a VLAN with the rest of my externally accessible services. Latest Apple TV with Thread on a separate VLAN. IPv6 enabled on both vlans and I still couldn’t get HA to pair with the Apple pairing code.

My current workaround was to dual-home the HA device on both vlans, the moment I did that I could pair no issue. I’d rather not be set-up like this.

I had a similar issue with my U400 with UniFi and Home Assistant. Home Assistant would never successfully add the device. Would take forever to fail too. I triple checked IPV6 was working on my UniFi IoT VLAN and that wasn’t my problem.

I never tried to double VLAN HA and I guess that would have solved my problem too since I have Apple TV and the Aqara U400 on on the IoT VLAN but HA is on another VLAN entirely. But I wouldn’t like that solve either. I do have firewall rules to allow certain HA to talk to devices on the HA VLAN, but they didn’t help.

I first upgraded my M2 Aqara Hub to the M200 hoping that would work since it supports Thread, as that’s how HA talks with my U100 locks. But alas because of Thread the hub doesn’t bind to the U400 in the same way so it didn’t bring over the U400 to HA. At least I have a newer more powerful hub I guess?

So I wound up getting a Sonoff USB Dongle Plus MG24, flashed it with Thread firmware, and now HA can run its own Thread Border Router service. Once I got that setup HA finally could pair the U400 using the code from Apple Home. Super fast too, no more waiting. HA also joined my existing Thread network that my Apple devices and the U400 were on.