HA doesn't discover Mi Gateway/Hub (solved)

Hi all

Since one of the recent HA versions (like 0.95) I started getting an unknown state for 1 out of my 4 Aqara temperature/humidity sensors. For some time it was showing data most of the time, nowadays it just shows ‘unknown’ all the time. While the 3 other sensors are totally fine. The only thing I can see in logs from HA end is the “Setup of xiaomi_aqara is taking over 10 seconds.” that I started getting around the same time when I stopped getting data from the sensor.

Mi Home app detects the sensor an shows data. HA shows it’s battery level though. At some point I thought it’s because the sensor is out of reach of my hub so I went ahead and bought an additional one but it didn’t do any good. Replacing battery didn’t help either. Resetting and re-adding to the hub didn’t help as well.

I ran out of ideas and have no clue how to troubleshoot further… hoping for you help! Thank you.

In my experience, when individual sensors drop off, that is a distance to hub issue. If all the sensors on a hub drop (plus the hub), then unsurprisingly thats a hub issue :slight_smile:

Re the second hub - did you actually remove the sensor from the primary, and add it to the new hub PLUS add the new hub to HA? This might seen obvious, but just checking…

Does the second hub correctly connect (or have you been unlucky and have a locked hub)? can you turn the hub light on/off and play ringtones? if not, its a hub problem.

Instead of buying a second hub, you can use mains powered aqara (zigbee) switches as extenders - I have one near a sensor just for this…

Thanks for the reply @walaj. I did connect the hub properly and only 1 out of all sensors connected to the Hub were unavailable. That’s why I thought it’s something else. The Hub was responding, I could play sounds etc. But after reading your reply I realized that what I didn’t do is to ensure it’s not the Hub issue… so I swapped Hubs locations and reconfigured all devices… now it’s obvious it’s the Hub and the location of the topic is wrong :slight_smile: I switched the working Hub off and configured HA to just use the 2nd one. Now HA tells me it’s not able to connect to it. I went through all troubleshooting suggestions in the Docs but nothing helped so far… i’m in worse dead end now lol :slight_smile:

After some more digging I narrowed down the problem to this new Hub of mine with closed 9898 udp port. So you were totally right by suggesting I didn’t connect it properly to HA @walaj. Here is the solution for anyone who will stumble upon this topic in the future.

To diagnose if it’s the problem of your Hub use: nmap -sU -p 9898 192.168.xxx.xxx
If the port is closed - the only solution I was able to find is the one above.

sorry you had a closed hub, but at least you know. And can fix if you wish.

or just write it off and get a powered socket to use as an extender…

I did fix the Hub but in the end I wasn’t able to solve the problem I was trying to solve initially:
I have a 2 switches located in 2 opposite corners of the house (next to garage door and next to entrance to the backyard, garage door and entrance to backyard are exactly opposite to each other). So whatever I was doing I couldn’t get garage switch to have a stable connection unless I put a Hub inside the garage. Probably because I have wifi satellite right next to it (1m away). So the idea was to have 1 Hub inside the garage and another one somewhere centrally located. But now that I’ve done it, I lost connection to the backyard switch lol.