Xiaomi Mijia Smart Multi-Mode Gateway (ZNDMWG03LM) support

Something goes wrong when adding a gateway to the HA. I get a message that the configuration has been created, but no new devices and objects are being added.
In the integration logs I get a lot of
2020-10-26 17:54:08 DEBUG gateway3 192.168.88.101 | Read devices
2020-10-26 17:54:08 DEBUG gateway3 Can’t read devices: ‘utf-8’ codec can’t decode byte 0xdb in position 746: invalid continuation byte

ping gateway is ok, telnet is open and i can connect and login
firmware 1.4.6_0012
Xiaomi Gateway 3 v0.7.2

Can’t read devices: ‘utf-8’ codec can’t decode byte 0xdb in position 746: invalid continuation byte

due to the fact that the firmware was downgraded, there were extraneous files from the firmware v1.4.7_0063.

On the advice AlexxIT, I connected via telnet and deleted all files in “/data/zigbee_gw/” except zigbee_gw.db.

this solved the problem

Latest component update can lock firmware updates. Be safe

2 Likes

I switched to ZHA mode and all of my devices work! I have about 40 xiaomi devices and some other like ikea lamps, ikea switches, sockets nad 3 lerlink light switches (3 gang). Everything works great and stable for 3 days!!!
If you have sensors and devices from other manufactures try ZHA mode.

@AlexxIT - i lost my bluetooth flower sensors after switching to ZHA. Bluetooth devices are not supported with gateway in ZHA mode?

@AlexxIT Awesome work, been following this development since the beginning and it made my life so much easier! Thanks!
Short question: Update from 0.7.1 to 0.8.0 with the copy files method, can you verify the step-by-step way to do so? Because the file structure has changed, before it was more straightforward. Just affraid I would loose the integration after deleting all files and replacing them with the 0.8.0 files.
Thanks!

Supported. Are you tried latest v0.8?

Why you don’t use HACS? It’s mutch easier to update custom components.

Hello all,

In first, sorry for my ignorance !

I just bought this gateway.
In order to integrate it into home assistant, I wanted use this integration which looks really good ! But, after adding the gateway, no devices appear !

In the logs, I have a timeout… I don’t know why unfortunately.
Do you have an idea?

Thanks & regards

EDIT >>> Problem with component v0.8.0-0.8.1 (https://github.com/AlexxIT/XiaomiGateway3/issues/94)

for you information - some ali shops already ship ZNDMWG03LM with firmware 1.4.6_0043 (production date 10.2020).

1 Like

After update to v 0.9.1 , my Gateway don’t connect to any BLE device ( 01 lock: ZNMS16LM and 04 flower care:HHCCJCY01). Already restart HASS
Debug log as follow:

2020-11-03 09:33:55  DEBUG    xiaomi_cloud  MiCloud step1
2020-11-03 09:33:55  DEBUG    xiaomi_cloud  MiCloud step2
2020-11-03 09:33:55  DEBUG    xiaomi_cloud  MiCloud step3
2020-11-03 09:33:56  DEBUG    main          Loaded from MiCloud 6 devices
2020-11-03 09:35:02  DEBUG    gateway3      192.168.103.153 | Prepare Gateway
2020-11-03 09:35:02  DEBUG    gateway3      192.168.103.153 | Get devices
2020-11-03 09:35:02  DEBUG    gateway3      Can't read devices: Wrong file signature
2020-11-03 09:35:02  DEBUG    gateway3      192.168.103.153 | Prepare Gateway
2020-11-03 09:35:03  DEBUG    gateway3      192.168.103.153 | Get devices
2020-11-03 09:35:04  DEBUG    gateway3      192.168.103.153 | Setup Zigbee device {'did': 'lumi.0', 'model': 'lumi.gateway.mgl03', 'mac': '0x588e81fffe5bf603', 'type': 'gateway', 'init': {'firmware lock': False}}
2020-11-03 09:35:04  DEBUG    gateway3      192.168.103.153 | MQTT connected
2020-11-03 09:35:04  DEBUG    gateway3      192.168.103.153 | gateway <= {'online': True}
2020-11-03 09:35:07  DEBUG    gateway3      192.168.103.153 | gateway <= {'networkUp': True, 'networkPanId': '0x0510', 'radioTxPower': 0, 'radioChannel': 20}
2020-11-03 09:35:14  DEBUG    gateway3      192.168.103.153 | Wrong BLE input: b'[20201103 16:35:14] [D] ot_agent_recv_handler_one(): fd:18, msg:{"method":"_async.ble_event","params":{"dev":{"did":"blt.3.12oni6pdceg00","mac":"C4:7C:8D:6A:98:2A","pdid":152},"evt":[{"eid":4105,"edata":"0901"}],"frmCnt":128,"gwts":1604396114},"id":740579}{"method":"local.query_status","params":"","id":740580} length:247 bytes'

Just wondering what is data flow now when this component exposes mqtt to the outside.
As I understood this component publishes messages on pub mosquitto topic “zigbee/recv”. GW app (/usr/app/bin/zigbee_gw) is subscribed to this topic, processes them, and republishes to chip’s built-in MQTT on topic “gw/{ID}/commands” (using zcl commands) which then sends data to devices. Is that right?
I tried to implement scene transitions for lights. ZCL commands have the possibility to pass “transtime” in ms as second argument for level control cluster to make transition on ?device level? (i.e. zcl level-control o-mv-to-level 96 9000). Tried to send this command via MQTT gw/{ID}/commands topic and transition worked well on ikea gu10 bulbs.
As experiment, I implemented transition in component level, which worked well. However, I’m not sure how to deal with long-running transitions (i.e. morning wake up light scene) so they don’t block event loop (I’m not very familiar with HA internals yet).

Dear AlexxIT many thanks for the integration!
I’ve bought Gateway 3 only to use Aqara Opple, but how to manipulate it via your integration ?
I can’t make any automation like turn on/off smart plug or anything.
Kindly ask for some manual or any feedback.

You should be able to add the Opple devices, since they are supported, according to the compatibility list. If they appear, that’s ok. About adding automations: check the home assistant docs. Eg. have You added the folowing line to the configuration.yaml?
automation: !include automations.yaml

Dear AlexxIT!

Wondering what your future plans are for integration? What developments are expected?
You could write a little summary about future plans - if you think :slight_smile:

I am currently using the Xiaomi ZNDMWG03LM gateway with your integration and the Zigbee2MQTT component with a CC2531 dongle in parallel.
I assigned some of my zigbee devices to one, the rest to the other system. Both system working very well, parallel. (although the CC2531 had to be soldered to an antenna for better reception)

My big dilemma is which system to use. I like the Xiaomi Gateway because it runs in parallel with MI Home, so I also have a cloud-based option that I think is supercool.

Zigbee2MQTT, on the other hand, is more widely used, appears to be more common, but the CC2531 has limitations (handling a limited number of devices, semi-finished, not fully stable ZigBee 3.0 support, etc.).

What do you think, AlexxIT, is it possible that one day, somehow Your solution will be part of the Zigbee2MQTT package? Or the two solutions will be connected some other way? And what about the ZHA component? (I haven’t even tried this …)

For example, the Zigbee2MQTT project has a repeater firmware for the CC2531. Is there a way to possibly use this in your integration? (it would be good because then I could use my two CC2531 dongles to extend signal coverage of the ZNDMWG03LM :slight_smile:
So I’m interested about what are the future plans with the integration? What improvements are You working on?

And thanks for Your efforts so far! :smiley:

EDIT: Is there a way to use the beep function of the ZNDMWG03LM? It beeps only during pairing, or if I press the buttons on connected devices. It has some kind of Guard function (not tested yet), which can give alarm tones, and can be enabled from Xiaomi Home app…

@AlexxIT I hope you can help.

I had the Xiaomi Gayeway 3 integration installed and it was working fine

I then inadvertently upgraded the firmware on the hub. I downgraded the firmware on the hub to the previous (working) version and the hub boots ok into 1.4.6_0012.

I deleted the hub from the app and re-paired it.

I deleted a device from the app and re-paired it with hub.

I deleted the the Xiaomi Gayeway 3 integration from Home Assistant and re-installed it with the new token
.
The integration appeared to load ok but no Device or Entity was created for the Hub or the attached Devices.

I turned on Debug and the following message is displayed several times whilst the integration is being installed.

2020-11-11 22:04:28 DEBUG gateway3 192.168.0.202 | Prepare Gateway
2020-11-11 22:04:28 DEBUG gateway3 192.168.0.202 | Get devices
2020-11-11 22:04:28 DEBUG gateway3 Can’t read devices: ‘utf-8’ codec can’t decode byte 0xdb in position 3711: invalid continuation byte

Any ideas ?

Goto GitHub and check closed issues. You need clean some files after new firmware

@AlexxIT Thank you for that. All working now. Might be worth adding solution to pinned ‘Downgrade firmware instruction’ documentation. Thank you again.

@AlexxIT Maybe this closed issue, since it seems important, keep it closed and pin it, so others can see it?

Dear Folks, finally I found a way to control my yeelight mesh lights with home assistant. Unfortunately not with this Mult-Mode Gateway. For more Detail feel free to contact me.

Why the secrecy? :smiley:
Please do share…