I have 2 gateways (lumi.gateway.v3). With xiaomi_aquara integration, no problem, both of them are discovered and I can add them and their entities to HA.
I wanted to add the alarm and for this I have to use xiaomi_miio integration. Both of my gateways are auto discovered but when I want to add them, one of them is not able to find any entity (the one with the most devices connected) but it told me that connection was a success...
The other one is working like a charm, entities are discovered and alarm status is synched without any problem.
Both of them are configured the same way with API access and a valid token.
arch | armv7l
-- | --
chassis | embedded
dev | false
docker | true
docker_version | 19.03.8
hassio | true
host_os | HassOS 4.11
installation_type | Home Assistant OS
os_name | Linux
os_version | 4.19.127-v7
python_version | 3.8.3
supervisor | 229
timezone | Europe/Paris
version | 0.113.1
virtualenv | false
configuration.yaml
2020-07-28 16:24:57 ERROR (MainThread) [homeassistant.components.xiaomi_miio.gateway] DeviceException during setup of xiaomi gateway with host 192.168.1.27
Hey there @rytilahti, @syssi, mind taking a look at this issue as its been labeled with an integration (xiaomi_miio) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
Ping @starkillerOG! @starkillerOG you should add yourself to the CODEOWNERS (at least for the xiaomi_miio/gateway.py).
I have actully hered from 3 or 4 users already that discovering subdevices fails if there are to many devices connected to the gateway, I think like +25 devices or something although the treshold is totally unknown....
If that discovery fails the component will also fail to setup.
I think the problem is that the message from the gateway becomes to big if there are too many devices connected and eather the gateway is unable to sent the message beacause it is to big, or python-miio is not able to receive the message beacause it is to big.....
Not sure how to go about solving this.
Other people with the same issue:
https://community.home-assistant.io/t/xiaomi-gateway-alarm/213638/7
https://github.com/rytilahti/python-miio/issues/650#issuecomment-643493440
There is some progress on getting the subdevice list from the cloud, see https://github.com/rytilahti/python-miio/issues/728#issuecomment-662095678
When that gets implemented we won't need the command to get the subdevice list directly from the gateway anymore and this issue will go away.
Thanks for your replies.
Gateway1 (not discovered) : 31 devices connected in mi home app
Gateway2 (discovered) : 10 devices connected.
Maybe you're right with the size of the message that became too large.
@prigal you could try moving your devices from Gateway1 to Gateway2, then rebooting both gateways (unplug and plug back in) and then restart HomeAssistant and see if the problem is then reversed (gateway1 works and gateway2 starts to fail).
That would confirm the problem is in too many devices.
@prigal Moreover, are both gateway on the same firmware version?
Yes they are.
About changing all devices from gateway1 to 2 it's nearly impossible, I have 2 gateways because of walls and long house and most of devices are glued to doors and windows or walls. I'll give a try but not sure to be able to move more than 4 or 5 devices.
omg, i'm tired :) I just have to exchange gateway places !
I tried to change the devices from gateway 1 to 2 balancing the devices (+ or - same number of devices on the gateways), the problem remains.
@matteos1 was the same gateway still giving problems and the other still working while now the gateway that is working has more devices than the gateway which is not working?
How many devices do the gateways have?
@starkillerOG
Yes, this is the situation. I added a new gateway to divide the devices but now neither of the 2 gateways are available.
Below I attach the list of devices.
**Bis
网关ID: 57533707
Zigbee通道: 11
网关信息:
{ otustat=[389,389,1464,9,1447,21], mac=34:CE:00:8B:F1:58, life=38452, hwver=MW300, ottstat=[0,0,0,0], wififwver=SD878x-14.76.36.p84-702.1.0-WM, fwver=1.4.1176, mmfree=163176, netif={ gwmac=5C:49:79:42:37:D0, mask=255.255.255.0, gw=192.168.1.1, localIp=192.168.1.90}, ap={ bssid=34:CE:00:66:1E:11, rssi=-51, ssid=TPLINK-ROOT}, cfgtime=0, mcufw_ver=0220, ot=otu, token=ce72a4712ff8061ffd7d1dfd240a152f, model=lumi.gateway.v3}
子设备信息:
{ Model: lumi.sensorht.v1,did: lumi.158d0000edbf0c,name: Sensore di temperatura cucina }{ Model: lumi.sensorswitch.v2,did: lumi.158d00016d9d16,name: tv xbox }{ Model: lumi.sensorcube.v1,did: lumi.158d0001035838,name: Sensore a cubo cucina }{ Model: lumi.sensor86sw2.v1,did: lumi.158d00010b72e8,name: aqara muro cucina }{ Model: lumi.sensormotion.aq2,did: lumi.158d0002236b7e,name: Sensore di movimento esterno cucina }{ Model: lumi.sensorswitch.v2,did: lumi.158d00022c3946,name: ikea }{ Model: lumi.sensormotion.aq2,did: lumi.158d0001d6b01c,name: Movimento cucina interno }{ Model: lumi.sensormotion.v2,did: lumi.158d0000fd7ded,name: Mi Motion Sensor }{ Model: lumi.sensorswitch.v2,did: lumi.158d0001a3fbbb,name: tv caldaia }{ Model: lumi.sensor86sw2.v1,did: lumi.158d00012a7ed3,name: aqara mobile cucina
Cucina
网关ID: 44683300
Zigbee通道: 11
网关信息:
{ otustat=[424,448,3125,12,3064,107], mac=F0:B4:29:9A:46:13, life=35691, hwver=MW300, ottstat=[4,0,1114,345], wififwver=SD878x-14.76.36.p84-702.1.0-WM, fwver=1.4.1176, mmfree=144400, netif={ gwmac=5C:49:79:42:37:D0, mask=255.255.255.0, gw=192.168.1.1, localIp=192.168.1.43}, ap={ bssid=5C:49:79:42:37:D2, rssi=-43, ssid=FRITZBOX7490}, cfgtime=0, mcufw_ver=0220, ot=otu, token=825b7a9a7e819eb7e97fa3236633994f, model=lumi.gateway.v3}
子设备信息:
{ Model: lumi.sensormagnet.v2,did: lumi.158d00015615db,name: Porta detersivi }{ Model: lumi.plug.v1,did: lumi.158d00010f3025,name: sateki divano }{ Model: lumi.plug.v1,did: lumi.158d00010ac8ad,name: luce centrale }{ Model: lumi.sensormagnet.v2,did: lumi.158d0000e91709,name: Finestra sx }{ Model: lumi.sensormagnet.v2,did: lumi.158d00015c854b,name: Caldaia }{ Model: lumi.sensormagnet.v2,did: lumi.158d0001720746,name: Scolapasta }{ Model: lumi.sensormagnet.aq2,did: lumi.158d0001a3e52b,name: Pentole }{ Model: lumi.sensormagnet.v2,did: lumi.158d000159ff90,name: caffe }{ Model: lumi.sensormagnet.v2,did: lumi.158d000156508e,name: Porta pasta }{ Model: lumi.sensormagnet.aq2,did: lumi.158d0001a3decd,name: Lavastoviglia }{ Model: lumi.plug.v1,did: lumi.158d000163fbb8,name: Mensola }{ Model: lumi.sensormagnet.v2,did: lumi.158d00019fbdc6,name: Porta sale }{ Model: lumi.sensormagnet.v2,did: lumi.158d0001564eff,name: Porta olio }{ Model: lumi.weather.v1,did: lumi.158d0002b54708,name: Cucina esterna }{ Model: lumi.sensormagnet.v2,did: lumi.158d00019fac82,name: Vetrinetta bicchieri }{ Model: lumi.sensormagnet.aq2,did: lumi.158d0001a1f4bb,name: Porta immondizia }{ Model: lumi.sensormagnet.v2,did: lumi.158d0001565000,name: Porta lavatrice }{ Model: lumi.sensormagnet.v2,did: lumi.158d0000f8009d,name: finestra dx }{ Model: lumi.ctrl_86plug.aq1,did: lumi.158d00022f3c86,name: Presa a parete }{ Model: lumi.plug.v1,did: lumi.158d0002366d21,name: Ventilatore }**
@matteos1 I don't know why it would not work, so also do not have an idea how to solve it.
I think best option is to wait untill someone implements the code to get the device list from the cloud.
There is already some example python code that is supposed to work and get the device list from the cloud, see the latest comments in: rytilahti/python-miio#728 (comment)
However I will not have any time to work on that in the comming weeks....
when it will be possible to access the new platform via cloud for xiaomi gateways?
I have a smilar issue. Logs:
2020-08-26 01:45:19 DEBUG (SyncWorker_2) [miio.miioprotocol] Discovered 13d4a358 with ts: 2020-08-25 22:45:18, token: b'ffffffffffffffffffffffffffffffff'
2020-08-26 01:45:19 DEBUG (SyncWorker_2) [miio.miioprotocol] 192.168.1.14:54321 >>: {'id': 102, 'method': 'miIO.info', 'params': []}
2020-08-26 01:45:19 DEBUG (SyncWorker_2) [miio.miioprotocol] 192.168.1.14:54321 (ts: 2020-08-25 22:45:18, id: 102) << {'partner_id': '', 'id': 102, 'code': 0, 'message': 'ok', 'result': {'hw_ver': 'Linux', 'fw_ver': '1.4.6_0012', 'ap': {'ssid': 'MGTS_GPON_ADFB', 'bssid': 'c0:9f:e1:ad:54:ea'}, 'netif': {'localIp': '192.168.1.14', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}, 'model': 'lumi.gateway.mgl03', 'mac': '64:90:C1:7A:32:6B', 'token': '*********', 'life': 7444}}
2020-08-26 01:45:19 DEBUG (SyncWorker_11) [miio.miioprotocol] 192.168.1.14:54321 >>: {'id': 103, 'method': 'miIO.info', 'params': []}
2020-08-26 01:45:19 DEBUG (SyncWorker_11) [miio.miioprotocol] 192.168.1.14:54321 (ts: 2020-08-25 22:45:18, id: 103) << {'partner_id': '', 'id': 103, 'code': 0, 'message': 'ok', 'result': {'hw_ver': 'Linux', 'fw_ver': '1.4.6_0012', 'ap': {'ssid': 'MGTS_GPON_ADFB', 'bssid': 'c0:9f:e1:ad:54:ea'}, 'netif': {'localIp': '192.168.1.14', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}, 'model': 'lumi.gateway.mgl03', 'mac': '64:90:C1:7A:32:6B', 'token': '*********', 'life': 7444}}
2020-08-26 01:45:19 DEBUG (SyncWorker_11) [miio.miioprotocol] 192.168.1.14:54321 >>: {'id': 104, 'method': 'get_device_prop', 'params': ['lumi.0', 'device_list']}
2020-08-26 01:45:19 DEBUG (SyncWorker_11) [miio.miioprotocol] 192.168.1.14:54321 (ts: 2020-08-25 22:45:18, id: 104) << {'error': {'code': -5015, 'message': 'device not found'}, 'id': 104}
2020-08-26 01:45:19 ERROR (MainThread) [homeassistant.components.xiaomi_miio.gateway] DeviceException during setup of xiaomi gateway with host 192.168.1.14
@oleg-l I see you have a lumi.gateway.mgl03 that gateway has not be tested before because I do not own one and had not found anyone yet that had one.
Would you be willing to help implement support for the lumi.gateway.mgl03?
@oleg-l could you run the following python code and see what you get as a response:
from miio import Gateway
gateway = Gateway("192.168.1.IP", "TokenTokenToken")
print(gateway.send("get_device_list"))
Hello @starkillerOG !
Surely, I'll do my best.
The output of your script is:
[{'did': 'lumi.158d000445dd37', 'model': 'lumi.sensor_ht.v1', 'num': 1, 'total': 1}]
@starkillerOG Yesterday I've opened issue in python-miio project https://github.com/rytilahti/python-miio/issues/807
Also, I've got to know about alternative solution - https://github.com/AlexxIT/XiaomiGateway3
I will continue the discussion in rytilahti/python-miio#807
Hello! I have also the same issue.
As I understood, there is no solution so far.
My Gateway is lumi.gateway.v3, MAC 04:CF:8C:::**, port 9898 is open. FW - 1.4.1_176.
@starkillerOG: does the number of connected Zigbee devices really matter? As I understood that Xiaomi MIIO component discover WiFi devices over TCP. In my case - it is only gateway themself.
So for those who want to connect their gateway there is only one solution - install HA version 0.112.4.


Most helpful comment
omg, i'm tired :) I just have to exchange gateway places !