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

It seems that this command has been removed in the latest gateway software update.
That’s what’s I’ve read in a French forum

@makai

Could you point me to the french forum where you have read this ?

Also, if you have the psm-set and psm-get on your gateway, could you send them to me so I can try them on my gateway ?

Thanks.

Looks like time to stop suporting xiaomi by spending money on their gateways. Use deconz/z2m.

I’m on Deconz since I know what xiaomi is doing! And it’s way better

Hello hmargera. Are you find french forum or psm-set and psm-get files. If you hav it, give me please.

Unfortunately I couldn’t find any topic on french or other forums related to psm-set.
I have created a new entry here dedicated to this problem and haven’t got any answer.
I don’t know if anybody don’t have the psm files or don’t care or don’t understand the question.

I’m sorry. I did everything according to the instructions of the Cadavre. I have access to the controller operating system. But I do not know what to do next. There is a similar topic on community.openhab.org (https://community.openhab.org/t/solved-openhab2-xiaomi-mi-gateway-does-not-respond/52963/188) and the next steps are there, but I’m not particularly good at it. Maybe someone can write instructions on how to connect the necessary ports in the controller.

Do you have access to the psm-set command ?
If not you are stuck as I am.
If yes you just have to type “psm-set network open_pf 3” to open the port that will give access to the gateway.

I have not comand psm-set. I don’t know were is it. Yes i’m stuck as you ). I found on openhab.org (rothm):

At this time, I don’t plan to spend a lot of time on it. My aim is/was just to integrate the gateway with my setup. (that’s why I post as much information as possible here, for someone to pick up)

It looks like issuing a MIIO command (using the token provided in a debug version of the MiHome App for instance) to the gateway would allow a customized OTA package to be processed. The package is just a “tar file” with a script and binaries to apply on top of the current firmware.
So, if this is possible, then:

  • either add a script to /etc/rc.local to replace miio_client on startup*

  • or turn the gateway into a HomeKit one*

  • enable SSH access by launching “/etc/init.d/dropbear start” and setting a default password*

  • -> If someone is willing to test it with his own gateway (and possibly brick it) I can send the files needed (“rc.local” file to patch and the .bin / OTA package) or I can try to create such a custom OTA*

As it looks like it is possible to run the HomeKit client on the mieu01 (binaries are present on the gateway), it might be a simpler way to go.

Concerning the current MQTT implementation, it has been running for the last 5 days without any issue. It’s fast. You can arm/unarm the gateway, turn on/off the light, get events from sensors, …
To me, it looks like it would be a good way to go as it uses the “internal protocol” used by Xiaomi to talk between “miio_client” (which then talk to the Xiaomi cloud) and an agent (“gw” binary is an agent). So developing a binding would be useful for other Mi products. But it would take more time than going directly for HomeKit.

So finally, I might put my stuff on github in a few days. But for it to be valuable, someone would have to create a custom OTA package (because going through soldering takes time…)

-> So it looks like getting a custom OTA package to root the gateway is the most important task
I will try it

OK.
Let us know what you get.

Then it looks like you have a gateway firmware where Xiaomi has disabled psm-set on.

I suggest another zigbee solution. Your sensors are still useful.

Quite why Xiaomi wants to make their gateways inoperable with other solutions is beyond me. Something to do with gathering all you base[1], or delivering advertising I guess.

[1] are belong to us!

Looks like I was lucky to get one of the last gateways with the psm-set command included. It was a pain to do the soldering but at least I got i working.
…and maybe I should take a look at Deconz if I ever approach the limit for number of devices connected to my Xiaomi gateways :wink:

@hmargera & @nikuha58; Be sure to keep us updated if you find a solution.

or zigbee2mqtt.

My gateway have been working about year. Today morning I saw that all my sensor are unavailable. Rebooted everything and no help. After trying and trying I finally checked with nmap and it says ports are closed! Unbelievable! How is it possible…? I haven’t upgraded firmwares for many months.
Only think I did was upgraded my phone software to new android and needed to relogin with Xiaomi app. Can this close ports somehow ?
Maybe I’m forced to open gateway and open ports via serial port…

I opened gateway, soldered wires and connected with Putty. Sent command psm-set network.open_pf 3 few times, check with psm-get network.open_pf - command status which showed result network.open_pf = 3 (1 bytes). So assume it should be okay. Shut down gateway, wires off and power on…Nmap shows:

Nmap scan report for 192.168.1.127
Host is up (0.0060s latency).
PORT     STATE  SERVICE
4321/tcp closed rwhois
9898/tcp closed monkeycom

Aarrgghh… do I have any other option than buy new gateway…? Tried many times, did factory reset etc. Nothing helps. Am I missing something ?

rid yourself of these problems and move to zigbee2mqtt

That could be good option. I was just wondering differences between zigbee2mqtt and Conbee 2 ? Also Nortek HUSBZB-1 looks interesting as I have two Z-wave devices. I have read that two usb sticks in ubuntu with NUC is sometimes challenging to get work.

Always disconnect my gateway from HA. About 1 moth ago it is working good. Not port problem because when I receive the error message after try the nmap and the port are open. What can I do with this? I have zigbee2mqtt with all my sensor but I want to use the gateway for bell night light etc.

Now lost again the connection:
HA show this error in the log:

Logger: xiaomi_gateway
Source: components/xiaomi_aqara/light.py:106
First occurred: 14:03:52 (2 occurrences)
Last logged: 14:03:52

Cannot connect to Gateway
No data in response from hub None

And after try nmap, and show this:

PORT STATE SERVICE

4321/udp open|filtered rwhois

9898/udp open monkeycom

MAC Address: 7C:49:EB:B1:84:37 (Xiaomi Electronics,co.)
Blockquote

So not port problem this cannot connect gateway…

Sometimes after a update to home assistant I need to unplug and replug the xiaomi gateway and then restart ha.

Hi, I would like to ask if it is compatible with (lumi.gateway.v2). Both 9898 and 4321 ports are close and I am trying to open. The port location for the serial communication is different from the others. Will it be able to integrate it to Home Assistant. Btw the model is DGNWG01LM.