[SOLVED] Openhab2 - Xiaomi Mi Gateway - does not respond

Tags: #<Tag:0x00007f617358d488> #<Tag:0x00007f617358d3c0> #<Tag:0x00007f617358d2a8>

Hi,

I am having the same issue.as Oguz Kekec.
No answer in Putty on the Xiaomi Hub serial port.
Interface wired as : Tx-Rx, Rx-Tx, GND-GND

If I hit return in Putty, Hub remains blinking.
If I don’t hit return in Putty, Hub goes from blinking to fix blue light (standard behavior)

Any clue ?

Are you sure you turn on the gateway without connecting the RX gateway that you need to connect after turning on the gateway?

Thank you for fedd back.

When I apply AC to the gatewy, the serial link is not connected (Rx, Tx, GND not connected).
Just after applying AC to the gateway, I connect the serial link (Tx, Rx, GND) between the PC and the gateway and send “enter” with Putty.

I am using the EU version of the gateway of course.

maybe this is the problem? I opened ports in Chinese the other day, everything went smoothly.

My understanding is that the serial trick was for the EU version as Cadavre explained it on March 28.

I did it with the Chinese version

Solved! If you faced with that issue “psm_set_variable() failed with: -1”- use psm-delete network.open_pf and then psm-set network.open_pf 3. :smile:

Did you manage to enable services that allow to use Aquara EU Hub (Homekit) within Openhab?

2 Likes

I am not working with OpenHAB, but with HomeAssistant.:frowning_face:

My understanding is do the serial trick to enable the EU services whether you run afterwards OpenHAB or HomeAssistant.

May be I miss something.

Continuing the discussion from [SOLVED] Openhab2 - Xiaomi Mi Gateway - does not respond:

Hi cadavre, i see that you finally figured out to connect the hub to HA.
I soldered and connected to UART and I’ve managed to get factory test mode. But when I exit it, it asks for login info. which I don’t know what they are. I’m stuck at this point. It drives me crazy. Could you please help me. I’m all newbie these stuff. I couldn’t understand how I will be able to reset password. Even don’t know how I will boot into bootloader and enter printenv command. :confused:

btw: My hub is DGNWG05LM. Its from Mi Smart Sensor Set global version

Hello!

I followed up your intructions with same hardware. it worked well.
I tried to open the ssh port with insert dropbear -p 22 with nano
i was root and CTR-X - save and overwrite.
I tried rebbot with device, but it was unreachable with mi home and it seems to be in …like i was connected with uart, but it wasnt
ok, reconnect with uart and check the boot. it booted but it seems.
i wiped out the rc.local file somehow.
can i got a copy of yours, or how can i restore it? :expressionless:

Thx!

Hi there,

I´m new in every direction. Nevertheless I managed to buy and install lots of shelly and xiaomi gadgets and get them running on their respective apps. Also I got myself a brand new raspberry 4 with 4GB and managed to get openhab running and the network binding installed, as well as the xiaomi mi smart home binding.

I enabled the developer mode on the xiaomi app (IOS), turned on the access and noted the “password”. I tried to connect the gateway like in this video. However, no thing can be found. I tried manually but with no success.

Eventually I found this thread. I have the xiaomi gateway, not aquara. In the app it says “lumi.gateway.v3”. Next step I´ll try to find out whether port 9898 is open. Although I don´t know how, yet. Any easy description? Additionally I´ll try to find out what the following things mean:

  • nmap
  • putty
  • monkeycom
  • UART
  • tcpdump
  • MQTT

If I find a definition for dummies I´ll share. If there´s is a" how to use", tutorial or something already I appreciate a link.

Meanwhile some questions for you:

  1. If the port 9898 is closed, is soldering and UART the only solution?
  2. I thought of a zigbee stick as an alternative. This thread suggests that a zigbee stick with the zigbee binding is not working well. Is this a good alternative to point 1, or not?
  3. What is zigbee2mqtt? This thread says there is a binding but the addon list does not say so. Is this an alternative and how does it work?
  4. The gateway cannot reach the sensor in the garage. If I read this right, xiaomi range extention is only possible with another xiaomi device with AC power? Correct?

Thanks so far

restore from /etc/rc.local.mi, cmd: vi /etc/rc.local->:r rc.local.mi->Esc->:wq

Managed to empty out my rc.local file and save it by accident, had some putty terminal issue. Does anyone have a copy for the aqara gateway, its the one with all the RX, TX, GDN pins on the side of gateway? @cadavre

I dont even have such a file unfortunately to try…

If you want to restore things what you need to do is:

  1. login with root and your password
  2. execute the following command: ./reset.sh

This will do lots of things and do a factory reset, including restoration of rc.local file to its original form. Does not reset bound devices as it turns out or your root password and username.


The issue was that Rx and Tx were reversed from the description.
With a CP2102 module, it worked for me with this wiring :

  • Gateway GND - CP2102 GND
  • Gateway Tx - CP2102 TxD
  • Gateway Rx - CP2102 RxD

Now, I am stuck with SSH access not working with Putty,
I have done what is suggested here :


I don’t know how to have Putty using the dropbear public key.

So. I´m back. I managed to get the xiaomi gatway v3 connected to openhab. I know it´s solved already, but I found it hard to follow as an absolute beginner. That´s why I will explain it again so that maybe more beginners are confident to try.

Beginner to Beginner: How to connect xiaomi gateway to openhab

You need:

  • A special bit to open the housing of the gateway. Picture 1. It´s called “security bit” I went to local “Würth” dealer in Germany where they had one and opened it for me. Then replace by normal screws of similar size.
  • UART to USB tool. I used this one.
  • Maybe the driver to run it. I needed this one for windows.
  • PuTTY. A software to send commands via UART to the gateway. Also to communicate to openhab if desired.
  • nmap / zenmap. This software is used to scan the network.
  • Soldering equipment

Steps

  1. UART and gateway power off.
  2. Get your gatway running with the xiaomi app (I used Ios/Iphone). Click on the gateway, top right “…” will bring you to settings. Click “About”. Click 5 times on the white area until the secret menu/developer mode pops up. Looks like picture 2. Enable the switch and note or screenshot your password. Picture 3.
  3. Start soldering like picture 4. Connect the blue cable to"GND" on the UART. Connect the brown cable to “RXD” (Receiver) on the UART.
  4. Connect UART to Computer.
  5. Check the device on your device list to find the COM. If your device doesn´t show the COM number you might need the driver. See above. Picture 5.
  6. Open PuTTY. Select serial and your COM port of the UART. Set Speed 115200. Don´t open yet.
  7. Turn on the gateway / connect to power. I recommend to put it in a power plug with flip switch for the time.
  8. Press open in PuTTY. A Window opens. You will see the messages of the gateway. Wait until the gateway finnished booting.
  9. Connect the red cable to “TXD” (transmitter) of the UART. Now you are able to send commands to the gateway.
  10. Send command: psm-set network.open_pf 3 send it a few times to be sure.
  11. Check for success with command psm-get network.open_pf. It will say something like networkopen = 3
  12. Turn gateway off. Wait. Turn it on again.
  13. Open nmap. Picture 6. Put nmap -sU -p 9898 -Pn 192.168.178.48 in the action line and execute. You have to take your gateways IP adress. You should see that the port is open. If not, try again.

Video. You may find these two videos usefull. Video 1. Video 2.

This is not my knowledge. I just try to describe it with other words like it would have made it easier for me as non-tekkie. Thanks to all of you for sharing your knowledge.

4 Likes

I have followed this procedure :

But when I want to enter the " psm-set network.open_pf 3" command, I get “-sh; psm-set: command not found”.
I was logged in as root.

Any idea of what is happening ?

Does anybody know where are located the psm-get and psm-set commands ?
find . -name psm doesn’t return an answer.


Hi cadavre,

I followed your description to change root password.
My gateway is still fonctionning but I can’t reproduce some instructions.
nmap -Pn -sU 192.168.1.25 -p 22,9898 gives
22/udp closed ssh
9898/ udp closed monkeycom

As port 22 is closed I can’t ssh

Furthermore the psm-set and psm-get commands are not known
-sh: psm-set: command not found

Do you have any idea of what is going on ?

Can someone tell me why i can’t write te command in putty? I see all the messages. It doesnt stop and i can’t write anything. Thx