New Aqara Gateway Hub

Hi! Any news on getting aqara door sensors working with Aqara hub (home kit compatible) in Home Assistant?

As far as I know the hub can be added to Home Assistant, but only some sensors, not door sensors neither switchs.

Any progress on getting door sensors working?

I need it to get alarm working

2 Likes

I don’t get it work and I tried in so many ways… I have homekit supported gateway and I want to get xiaomi temperature sensor data available to home assistant. Now I get it only available to mi home app and homekit, but not home assistant.

This is what I tried to do.

  1. Removed all entries mi home app
  2. Removed all entries apple home app
  3. Reseted gateway pressing 10 second --> yellow light started to blink.
    After this I tried to set up this in so many ways and here is few examples:

4 a. Home assistant got new notifications and there is homekit setup code. That code can be used in apple home app and then I get home bridge to home app (i get all home assistant data to apple home app, but I dont get xiaomi temperature sensor data to home assistant).

4 b. I set up xiaomi me home app again (added gateway there and added temperature sensor).
Then open home assistant and go to confituration --> Integrations --> press + (set up a new integration) --> selected homekit accessory --> selected device list “home assistant bridge._hap._tcp.local.” --> try to add pairing code format xxx-xx-xxx and added there my own code what I found on my xiaomi gateway sticker --> and I get error “incorrect homekit code”
Then I tried to add that code what appears on home assistant notifications “homekit setup” secreen and then i get error “An unhandled error occured while attempting to pair with this device. This may be a temporary failure or your device may not be supported currently.” And after that I lost notification where that code was and also if i try to add that homekit accessory integration again I get error “No unpaired devices cloud be found”. And after that I don’t see anymore homekit bridge on apple home app.

So what I do wrong?

And here is the log files after 4b setup:

2019-07-27 19:17:41 ERROR (SyncWorker_9) [homeassistant.components.xiaomi_aqara] No gateway discovered
2019-07-27 19:17:41 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Integration failed to initialize.
2019-07-27 19:30:23 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py”, line 259, in async_step_pair
pairing)
File “/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py”, line 336, in _entry_from_accessory
pairing.list_accessories_and_characteristics
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/homekit/controller/ip_implementation.py”, line 73, in list_accessories_and_characteristics
self.session = IpSession(self.pairing_data)
File “/usr/local/lib/python3.7/site-packages/homekit/controller/ip_implementation.py”, line 416, in init
c2a_key, a2c_key = get_session_keys(conn, pairing_data, write_fun)
File “/usr/local/lib/python3.7/site-packages/homekit/protocol/init.py”, line 392, in get_session_keys
response_tlv = write_fun(request_tlv, step3_expectations)
File “/usr/local/lib/python3.7/site-packages/homekit/protocol/init.py”, line 80, in write_http
resp = connection.getresponse()
File “/usr/local/lib/python3.7/http/client.py”, line 1336, in getresponse
response.begin()
File “/usr/local/lib/python3.7/http/client.py”, line 306, in begin
version, status, reason = self._read_status()
File “/usr/local/lib/python3.7/http/client.py”, line 275, in _read_status
raise RemoteDisconnected(“Remote end closed connection without”
http.client.RemoteDisconnected: Remote end closed connection without response
2019-07-27 19:30:23 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py”, line 288, in async_step_pair
start_pairing, self.hkid, self.hkid
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/homekit/controller/controller.py”, line 370, in start_pairing
raise AlreadyPairedError(‘Alias “{a}” is already paired.’.format(a=alias))
homekit.exceptions.AlreadyPairedError: Alias “XX:XX:XX:XX:XX:” is already paired.

I have mine perfectly working after applying this modification. It should be merged into master branch.

Now my Aqara door/window sensor is visible in home assistant and I can use it in automations

I managed to add a hub with Door Sensor after updating to 0.97.1 without modification.

Added the hub today, all sensors including doors, temp & humidity as well as vibration are working fine.

I also mapped them back to the apple homekit. Be sure to allocate the correct device_class to each sensor before doing this, otherwise everything will turn up in homekit as an occupancy sensor :wink:

It’s also a good idea to create a friendly name that notes the room it’s in, helps for an easier setup.

Hi guys, I have one question, Aqara Gateway is compatible with all xiaomi sensors?

With me the door sensors are very slow… Use them for automations to turn on lights as an example, and it takes about 30-40 sec before HA gets the new status and trigger the automation :frowning:
The alarm status is similar, HA will get the new state after 30+ seconds.
I never managed to get it connected to EU server (tried Germany) in the Mi Home app, I guess the route to China takes 30-60 secs at the minimum.

Thinking I should ditch the Aqara hub and get the Xiaomi/Mijia Hub as it appears it works (almost) flawlessly.

Any advise is very welcome!
Thanks

1 Like

@Olivier974
Hello,
I have Aqara Hub set up directly in the home app now, it occasionally disconnect to wifi, so I’m considering connect it to HA first then connect it to homekit via HA, since I’ll have to re-config every automation and setting after this, I have a few questions before I commit.

  1. I have two Xiaomi wireless switch currently connected to Aqara Hub, will they work with newest HA version?

  2. Same as above, I have an Xiaomi temperature and humidity sensor and human sensors connected to Aqara Hub, will them work?

Thanks.

hello @s951736,

1-i dont think so…personnaly i have bought a V2 and later a V3 version (not Aqara Hub but called Mi Hub now) and it works with V2 and V3, not V1 (Aqara Hub).
I actually have 2 Aqara Hub and 2 Mi Hub (V2 and V3), total 4 gateways…1Aqara+Mi Hub on the first floor and same on the 2nd one…lol…it works like a charm.

2-Yes it will work for theses sensors

The best way is actually to install a Zigbee gateway (26€ for a cc2530 and texas Instrument flasher) and you can manage thousand of Zigbee sensors brand, not only Xiaomi ones … :slight_smile:

if you want to read / learn more :

https://gadget-freakz.com/zigbee-in-home-assistant-with-zigbee2mqtt/

https://www.zigbee2mqtt.io

I have a Zigbee gateway and all the sensors yu describe above, and it works perfect!
and i have about 30 sensors on the 4 gateway, it works but slower than the Zigbee gateway (cloud in china lol) and when the server are down or have to be maintain…it bugs a lot…

So the Zigbee gateway is a nice solution :wink:
enjoy :wink:

Wow, I didn’t know there is a thing like cc2530 that let you pair any Zigbee device, this is super cool, but I’m not sure I have enough knowledge to make it work…
Maybe I’ll stay with Aqara Hub for now, it still occasionally disconnect to wifi, but it’s easy enough for me.
There is new Aqara Hub M2 just out a few months ago, I’m hoping someday it can be bought out of China then I can buy one, and hope it can be more stable than the old Aqara Hub.
Thanks for the information.

@s951736,

its an easy job, you can do it :slight_smile:

There is already the european version for the Aqara Hub and the Mio Gateway but if you buy the european version, you cant use your sensors anymore because the sensor are chinese version…

So if you wana buy this european version, you will have to buy all the sensors again :frowning:

That why the Zigbee coordinator is great, it doesnt care about the version of sensor are made for, just the Zigbee protocol :wink:

1 Like

Hey guys,

I have a question, can you integrate the aqara hub with both HA and the Aqara App?

At the moment I can either do one or the other but unable to do both, as it says the device is already paired.

@Olivier974 If you have paired it with HA, how do you further use the hub to discovery more Aqara/xiaomi sensors without the app?

Thanks

@civictyper , hi!

you need to use the app to add more sensor…no choice…

Or you migrate to Zigbee2mqtt…i have both…i test for 2 month now Z2Mq and it work great!

Hi @Olivier974! It’s great news to know I can connect the Aquara gateway to HA using the HomeKit workaround. Could you please help me solve a couple of questions so that I can decide whether to go down the Z2Mq path?:

  1. Can I control the Xiaomi/Aqara devices connected to the Aquara gateway from HA? Can I configure new logics directly in HA?
  2. Does the HomeKit app in the iPad/iPhone need to be running and reachable by the Aquara gateway for the latter to be active in HA?
  3. I’m using a second WiFi router for the Aqara gateway, the iPad/iPhone, and the Raspberry. What happens if I disconnect the router from the Internet? Would the gateway still talk to HA in the Raspberry? When I set the gateway using only the Xiaomi app, the gateway stops working when I unplug the router from the Internet. I would prefer my home data to stay home…

hello @santjaqo,

1-Yes / Yes
2-I dont use Ipad/Iphone, i a m running the app on Android, but the app dont need to be reachable for the latter to be active in HA.
3-Yes no problem if you dont use internet service for HA like duckdns.org

1 Like

I managed to connect to HA via homelink integration. Aqara Hub works instantly (turning light on and off and changing colour). I didn’t find the option to play sounds in HA. Door sensors work but with 30-40 sec delay… Is there any workaround?

EDIT:
Is it possible to use sensors via zigbee2mqtt and keep Aqara to play sounds and as alarm via homekit integration? I use it as doorbell at the moment and it works quite good. The problem is lack of custom sounds.

I personally ditched the Aqara Hub and got the Xiaomi Gateway instead. It works much better with HA and the Aquara sensors are fully compatible. No delays, all working instantly. This is very important to me as I use the motion sensors to turn on/off the lights. 30+ sec delay is not acceptable.
Downside is that HA do not detect it as alarm natively and have to use custom component to manage the alarm bit of the gateway.

For custom sound paly, I use the google home mini instead. It’s much louder, can play custom sounds and even TTS…

Hello, @Dimitar Can you please expand on the Google Home integration bit and how it’s achieved? Thanks.

Sure I can… HA will detect it as a media player via auto discovery. Next you can use the media_player.volume_set, tts.google_translate_say and media_player.play_media services to set the volume, have to say any text you want or play custom sound via mp3. I have mostly done this via scripts that are executed via automations. I can share some of them if you need more details… Cheers