Xiaomi Mijia Smart Multi-Mode Gateway (ZNDMWG03LM) support

during the firmware update of my gateway it most likely corrupted, does anyone know how to reinstall to the factory default? The led always turns yellow and when I press the button for a few seconds I get no response.

Integration has stopped working. Reinstalling doesn’t help, Re-adding results in an error
ERROR: Unable to discover the device. Helps

Thanks a lot

Hi Colleagues,

I have the Gateway3 with firmware version 1.4.7_0040.
When I use the command to search network devices (php miio-cli.php --discover all), I see my Hub well in the device list.

IP 172.16.0.172 DevType 164e Serial 381b Token ffffffffffffffffffffffffffffffff

But when I input the command to enable telnet I receive the following error message:

array(4) {
  ["ip"]=>
  string(12) "172.16.0.172"
  ["token"]=>
  string(32) "XXXXXXXXXXX"
  ["debug"]=>
  bool(false)
  ["sendcmd"]=>
  string(35) "{id:0,method:enable_telnet_service,"
}
Соединение с устройством IP 172.16.0.172
Статус отладки [1]
Сокет успешно создан
Команда для отправки - {id:0,method:enable_telnet_service,

Проверяем доступность устройства 172.16.0.172
Параметр SO_RCVTIMEO сокета успешно задан
 >>>>> Отправляем hello-пакет на 172.16.0.172 с таймаутом 5
 >>>>> Отправлено в сокет 32 байт
 <<<<< Получен ответ от IP 172.16.0.172 с порта 54321
Прочитано 32 байта из сокета
magic: 2131
length: 0020 --> 32 байт
unknown1: 00000000
devicetype: 164e
serial: 381b
ts: 00029de6 --> 171494 секунд --> 1970-01-03 02:38:14
checksum: ffffffffffffffffffffffffffffffff
ts_server: 5f82ce49 --> 1602408009 секунд --> 2020-10-11 12:20:09
timediff: -1602236515

Устройство 172.16.0.172 доступно
Параметр SO_RCVTIMEO сокета успешно задан
Используется токен, указанный вручную, - XXXXXXXXXXXXX
 >>>>> Отправляем пакет на 172.16.0.172 с таймаутом 5
magic: 2131
length: 0050 --> 80 байт
unknown1: 00000000
devicetype: 164e
serial: 381b
ts: 00029de6 --> 171494 секунд --> 1970-01-03 02:38:14
checksum: 05aa4d49c75fcfdf31814b9d3d099649
data: fe1d1167857e8540ac6e7cbeea14231252f99f3d0e7ffbf76e086af29ae6115ca76ceee63388b265aa42570170f6e838
ts_server: 5f82ce49 --> 1602408009 секунд --> 2020-10-11 12:20:09
timediff: -1602236515
 >>>>> Отправлено в сокет 80 байт
Ошибка чтения из сокета [11] Resource temporarily unavailable
Устройство 172.16.0.172 не доступно или не отвечает.

Could you please tell me what do I do incorrect?
Thanks.

Hi 0x000,

What firmware version of the Hub (Gateway 3) do you have?

Hi Max,

My Firmware is 1.4.6_0012.

I am able to open telnet and connect. But i cant open the other port

Hi,

Tell me please how have you opened telnet?
Because this time I have the same issue like you had.

Hi Max,

i installed php 7.4 on my raspberry. (Windows diddnt work for me, i got every time a timeout issue)

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo “deb https://packages.sury.org/php/ buster main” | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install -y php7.4-common php7.4-fpm php7.4-cli php7.4-curl php7.4-json php7.4-mysql php7.4-opcache php7.4-gd php7.4-sqlite3 php7.4-mbstring php7.4-zip php7.4-readline php-pear

after install php i download miio:
wget http s://codeload.github.com/skysilver-lab/php-miio/zip/master (REMOVE THE SPACE AFTER HTTP - **this forum only allowed to insert 1 link in a post **)
unzip master

After that go into that unzipped directory.

With this comand it worked for me:

php miio-cli.php --ip 192.168.178.10 --token 65453XXXXXX761515a6XXXXXXa59XX78 --sendcmd ‘{“id”:0,“method”:“enable_telnet_service”, “params”:[]}’

How i conenct:

where did you get hub with firmware 1.4.7_0040? can you check production date from the box? this is probably the reason why you can’t open telnet, they are closing access with new firmwares.

Latest release with Mi Cloud authorization.

Cloud connection is optional. Everything will work without it.

You can use the component to get tokens of other Xiaomi devices - vacuum cleaners, lamps, etc. It is not necessary to have Xiaomi Gateway 3.

2 Likes

Nice job. Will you update the read me about how use it?

Hi Alexey, so should i understand that right now, if we connect to cloud, we can get the token automatically for our gateway, when installing the integration?
Thanks!

Yes. For gateway and other Xiaomi Wi-Fi devices.

Hi,

Thanks for your answer but this method doesn’t work too.

Hi rezmus,

I upgraded the firmware to latest version, I don’t remember which version was on new device.
But one more comment. I tried to use your variant of the command

As the result I receive the following message:

Устройство 172.16.0.172 доступно и ответило:
{"id":1,"error":{"code":-9999,"message":"user ack timeout"},"exe_time":4070}

What does it mean?

it’s possible they closed telnet in newer firmware.

I do not understand how I can use dd, but I go into the bootloader and there is no such thing as dd. please tell me all the way. Thank you for answering.

The PHP 7.4 installation didn’t worked for me for the firs, but then I followed this tutorial, and succeeded:

but after all, i got the russian error message: x.x.x.x device not available or not responding…
So not working.*
I have firmware version 1.4.6_0012 (I’ve got the device today…)

*Final edit:
I reseted everything… Then re-tryed, and works. I think I’ve selected europe for the first time, when I created the Xiaomi Home account. I could change the country, but had to re-pair the ZNDMWG03LM. Now, in the app much more devices shown as supported. I could get the token, as shown in the above video. Then added local connection with the token, and voilà: working.
So seems the key was to initialize the device in cinese region…
The battery levels of devices are not shown, but if you use the Xiaomi home app parallel, that will probably alert, when battery goes low… I’ve tried with MI light sensor, paired, and working well.
(Earlier i used it with zigbee2mqtt, that showed battery percentage too, and showed also raw value of illumination)

So Thank You for Your effort, AlexxIT! :slight_smile:

Hi Alexey! The gateway was successfully connected, but then a reset was made (required), now the sensor readings are not updated in lovelace. Something needs to be done again?

@drnemo What does reset mean? Resetting gw to factory configuration? Then the token changes. You need to remove and add the integration again with a new token.