Xiaomi Mijia Smart Multi-Mode Gateway (ZNDMWG03LM) support

Hi, I have the same issue: gateway ip and token are correct, integration is succesfull, but no device is shown.
I have now 9 LYWSDCGQ/01ZM temperature sensors connected to the gateway since yesterday, many reboots, but still no devices in HA.

Now I have got next errors in infinity loop:

2020-09-09 13:39:02 DEBUG (Thread-17) [custom_components.xiaomi_gateway3.gateway3] Can't read devices: Invalid base64-encoded string: number of data characters (57) cannot be 1 more than a multiple of 4
2020-09-09 13:39:02 DEBUG (Thread-17) [custom_components.xiaomi_gateway3.gateway3] 192.168.0.103 | Try enable telnet
2020-09-09 13:39:02 DEBUG (Thread-17) [custom_components.xiaomi_gateway3.gateway3] 192.168.0.103 | Read devices

Maybe you can add into log response of Gateway?

Miio API for Xiaomi Light Sensor (ZB3) and all other sub devices - VERY different! Commands and parameter names are different.

v0.2.1 and v0.2.2 don’t support gateway firmware 1.4.6_0030. Fix in development.

1 Like

i know the api. like i said i could control aqara plug eu with miio before, when mgl03 had factory firmware.

May be you know how to get BLE device list? Command get_device_list receives only ZB devices.

from api, device<>cloud traffic or sql db at /data/miio/mible_local.db. same way for mesh devices.

Tried v0.2.3, no change as of yet, still no devices detected. I’m connected to Xiaomi French servers, not sure if that would make any difference though

My gate way firmware v1.4.6_0030 connect by MiHome app with Chinese mainland region setting.
Try v0.2.3, but still no device detected. While set in configuration.yaml: debug:True, have a notify about log but it is empty.

My current fw is 1.4.6_0012, server: Hungary, but same output, no devices.

Oh, yeah!
It’s work on version v0.2.3. Many thanks to you!

@AlexxIT
ZNCZ02LM - tested. Works correctly.
chrome_2020-09-10_13-05-52

Also works Flower Care (http://www.huahuacaocao.com/product) by BLE. And lumi.plug.mmeu01 ZNCZ04LM
You can add this into tested devices list.

1 Like

fw 1.4.6_0012 here for my Xiaomi Gateway 3 regardless of which server I connect to.
Unable to see my temp and humidity sensors (LYWSDCGQ/01ZM) with 0.2.3
I just reset everything, switched to Chinese server & obtained my new apikey, no change

the device bootloader check sum of both kernel & rootfs.
checksum is in /dev/mtd1, so if you change rootfs without correct checksum, the device can’t boot.
but according to my experience, the device should change to another kernel & rootfs.

compare mtd1 and result of boot_ctrl show, i guest data format of mtd1 is:

  uint8_t magic[2]
  uint8_t zero[2]
  uint8_t checksum[2];   //checksum of mtd1 data
  uint16_t current_kernel_partition
  uint16_t current_rootfs_partition
  uint32_t kernel0_size;
  uint16_t kernel0_checksum
  uint8_t  zero
  uint32_t kernel1_size
  uint16_t kernel1_checksum
  uint8_t  zero
  uint32_t rootfs0_size;
  uint16_t rootfs0_checksum
  uint8_t  zero
  uint32_t rootfs1_size
  uint16_t rootfs1_checksum
  uint8_t  zero
  uint16_t root_sum_check;
  uint16_t priv_mode;
  char bversion[14]

both usr/bin/boot_ctrl & usr/bin/fw_update access mtd1

rootfs checksum check is disabled by default. only kernel is checking during boot

BLE devices (LYWSDCGQ/01ZM) correctly detected within 5 minutes on v0.2.4


Thanks @AlexxIT !
(Since posting this i’m also seeing 1 battery sensor out of 3 - so the other 2 will show soon) :slight_smile:

Hi there, new in this Smart Home World.
I’ve got the following prerequisites:

  • Philips HUB managing IKEA and Philips BULBS
  • Freshly got (for testing) a Gateway V3 ZNDMWG03LM with two aqara switches (2016 variants) WXKG03LM. On this one i intend to add Window/door sensors, presence sensors, temperature, leak sensors, etc.
  • QNAP TS251 with Home Assistant 0.114.4 running on a DOCKER (in container station on same ip with QNAP but with on port 3421 of course (docker set on NAT Network mode an with port forwarding 3421 to container 8123)
    I can well control my HUE devices via default HA integration and would like to add the Xiaomi devices without Conbee or other zigbee extensions.

Since there is only few weeks that MI APP permits to add this new gateway this is what i saw.

Set on Europe, can’t add the Aqara Switches (says hub is incompatible) . Thumbs down Xiaomi.
While setting on China Server, you can add them easily

Next,

I tried adding the gateway to HA with both of the already existant integrations: Xiaomi Miio and Xiaomi Gateway (Aqara) as both state they can integrate the V3 hub.

  1. On Miio, i managed to get AN (not sure if the correct) access token, after paired the Gateway with my iPhone MI APP, via SQL command

SELECT ZTOKEN FROM ZDEVICE WHERE ZMODEL LIKE “%gateway%”

and it did retrieve a 92 long token but couldn use it in HA (i did unpair the GATEWAY from the app before that).
So putting my Gateway ip Adress 192.168.1.71, the API TOKEN i recovered + Name of Gateway = Gateway - returns the message “User Input Malformed”
-Any other way to recover the token from this hub?

  1. On Xiaomi Gateway (Aqara Package), i can’t seem to access via regular settings.
    The gateway was set-up on a 192.168.1.71 IP but not sure how to write the configuration Key/common config flow/data/ip, etc) to find it.
    Do i have to open any specific port? How do i do that?
    Any suggestions on my HA setup in QNAP Docker? Maybe something blocks?

  2. I am trying with AlexxIT’s package but i still am not sure about the token so come back to the above.
    Also, i installed HACS and i don’t see the sidebar to add custom repository. Any info?

Would like to avoind intermediate HomeKit integration and control everything from HA.

Thanks with V.0.2.4 BLE device read value more often than before. Great work. Donation incoming.

Token length - 32 chars. In future I plan get token automatically with Mi Home user/pass.