Cannot connect Xiaomi Gateway (lumi.gateway.v3) to HA

Didn’t even notice the firmware had updated so can’t say. Just bloody happy to have my 30 Zigbee devices back in HA!

The key point I think is to enable LAN communication protocol first before updating firmware. I have two aqara gateways and one aqara ac partner, all works well even after latest firmware update as of today. Just make sure LAN comm is enabled, port 9898 is open, and update will be fine…

Confirmed. I have 3 hubs on latest firmware. The bug prevents the app from openning the ports, but does not close them if already opened. If your gateways are already communicating with HA or Node Red (both for me), you can upgrade safely and maintain all functionality.

Thanks guys,

Well my hub is already communicating with HA without problems.
But I’d like to know how I can confirm that the LAN comms and port are open?

Thank you

Issue command

Nmap -sU 192.168.0.x -p 9898

And it should be open…

Chances are pretty good that the ports are open if HA can communicate with them. I had to rip my first one open because I was too eager and left the fw update go through before getting it into HA. It was easy to fix though since I found a pretty straight forward tutorial

Thanks guys, just to be sure I did confirm by installing nmap (never knew this great thing existed)
https://nmap.org/download.html

Got

PORT     STATE SERVICE

9898/udp open  monkeycom

:crossed_fingers:

Good, it should work then.

1 Like

Just upgraded to 1.4.1_167.0158 and everything is working fine.

Reminder for everyone to check in LAN on the gateway is open https://medium.com/@likeguitarz/home-assistant-how-to-get-xiaomi-home-gateway-lan-password-key-and-mac-address-100d54083446

and if you’re bothered, install https://nmap.org/download.html and run Nmap -sU IPofgateway -p 9898 to make sure 9898 port is open
then update away

Thanks all for the help

Hello,

I have a lumi-gateway-v3_miio83880019 and i can see my sensors but not my gateway in HA, i try nmap the result is :

PORT     STATE SERVICE

9898/udp open  monkeycom

MAC Address: 78:11:DC:FB:2B:35 (Xiaomi Electronics,co.)

so i am happy to dont have to soldered and open the box, but i dont understand what is wrong in my config?

Do i need to reset all, connect into Mi Home, suppress the gateway and go to HA with :

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - host: 192.168.1.55
      key: xxxxxxxxxxxxxxxx

and the gateway should appear in notification?

I make a precision : i have a lumi-gateway installed with homekit_controller first.
So i unstall all from Mi Home and try to just add the lumi-gateway-v3_miio83880019.

Thanks for a response…what a mess…

Just got a xiaomi hub update 1.4.1_170.0158 come through… Still no open 9898 port :roll_eyes: this leads me to believe it will never be opened again… not Game to do the update on my working hub.

Just so you’re aware, as long as the port is already opened, updating the FW will not break it. I’m running the latest FW on 3 hubs and all 3 are in HA perfectly.

If you aren’t waiting for any feature enhancements, just assign them static addresses and then disable external traffic to those IPs via your router.

To get the ports open, it’s a pretty easy process, follow these instructions. I had to do it on my first hub because I updated the FW before I opened the ports.

Hi everyone.

i’m hitting into this trouble too. You all mention opening ports but what does that mean? Is it port forwarding?

The ports referred here are the ports that open when you enable network mode (or whatever it’s called in the hub settings in the xiaomi mi home app).

Basically, what happens is you need to enable the “local control mode”, mentioned above, I believe they call it network mode, and when you do, if you have an older version of firmware, it will open these required ports up for you. The problems are: A, it has been reported that some units are now being shipped with the newer broken firmware that doesn’t open the ports, and B, the app instantly and obnoxiously tries to get you to update the firmware when you first go to the settings page you need to go to. B can be avoided if you navigate quickly, but you have to click options, then “about” almost simultaneously or you’ll get the FW prompt and have to start over.

If you look at my last post, I pasted a link to a way to manually open the 2 ports that are SUPPOSED to open when you enable network mode in the app. It requires minimal to little solder skills, and the ability to follow a very easy to read list of commands (in the link above), but once finished, you’ll be able to get the states and everything in HA right away. It doesn’t break any existing functionality either, it’s litterally just opening ports that the app is supposed to open, but xiaomi doesn’t seem to be too concerned to fix it

2 Likes

Hi Justin,

Thanks a lot for this explanation it makes sense and i do have the new firmware unfortunately so looks like the hub is naff for getting into HA at the minute.

In that post do you know roughly where the guide is as there’s 207 comments so quite a few to scroll through to find it, unless you know exactly where it is.

Ah sorry, that link used to take you directly to the post I was referring to, it must’ve changed. I found it and just copied the text, but all the credit goes to the guy at the end of it.

well, tried to set param network.open_pf to 3 - it helped me!
Can see gateway in openhab, iobroker and 9898 port is opened.

FAQ:

  1. Find specific screw bit like fork to open gateway case.
  2. Find UART cable/board.
  3. Solder 3 wires GND and RX / TX like here (Image .
  4. Disconnect RX wire from UART module.
  5. Dont connect Vcc (power) from UART to gateway.
  6. Turn on gateway (220V).
  7. Open putty application, connect to serial port (COM1-30) -select yours one0.
  8. Wait for fully load of gateway, connect RX wire to UART.
  9. You will see all messages of gateway.
  10. Send command psm-set network.open_pf 3 , send it few time in case it was spammed by gateway and it can be lost in msgs…
  11. Check your param by command psm-get network.open_pf to be sure its OK.
  12. Turn off gateway.
  13. Turn it ON.
  14. Check your port.
  15. Say thx to this guy - ds2003
2 Likes

Hi me again,

Long story short i got an extra hub today and managed to not update the firmware so i am on ver 1.4.1_150. Will this firmware version open the ports needed for home assistant to communicate with it? I have managed to turn the wireless protocol on and added the key into HA but nothing appeared which is different to last time as last time it said aqara couldn’t be set up.

Any advice would be appreciated!

Just to add to this if i add the IP address I get the aqara config is invalid but if i add the MAC address or just the key nothing shows up in my notifications and i can’t see the device in the states section.

Did you ever get this working? same firmware and Hassio cannot connect to hub

I am on the newest firmware 1.4.1_170.0158.

I cannot get the hub to connect to hassio. Like you mentioned I updated after first turning on the hub and integrating it into the Mi Home app.

I was unaware I needed to put it LAN mode first.

Would this method work with my firmware? I am willing to open it up if it’ll work.

1 Like