Xiaomi Gateway no Longer connecting on latest firmware - "Invalid Config"

Thanks SweAdelpha!
I’ve received 1.4.1_161.0158 update today but still can’t connect from hass to my gateway :frowning: Any luck from anybody else?

Same mate new firmware, still cant connect it to HA

My Hub also stopped working after firmware upgrade. I’ve managed to make it working after a lot of retries using this config:

  discovery_retry: 10
    - mac: !secret xiaomi_mac
      key: !secret xiaomi_key
      host: !secret xiaomi_ip

Why is your IP address a secret?

In fact it is not, just to make it “cleaner” to post it here and don’t cause confusion.

have just received update from 1.4.1_161.0158 to 1.4.1_164.0158. Have it helped to anyone? For me seems not… Still can’t access xiaomi devices from home assistant

Apparently it requires some soldering to get it up and running again: see here

Procedure seems to be:

  • Find specific screw bit like fork to open gateway case.
  • Find UART cable/board.
  • Solder 3 wires GND and RX / TX like here (Image .
  • Disconnect RX wire from UART module.
  • Dont connect Vcc (power) from UART to gateway.
  • Turn on gateway (220V).
  • Open putty application, connect to serial port (COM1-30) -select yours one0.
  • Wait for fully load of gateway, connect RX wire to UART.
  • You will see all messages of gateway.
  • 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…
  • Check your param by command psm-get network.open_pf to be sure its OK.
  • Turn off gateway.
  • Turn it ON.
  • Check your port.
1 Like

many thanks for this reply, it looks like a good solution. Will try it soon, many thanks again!

Finally found some time to try the solution above. It perfectly worked for me, I connected to the gateway by UART and activated ports opening. Now the gateway and all its devices are available in HASS.
The most complex part for me was about special screwdriver (u-profile), I didn’t have the one and had to find some workaround :slight_smile:
I used speed 115200 to connect via putty. Thanks to everyone who was helping!

I’ve added a second gateway to my network - did the open lan connection first, then upgraded (twice) - seems to work.

Just getting courage to do the primary

Is it a square or round text gateway ? The square text ones seem to be fine for upgrade without soldering etc as I understood, it’s the round text ones that will cause troubles

Did you look at the pic? The serial connection hack soldering is shown in the pic, you can see the shape of the gateway.

That’s not what I mean, look at the full topic here https://community.openhab.org/t/solved-openhab2-xiaomi-mi-gateway-does-not-respond/52963/77

@walaj there are 2 versions one with square text one with round text, the square text ones seem to be ok and can be upgraded without the need of soldering etc.

OK I see what you mean.

Both my original and the new one have the ‘round text’ of the new hardware. And both have now been upgraded successfully.

I think the important point is that you must open LAN access first before any upgrade.

@walaj I can confirm what walaj is saying. I installed a new one with round text, new hardware, yesterday. Installed it without upgrading firmware, opened access and configured it in Openhab and added a smoke detector. Will be testing HA tonight but there is no reason why the result would be different as it uses same principle to communicate with the Xiaomi hub.

I was planning to leave it on the old firmware as I don’t feel like soldering but @walaj’s post encouraged me to give it a try.

Upgraded firmware this morning and it’s still working fine, the gateway as well as the smoke detector.

So it is fine to upgrade as long as you enable LAN mode first before upgrading. Also using latest IOS version of Mi home app, so nothing special there.


I too finally got around to connecting to the gateway via the serial interface. I managed to open port 9898 and HA detects the gateway just fine. The connected rocker switch and motion sensor also work fine. The only thing I can’t get to work is controlling the light on the gateway. I can turn it on, but not off. Also the light sensor doesn’t change its values.

I experienced the same behavior before I opened port 9898, but the difference is that back then when I turned on the gateway light in HA, the switch flipped back to the off state. Now that the port is open, it stays in the ‘on’ position.

When still connected to the serial interface via Putty, I notice that when I turn the gateway light on via HA, it registers the command ({“id”:52,“method”:“props”,“params”:{“rgb”:1694498815}}. But when I turn it off, no command registers in the terminal window. By the way, when I turn it on via the Mi Home app, it displays a different message “{“id”:56,“method”:“props”,“params”:{“light”:“on”,“from.light”:“4,”}}”
When I turn it off in the MiHome app, it shows “{“id”:54,“method”:“props”,“params”:{“light”:“off”,“from.light”:“4,”}}”.

I have another gateway (with square text) and that one works fine.

I tried:

  • a factory reset of the gateway (by removing it from the app and another time by holding down the button on the gateway)
  • Toggling the LAN mode
  • regenerating the LAN key (5 times).

Any ideas what could be the issue here?

Sounds like you need to post a github issue.

Thanks. Just did that: https://github.com/home-assistant/home-assistant/issues/20329

Anyone have any updates on if the most resent firmware is working?

I rebooted my hass and lost one of my gateways and can’t get it back - not sure if I should risk trying to upgrade firmware.