Closed terenceng81 closed 3 years ago
Hey there @rytilahti, @syssi, @starkillerog, 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)
I have tried a fresh installation but still encounter the same issue.
wonder why it was working fine.
thanks, terence
Hello, I have the same behavior after changing my router. Before the IP was 192.168.1.103 and now it's 192.168.1.101 resulting to the same error message. But sorry, I don't know where to modify the IP in HA... Any help ? Thanks
Hello, I have the same behavior after changing my router. Before the IP was 192.168.1.103 and now it's 192.168.1.101 resulting to the same error message. But sorry, I don't know where to modify the IP in HA... Any help ? Thanks
I don't really get you.
If you want to change the IP of your router just login to it and change it.
If you want to change the IP of your xiaomi gateway just use static IP for it.
I think this is nothing to do with HA.
The problem is that I don't have access to the xiaomi gateway to change its address IP. After having changed my router, HA is not able to access the router bcause the IP is different. So I have to modify a HA IP config for this device but I don't know where.
The problem is that I don't have access to the xiaomi gateway to change its address IP. After having changed my router, HA is not able to access the router bcause the IP is different. So I have to modify a HA IP config for this device but I don't know where.
I don't think there is an option with your xiaomi gateway to change the IP, if you want to have static IP for it, you have to reserve the IP in your wifi device which should be your wifi router.
You can always re-add the xiaomi gateway in your HA with the IP you want.
Same issue here. Unable to connect Xiaomi Miio device (Air Purifier 3H) to a fresh HA installation Able to ping it from the HA device, and "finishes" the setup by putting in the device model but I get no entities
Running HA on a seperate network with full access between
I solved it on my side. The purifier cannot be on another subnet (per miiocli) After moving the Xiaomi device on the same network as HA I was able to add it
I am facing the similar issue. I've updated the firmware and no success.
`Logger: homeassistant.components.xiaomi_miio.gateway Source: components/xiaomi_miio/gateway.py:47 Integration: Xiaomi Miio (documentation, issues) First occurred: 2:19:08 AM (1 occurrences) Last logged: 2:19:08 AM
DeviceException during setup of xiaomi gateway with host 192.168.XX.XX`
I have the same error. Tried resetting gateway settings but didn't help. Checked on different versions of HA. at 0.118.4 and on almost all versions of 2021. What can be done?
Logger: homeassistant.components.xiaomi_miio.gateway Source: components/xiaomi_miio/gateway.py:47 Integration: Xiaomi Miio (documentation, issues) First occurred: 23:43:04 (1 occurrences) Last logged: 23:43:04
DeviceException during setup of xiaomi gateway with host 192.168.88.176
lets wait for someone to help, hopefully the issue is not with xiaomi's side, thanks!
@rytilahti @syssi @starkillerOG
integration: xiaomi_miio
Unfortunately the error message is not so clear and rather general. (That is my fault since I catched the error and did not log the stack trace, just made a small PR to fix that and make the error log the stack trace)
Could one of you run the following python script:
from miio import Gateway
gateway = Gateway("192.168.1.IP", "TokenTokenToken")
gateway.info()
gateway.discover_devices()
And then report the full stack trace of the error that you get.
rom miio import Gateway
thanks for your reply @starkillerOG
by the way, may I know where to run the script?
the Terminal in Home assistant console? or putty to?
say my xiaomi gateway IP is 192.168.8.183
bash-5.0# python3 xiaomi_test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 194, in send
m = Message.parse(data, token=self.token)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 288, in parse
return self.parse_stream(io.BytesIO(data), **contextkw)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 300, in parse_stream
return self._parsereport(stream, context, "(parsing)")
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 1981, in _parse
subobj = sc._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 2439, in _parse
return self.subcon._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 3557, in _parse
return sc._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 5077, in _parse
raise ChecksumError(
construct.core.ChecksumError: Error in path (parsing) -> checksum
wrong checksum, read b'5bc68ea095c86e08db20e612da4743aa', computed b'a757824e18b8095722a7894da459bc29'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "xiaomi_test.py", line 7, in <module>
gateway.discover_devices()
File "/usr/local/lib/python3.8/site-packages/miio/gateway/gateway.py", line 182, in discover_devices
devices_raw = self.get_prop("device_list")
File "/usr/local/lib/python3.8/site-packages/miio/gateway/gateway.py", line 310, in get_prop
return self.send("get_device_prop", ["lumi.0", property])
File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 178, in send
return self._protocol.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 221, in send
raise DeviceException(
miio.exceptions.DeviceException: Got checksum error which indicates use of an invalid token. Please check your token!
The token was obtained via token_extractor.exe ...
same error to me
linux@linuxvm:~/hascripts$ python3 debug.py Traceback (most recent call last): File "/home/linux/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 194, in send m = Message.parse(data, token=self.token) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 288, in parse return self.parse_stream(io.BytesIO(data), **contextkw) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 300, in parse_stream return self._parsereport(stream, context, "(parsing)") File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 2120, in _parse subobj = sc._parsereport(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 2653, in _parse return self.subcon._parsereport(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 3852, in _parse return sc._parsereport(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) File "/home/linux/.local/lib/python3.8/site-packages/construct/core.py", line 5418, in _parse raise ChecksumError( construct.core.ChecksumError: Error in path (parsing) -> checksum wrong checksum, read b'400bbac826cb6de9abcf2fc55f030212', computed b'98fc166eb74a785830a8b7f9ccd7bf36'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "debug.py", line 7, in
Alright, this means the token you have is wrong. The next HomeAssistant version will have a new config flow that allows to get the token automatically from the cloud so you only need your Xiaomi Miio Cloud username and password.
If you do not want to wait, you can use the following code to print the device info from your cloud account, find the gateway you want to configure and the token schould be listed, then use that token to setup the xiaomi miio integration:
from micloud import MiCloud
cloud_username = "email"
cloud_password = "password"
cloud_country = "cn"
mc = MiCloud(cloud_username, cloud_password)
mc.login()
devices_raw = mc.get_devices(
country=cloud_country
)
for device in devices_raw:
print(device)
print("")
No! This code returns the same token:
{'did': '63217102', 'token': 'afb7498e9a188115d325f08e0e5ed113', 'longitude': 'xxxxxxxx, 'latitude': 'xxxxxxxxx', 'name': 'Gate', 'pid': '0', 'localip': '192.168.88.176', 'mac': '34:CE:00:xxxxxx', 'ssid': 'xxxxxx', 'bssid': '52:FF:20:xxxxxx', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'lumi.gateway.v3', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Alarming Off Light Off FM:Pause ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '1.4.1_176', 'needVerifyCode': 0, 'isPasswordEncrypt': 0, 'mcu_version': '0220'}, 'prop': {'arming': 'off', 'fm_current_status': 'pause', 'light': 'off'}, 'uid': 1765057107, 'pd_id': 109, 'password': '', 'p2p_id': '', 'rssi': -59, 'family_id': 0, 'reset_flag': 0}
Then I run this script:
from miio import Gateway
token="afb7498e9a188115d325f08e0e5ed113"
print(token)
gateway = Gateway("192.168.88.176", token)
gateway.info()
gateway.discover_devices()
And it returns the same result:
bash-5.0# python3 xiaomi_test.py
afb7498e9a188115d325f08e0e5ed113
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 194, in send
m = Message.parse(data, token=self.token)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 288, in parse
return self.parse_stream(io.BytesIO(data), **contextkw)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 300, in parse_stream
return self._parsereport(stream, context, "(parsing)")
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 1981, in _parse
subobj = sc._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 2439, in _parse
return self.subcon._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 3557, in _parse
return sc._parsereport(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/usr/local/lib/python3.8/site-packages/construct/core.py", line 5077, in _parse
raise ChecksumError(
construct.core.ChecksumError: Error in path (parsing) -> checksum
wrong checksum, read b'f4f49bc7e38465084280d2ba3f913f9e', computed b'a2d36497e4861a8d6061127283c330f3'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "xiaomi_test.py", line 10, in <module>
gateway.discover_devices()
File "/usr/local/lib/python3.8/site-packages/miio/gateway/gateway.py", line 182, in discover_devices
devices_raw = self.get_prop("device_list")
File "/usr/local/lib/python3.8/site-packages/miio/gateway/gateway.py", line 310, in get_prop
return self.send("get_device_prop", ["lumi.0", property])
File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 178, in send
return self._protocol.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 221, in send
raise DeviceException(
miio.exceptions.DeviceException: Got checksum error which indicates use of an invalid token. Please check your token!
Same to me.
The same token works perfectly all right previously and one day somehow it just became not working.
@starkillerOG , I can give access to my server for debug.
@enterego very interesting, from your result of the cloud script, it looks like you don't have any zigbee devices connected to the gateway, is that correct?
Even more intresting is that I just noticed that you don't get the checksum error on the gateway.info()
command.
I just checked with my gateway and I do get an checksum error if I supply the wrong token with the gateway.info()
command.
Could you confirm that this script does not produce an error:
from miio import Gateway
gateway = Gateway("192.168.1.IP", "TokenTokenToken")
print(gateway.info())
And then run the same script again and purposely supply a wrong token and check that it then gives you an checksum error.
I think the following is the case: you don't have zigbee devices connected to the gateway, we ask the gateway to give us a list of the connected devices, since there are none, the gateway replays with some messages that is probably malformed or gives an error due to a possible bug in the gateway firmware, that is why the checksums will not match.
@terenceng81 I know from my own experiance that the token changes whenever you reset your gateway or connect your gateway to a diffrent wifi-network. So please do check the token from the cloud script if you did not already do so.
@terenceng81 do you have zigbee devices connected to your gateway, and if so, how many?
from your result of the cloud script, it looks like you don't have any zigbee devices connected to the gateway, is that correct?
no, i just pasted a part of output. I have about 30 devices connected. And maybe some of them are offline. Here is the complete output:
bash-5.0# python3 xiaomi_getid.py
{'did': '65987026', 'token': '3ed35d98dec42cc9d88eb8043fd39158', 'longitude': 'xx.xx678618', 'latitude': 'xx.xx939454', 'name': 'Модем', 'pid': '0', 'localip': '192.168.88.134', 'mac': '34:CE:00:CD:EE:6D', 'ssid': 'xxxxxxxx', 'bssid': '74:4D:28:F1:51:97', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'chuangmi.plug.m1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': False, 'desc': 'Device offline ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '1.2.4_17', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'power': 'on'}, 'uid': 1765057107, 'pd_id': 130, 'method': [{'allow_values': 'on off', 'name': 'set_power'}], 'password': '', 'p2p_id': '', 'rssi': -80, 'family_id': 0, 'reset_flag': 0}
{'did': '63217102', 'token': 'afb7498e9a188115d325f08e0e5ed113', 'longitude': 'xx.xx6602484903', 'latitude': 'xx.xx9467811175', 'name': 'Gate', 'pid': '0', 'localip': '192.168.88.176', 'mac': '34:CE:00:FB:50:46', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'lumi.gateway.v3', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Alarming Off Light Off FM:Pause ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '1.4.1_176', 'needVerifyCode': 0, 'isPasswordEncrypt': 0, 'mcu_version': '0220'}, 'prop': {'arming': 'off', 'fm_current_status': 'pause', 'light': 'off'}, 'uid': 1765057107, 'pd_id': 109, 'password': '', 'p2p_id': '', 'rssi': -59, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00044fe114', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик открытия окон и дверей', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_magnet.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Close ', 'desc_new': '%s Close', 'desc_time': [1624119068], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.close': '{"timestamp":1624119068,"value":[]}', 'event.no_close': '{"timestamp":1624119063,"value":[60]}', 'event.open': '{"timestamp":1624119003,"value":[]}', 'miot_bind_time': '1588853825', 'prop.close': '1', 'prop.device_log': '[1624119067,["event.close",[]]]', 'prop.lqi': '124', 'prop.no_close': '0', 'prop.open': '0', 'prop.open_status': '1', 'prop.s_auth_config': '{"privacyAuthed":true}', 'prop.status': 'close'}, 'uid': 1765057107, 'pd_id': 64, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00045e8b68', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Жёлтая дверь', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_magnet.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Open ', 'desc_new': '%s Open', 'desc_time': [1624113641], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.close': '{"timestamp":1624112516,"value":[]}', 'event.no_close': '{"timestamp":1624113940,"value":[300]}', 'event.open': '{"timestamp":1624113641,"value":[]}', 'miot_bind_time': '1601816614', 'prop.close': '0', 'prop.device_log': '[1624113640,["event.open",[]]]', 'prop.lqi': '76', 'prop.no_close': '1', 'prop.open': '1', 'prop.open_status': '60', 'prop.s_auth_config': '{"privacyAuthed":true}', 'prop.status': 'open'}, 'uid': 1765057107, 'pd_id': 64, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00045e8dfc', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Спальня', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_magnet.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Close ', 'desc_new': '%s Close', 'desc_time': [1624138021], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.close': '{"timestamp":1624138021,"value":[]}', 'event.no_close': '{"timestamp":1624117976,"value":[300]}', 'event.open': '{"timestamp":1624138013,"value":[]}', 'miot_bind_time': '1601816900', 'prop.close': '1', 'prop.device_log': '[1624138021,["event.close",[]]]', 'prop.lqi': '109', 'prop.no_close': '0', 'prop.open': '0', 'prop.open_status': '1', 'prop.s_auth_config': '{"privacyAuthed":true}', 'prop.status': 'close'}, 'uid': 1765057107, 'pd_id': 64, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000461148b', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик открытия окон и дверей2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_magnet.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Close ', 'desc_new': '%s Close', 'desc_time': [1624119040], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.close': '{"timestamp":1624119040,"value":[]}', 'event.no_close': '{"timestamp":1624119339,"value":[300]}', 'event.open': '{"timestamp":1624119040,"value":[]}', 'miot_bind_time': '1588853993', 'prop.close': '0', 'prop.device_log': '[1624119039,["event.open",[]]]', 'prop.lqi': '133', 'prop.no_close': '1', 'prop.open': '1', 'prop.open_status': '60', 'prop.s_auth_config': '{"privacyAuthed":true}', 'prop.status': 'open'}, 'uid': 1765057107, 'pd_id': 64, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0003cc45a7', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик движения Холл', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_motion.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Motion detected ', 'desc_new': '%s Motion detected', 'desc_time': [1624138217], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.motion': '{"timestamp":1624138217,"value":[]}', 'event.no_motion': '{"timestamp":1624138815,"value":[600]}', 'prop.device_log': '[1624138216,["event.motion",[]]]', 'prop.lqi': '94', 'prop.motion': '0', 'prop.no_motion': '600', 'prop.s_auth_config': '{"privacyAuthed":true}'}, 'uid': 1765057107, 'pd_id': 63, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0003e7db79', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик движения Гостиная', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_motion.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Motion detected ', 'desc_new': '%s Motion detected', 'desc_time': [1624127960], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.motion': '{"timestamp":1624127960,"value":[]}', 'event.no_motion': '{"timestamp":1624129757,"value":[1800]}', 'miot_bind_time': '1622608615', 'prop.device_log': '[1624127960,["event.motion",[]]]', 'prop.lqi': '124', 'prop.motion': '0', 'prop.no_motion': '1800', 'prop.s_auth_config': '{"privacyAuthed":true}'}, 'uid': 1765057107, 'pd_id': 63, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001f9f46c', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Switch', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_switch.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Long press ', 'desc_new': '%s Long press', 'desc_time': [1615105277], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.click': '{"timestamp":1615105277,"value":[]}', 'event.double_click': '{"timestamp":1608624875,"value":[]}', 'event.long_click_press': '{"timestamp":1615105277,"value":[]}', 'event.long_click_release': '{"timestamp":1615105275,"value":[]}', 'prop.device_log': '[1615105276,["event.click",[]]]', 'prop.fw_ver': '10', 'prop.lqi': '85'}, 'uid': 1765057107, 'pd_id': 62, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0002ca20b3', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Downlight', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_switch.v2', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Single click ', 'desc_new': '%s Single click', 'desc_time': [1624040144], 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'event': {'event.click': '{"timestamp":1624040144,"value":[]}', 'event.double_click': '{"timestamp":1623333270,"value":[]}', 'event.long_click_press': '{"timestamp":1623052535,"value":[]}', 'event.long_click_release': '{"timestamp":1623052536,"value":[]}', 'prop.device_log': '[1624040143,["event.click",[]]]', 'prop.fw_ver': '10', 'prop.lqi': '124'}, 'uid': 1765057107, 'pd_id': 62, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': '130972516', 'token': 'ab4fe94ab6713ef02aa82fc3043d2113', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Ceiling light2', 'pid': '0', 'localip': '192.168.88.158', 'mac': '04:CF:8C:81:EA:92', 'ssid': 'xxxxxxxx', 'bssid': '74:4D:28:F1:51:97', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'yeelink.light.ceiling1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': False, 'desc': 'Device offline ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '1.5.9_0189', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'nl_br': '0', 'power': 'off'}, 'uid': 1765057107, 'pd_id': 344, 'method': [{'allow_values': 'on off', 'name': 'set_power'}], 'password': '', 'p2p_id': '', 'rssi': -72, 'family_id': 0, 'reset_flag': 0}
{'did': '130972580', 'token': '8245df354ebbf3b5bed8f09f6b2a9080', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Ceiling light', 'pid': '0', 'localip': '192.168.88.149', 'mac': '04:CF:8C:81:EA:D2', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'yeelink.light.ceiling1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': False, 'desc': 'Device offline ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '1.5.9_0189', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'nl_br': '0', 'power': 'off'}, 'uid': 1765057107, 'pd_id': 344, 'method': [{'allow_values': 'on off', 'name': 'set_power'}], 'password': '', 'p2p_id': '', 'rssi': -40, 'family_id': 0, 'reset_flag': 0}
{'did': 'miwifi.d85df877-c5b1-e14c-fb4e-125342d10d34', 'token': 'Pxb9zm2xaJSYAGmCqXsz9kXsua/mXKjaywJdsEGTJc8=', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'xxxxxxxx 2fl', 'pid': '2', 'localip': '', 'mac': '40:31:3C:EB:4C:60', 'ssid': '', 'bssid': '40:31:3C:EB:4C:60', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'xiaomi.router.r4cm', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'platform': 'R4CM'}, 'uid': 1765057107, 'pd_id': 65645, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': '294427654', 'token': '636b536a66554834754c527133327772', 'longitude': 'xx.xx662370', 'latitude': 'xx.xx946050', 'name': 'Робот-пылесос', 'pid': '0', 'localip': '192.168.88.153', 'mac': '44:23:7C:ED:EB:F4', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '', 'parent_model': '', 'show_mode': 1, 'model': 'dreame.vacuum.mc1808', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': False, 'desc': 'Device offline ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '3.5.8_1045', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 66181, 'password': '', 'p2p_id': '', 'rssi': -83, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d47458', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'кухня 2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d474e5', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'гостиная 2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d51d6d', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Свет/Вытяжка', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d62321', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Потолок/Люстры', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d6533d', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Кухня 2/Коридорчик', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0001d91a21', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'зеленая 2 эт', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Light1:off Light2:off ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '30', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'channel_0': 'off', 'channel_1': 'off'}, 'uid': 1765057107, 'pd_id': 356, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0002a3730e', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Cube', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.sensor_cube.aqgl01', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'uid': 1765057107, 'pd_id': 711, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00034f815b', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности7', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 24℃ Humidity:60% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '6010', 'temperature': '2359'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00034f8284', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Температура 2 этаж холл', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 26℃ Humidity:54% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5407', 'temperature': '2622'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0003937008', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности5', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 16℃ Humidity:81% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '8137', 'temperature': '1566'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00039ec46d', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности6', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 30℃ Humidity:46% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '2', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'prop': {'humidity': '4559', 'temperature': '2963'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0003f44db3', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Wall Switch (With Neutral, Double Rocker)2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0003f44e87', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'спальня 2 эт', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000403d2f8', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Wall Switch (With Neutral, Double Rocker)3', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00040e6e31', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Температура кабинет 2 эт', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 24℃ Humidity:54% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5415', 'temperature': '2394'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0004117de1', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Штора', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.curtain.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '34', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 163, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d00041d6c13', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 26℃ Humidity:51% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5093', 'temperature': '2580'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000421b40e', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'холл', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000424b6de', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Wall Switch (With Neutral, Double Rocker)', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000424fcf3', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Wall Switch (With Neutral, Double Rocker)4', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.ctrl_ln2.aq1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '92', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 610, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000425013c', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности3', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 27℃ Humidity:55% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5496', 'temperature': '2702'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0004252f3c', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Датчик температуры и влажности2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 26℃ Humidity:55% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5525', 'temperature': '2570'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0004252fb3', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Mi Temperature and Humidity Sensor', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 24℃ Humidity:59% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5911', 'temperature': '2358'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d000464c619', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Температура спальня', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.weather.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': '26℃ |54% |100kPa ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5415', 'pressure': '99705', 'temperature': '2632'}, 'uid': 1765057107, 'pd_id': 354, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.158d0004662177', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Температура красная комната', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 0, 'model': 'lumi.sensor_ht.v1', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Temperature: 25℃ Humidity:58% ', 'extra': {'isSetPincode': 0, 'pincodeType': 0}, 'prop': {'humidity': '5775', 'temperature': '2537'}, 'uid': 1765057107, 'pd_id': 98, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.4cf8cdf3c7b7e1f', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Smart Wall Switch D1(With Neutral, Triple Rocker)', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.switch.n3acn3', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '32', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 67858, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
{'did': 'lumi.4cf8cdf3c7bb060', 'token': '', 'longitude': '0.00000000', 'latitude': '0.00000000', 'name': 'Aqara Smart Wall Switch D1(With Neutral, Triple Rocker)2', 'pid': '3', 'localip': '', 'mac': '', 'ssid': 'xxxxxxxx', 'bssid': '52:FF:20:5D:A3:D7', 'parent_id': '63217102', 'parent_model': 'lumi.gateway.v3', 'show_mode': 1, 'model': 'lumi.switch.n3acn3', 'adminFlag': 1, 'shareFlag': 0, 'permitLevel': 16, 'isOnline': True, 'desc': 'Device online ', 'extra': {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '32', 'needVerifyCode': 0, 'isPasswordEncrypt': 0}, 'uid': 1765057107, 'pd_id': 67858, 'password': '', 'p2p_id': '', 'rssi': 0, 'family_id': 0, 'reset_flag': 0}
Could you confirm that this script does not produce an error Yes i have the same behavior
I think the following is the case: you don't have zigbee devices connected to the gateway, we ask the gateway to give us a list of the connected devices, since there are none, the gateway replays with some messages that is probably malformed or gives an error due to a possible bug in the gateway firmware, that is why the checksums will not match.
So, maybe there is some wrong/unsupported device, that leads to checksum error?..
@terenceng81 I know from my own experiance that the token changes whenever you reset your gateway or connect your gateway to a diffrent wifi-network. So please do check the token from the cloud script if you did not already do so.
@terenceng81 do you have zigbee devices connected to your gateway, and if so, how many?
This issue is not with the WIFI SSID, all devices (I have more than 30) connected to the same SSID and never change.
The issue is with the xiaomi gateway itself.
HA has two integration, "Xiaomi Miio" and "Xiaomi Aqara Gateway", I setup both.
All devices are working fine with "Xiaomi Aqara Gateway".
All devices are working fine with "Xiaomi Miio" except for "Xiaomi Gateway", we have to use its token for adding, not the LAN key.
Alright, so both of you have 30+ devices, thats the other end ;) I have seen issues with other people before if they had large amounts of devices connected to the gateway. I think it might be because the data in the response becomes bigger than the max size of a message.
It might be that the message is split up in two packets and the xiaomi miio library can't handel that properly.
It seems like the max packet size is set at 1024 bytes: https://github.com/rytilahti/python-miio/blob/89a9ed9258cbcdb8028a7f678f774293e28d433f/miio/miioprotocol.py#L193
@enterego @terenceng81 could you still confirm that the .info() command does not give an error (see script https://github.com/home-assistant/core/issues/51229#issuecomment-864463598)
@starkillerOG yes, i confirm
it returns
lumi.gateway.v3 v1.4.1_176 (34:CE:00:FB:50:46) @ 192.168.88.176 - token: afb7498e9a188115d325f08e0e5ed113
Alright, that means your token is definetly good and the problem is in the gateway.discover_devices()
call.
There are two ways forward:
1) actually trying to fix the gateway.discover_devices()
call.
2) avoiding the gateway.discover_devices()
call by using the device list from the cloud.
Option 2 is sort of already implemented in this PR that is merged: https://github.com/home-assistant/core/pull/47955
It adds an option flow option "Use cloud to get connected subdevices", if that is checked, it will avoid the issue you are now having.
I will make some adjustments to automatically use that options if the gateway.discover_devices()
call fails, I will make a PR for that.
Alright, that means your token is definetly good and the problem is in the
gateway.discover_devices()
call.There are two ways forward:
- actually trying to fix the
gateway.discover_devices()
call.- avoiding the
gateway.discover_devices()
call by using the device list from the cloud.Option 2 is sort of already implemented in this PR that is merged: #47955 It adds an option flow option "Use cloud to get connected subdevices", if that is checked, it will avoid the issue you are now having. I will make some adjustments to automatically use that options if the
gateway.discover_devices()
call fails, I will make a PR for that.
thank you so much!
Regarding options 1), if would be greath if one of you could adjust this line: https://github.com/rytilahti/python-miio/blob/89a9ed9258cbcdb8028a7f678f774293e28d433f/miio/miioprotocol.py#L193 and increase the 1024 to 4096 and see if it then works.
Easiest is doing this on a PC where python is installed and you have easy acces to the install dir of python, then just go to the miio module and adjust that line and test. To be sure you made the changes, add a line print("buffer 4096") just above the adjusted line, so you know the change has properly happend when you see that message.
i could not find this file in my homeassistant VM, do u know where is it located?
I searched here but there is no miio folder. /usr/lib/python3.8/site-packages/
@starkillerOG YES! After this fix everything works! THANKS A LOT!
@starkillerOG YES! After this fix everything works! THANKS A LOT!
Hi I am not using standard Linux for my HA, would you able to help?
@starkillerOG YES! After this fix everything works! THANKS A LOT!
So simply increasing the buffer size fixed it for you?
@terenceng81 the path /usr/lib/python3.8/site-packages/
schould be alright, but probably that is the path for the default python3 install, you will need the python3 inside the virtual enviroment you run HomeAssistant in.
I don't know the details of your setup, so I can't point you to the right path.
But I will make a PR to increase this buffer size, so it is actually fixed, because even if you change it now, each time you update HomeAssistant the change will be overwritten, so it is not a permanent fix.
@terenceng81 the path
/usr/lib/python3.8/site-packages/
schould be alright, but probably that is the path for the default python3 install, you will need the python3 inside the virtual enviroment you run HomeAssistant in. I don't know the details of your setup, so I can't point you to the right path.But I will make a PR to increase this buffer size, so it is actually fixed, because even if you change it now, each time you update HomeAssistant the change will be overwritten, so it is not a permanent fix.
Its okay, I am using version supervisor-2021.06. HA.
I will search where to amend the file.
Meanwhile, I will wait for the new release and then update, thanks!
@terenceng81
Hi I am not using standard Linux for my HA, would you able to help?
I have HA in docker, and the required file is located at /usr/local/lib/python3.8/site-packages/miio/miioprotocol.py
@starkillerOG
So simply increasing the buffer size fixed it for you?
Yes))
@terenceng81
Hi I am not using standard Linux for my HA, would you able to help?
I have HA in docker, and the required file is located at /usr/local/lib/python3.8/site-packages/miio/miioprotocol.py
@starkillerOG
So simply increasing the buffer size fixed it for you?
Yes))
Not for me :-/
Cant find the file.
@terenceng81 based on your yesterday's log, you need to look for the file along the following path: /home/linux/.local/lib/python3.8/site-packages/miio/
@terenceng81 based on your yesterday's log, you need to look for the file along the following path: /home/linux/.local/lib/python3.8/site-packages/miio/
This is a standalone linux which is not running HA.
My HA running with a VMware VM.
Anyway thanks.
@rytilahti
Hi Rytilahti,
May I know roughly it would take how long for the new version to be released?
The reason being is that I could not find the right path for me to edit the file "miioprotocol.py" in my supervised version HomeAssistant resides VMWare ESXi host.
Thanks, Terence
Anyone could assist to tell me what would be the possible path? i use the Linux command to search, could not find it. :-/
@terenceng81 Propably the esiest is to go into the command line of your VM where HomeAssistant resides. then type:
python import sys sys.path
That schould print the paths of you python install.
Sometimes you need to use python3
instead of python
.
Make sure you are in the virtual enviroment where HomeAssistant is running.
@terenceng81 Propably the esiest is to go into the command line of your VM where HomeAssistant resides. then type:
python import sys sys.path
That schould print the paths of you python install. Sometimes you need to use
python3
instead ofpython
.
no luck :-/
searching for the file, wish me good luck
No luck at all, could not file the file "miioprotocol.py", not even the folder "python-miio".
@terenceng81 right folder name is "miio", not "python-miio"
@terenceng81 right folder name is "miio", not "python-miio"
miio could not be found as well.
I think I have the same issue, and I'm looking forward to trying a potential fix.
I think I have the same issue, and I'm looking forward to trying a potential fix.
If u are not running VM, the issue can be easily fixed by the above.
The problem
I have posted an issue here but nobody reply
Wonder am I posted to the wrong place?
https://community.home-assistant.io/t/xiaomi-miio-gateway-integration-issue/311117/3
Thanks!
What is version of Home Assistant Core has the issue?
core-2021.5.5
What was the last working version of Home Assistant Core?
core-2021.5.5
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Xiaomi Miio
Link to integration documentation on our website
https://www.home-assistant.io/integrations/xiaomi_miio/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Logger: homeassistant.components.xiaomi_miio.gateway Source: components/xiaomi_miio/gateway.py:47 Integration: Xiaomi Miio (documentation, issues) First occurred: 17:48:58 (1 occurrences) Last logged: 17:48:58
DeviceException during setup of xiaomi gateway with host 192.168.8.183