merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
388 stars 61 forks source link

Poll failed following MiCloud request #162

Closed DotIN13 closed 2 years ago

DotIN13 commented 2 years ago

I have been trying to integrate my Chunmi Juicer and Airer to homebridge and I am constantly receiving poll failed errors, which once in a while render my homekit commands unresponsive.

After checking the log, I reckon that the error always appear along with MiCloud requests.

[2021/12/17 下午8:58:47] [miot] [My airer] Trying to reconnect...
  miio:network Grabbing reference to network +29s
  thing:miio:437149551 Using manual token: a1fc38315dd9e6e8c6bd6263e5357826 +29s
[2021/12/17 下午8:58:47] [miot] [My airer] Device diconnected!
  miio:network Releasing reference to network +4ms
  thing:miio:437149551 -> (5) {"method":"miIO.info","params":[],"id":5} +4ms
  miio:packet -> <Buffer 21 31 00 50 00 00 00 00 1a 0e 5f 6f 00 01 69 6a eb e4 fa bf d3 52 29 20 90 0f b3 43 0c 0c 14 99> +29s
  miio:packet <- <Buffer 21 31 01 d0 00 00 00 00 1a 0e 5f 6f 00 01 69 6b 0c 38 1d 2d 2f 31 db 5c 7b 85 0f 22 2b f7 ae 0b> +175ms
  miio:packet <- <Buffer 21 31 01 d0 00 00 00 00 1a 0e 5f 6f 00 01 69 6b 0c 38 1d 2d 2f 31 db 5c 7b 85 0f 22 2b f7 ae 0b> +3ms
  thing:miio:437149551 <- Message: `{"id":5,"result":{"life":92523,"uid":2557209719,"model":"hyd.airer.znlyj4","token":"a1fc38315dbd6263e5357826","ipflag":1,"fw_ver":"2.2.1","mcu_fw_ver":"0002","miio_ver":"0.0.9","hw_ver":"esp32","mmfree":72808,"mac":"B4:60:ED:2C:F2:C4","wifi_fw_ver":"","ap":{"ssid":"K2P_Eagle","bssid":"58:41:20:22:49:74","rssi":-88,"primary":11},"netif":{"localIp":"192.168.0.111","mask":"255.255.255.0","gw":"192.168.0.1"}},"exe_time":50}` +182ms
  miio:network Grabbing reference to network +184ms
  miio:network Releasing reference to network +2ms
[2021/12/17 下午8:58:47] [miot] [My airer] Connected to device: hyd.airer.znlyj4
[2021/12/17 下午8:58:47] [miot] [My airer] Setting up device!
[2021/12/17 下午8:58:47] [miot] [My airer] Doing device specific setup
[2021/12/17 下午8:58:47] [miot] [My airer] Device requires MiCloud! Trying to connect!
[2021/12/17 下午8:58:47] [miot] [My airer] Log in to MiCloud cn server with username 13764029083. Request timeout: 5000 milliseconds.
[2021/12/17 下午8:58:47] [miot] [My airer] MiCloud - Login step 1
[2021/12/17 下午8:58:47] [miot] [My airer] MiCloud - Login step 1 result: OK - &&&START&&&{"serviceParam":"{\"checkSafePhone\":false,\"checkSafeAddress\":false,\"lsrp_score\":0.0}","qs":"%3Fsid%3Dxiaomiio%26_json%3Dtrue","code":70016,"description":"登录验证失败","securityStatus":0,"_sign":"0psXfr43eNI0IX6q9Suk3qWbRqU=","sid":"xiaomiio","result":"error","captchaUrl":null,"callback":"https://sts.api.io.mi.com/sts","location":"https://account.xiaomi.com/fe/service/login?_json=true&sid=xiaomiio&qs=%253Fsid%253Dxiaomiio%2526_json%253Dtrue&callback=https%3A%2F%2Fsts.api.io.mi.com%2Fsts&_sign=0psXfr43eNI0IX6q9Suk3qWbRqU%3D&serviceParam=%7B%22checkSafePhone%22%3Afalse%2C%22checkSafeAddress%22%3Afalse%2C%22lsrp_score%22%3A0.0%7D&showActiveX=false&theme=&needTheme=false&bizDeviceType=","pwd":0,"desc":"登录验证失败"}
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud - Login step 2
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud - Login step 2 result: OK - &&&START&&&{"qs":"%3Fsid%3Dxiaomiio%26_json%3Dtrue","ssecurity":"1+mT9sF8rjBA==","code":0,"passToken":"V1dFYS86QCQStplp/U/fbx9Fqo+K2p+q+bKYIH4hczG1iBlGv/378D5YxL3zcfXqaN5JSOB3yHgkkfSB+MMvXlQmJrqJ4PS8FNel918fdPiDdNJwQsCS2YtQZOfrZ31i3T1iUM2nCKcJgSN3JluSJBE7wj8Ts7QR6qAdTdqfYNToO+G85vnZ4/rrqg8Z2fMpuXnj7NMzAeODcdVpvPgraOjRq/JXQBhiWd9NEGHoF7JyzJ851yWv2/RKHb/6WRo=","description":"成功","securityStatus":0,"nonce":1627873524373425152,"userId":2557209719,"cUserId":"e6hc2XfWAoDHaEvMdWejoCXGbR0","result":"ok","psecurity":"2CyNKTrH+0+JlnMU0LIC/w==","captchaUrl":null,"location":"https://sts.api.io.mi.com/sts?d=FHKSNL&ticket=0&pwd=1&p_ts=1639745905000&fid=0&p_lm=1&auth=KeKTHiG2wt5h4o3mGd4bkMuLS63pT8hHMIz0bcKaakw%2F3IF7jwOGLzu11WHu0P5Kghu03myoZd%2BI%3D&m=1&tsl=0&nonce=4VGW0h0X19wBoQJK&_ssign=i11u8Fi7S8Q8A0A%2BjZQQjS1DmF8%3D","pwd":1,"desc":"成功"}
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud - Login step 3
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud - Login step 3 result: OK - ok
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud - Login successful!
[2021/12/17 下午8:58:48] [miot] [My airer] Successfully connected to MiCloud!
[2021/12/17 下午8:58:48] [miot] [My airer] Doing initial property fetch
[2021/12/17 下午8:58:48] [miot] [My airer] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14
[2021/12/17 下午8:58:48] [miot] [My airer] Chunks:  [
 [
  "light_power",
  "device_fault",
  "status",
  "current_position"
 ]
]
[2021/12/17 下午8:58:48] [miot] [My airer] MiCloud request https://api.io.mi.com/app/miotspec/prop/get - {"_nonce":"PEQSDFZwzM0BoQJK","data":"{\"params\":[{\"did\":\"437149551\",\"siid\":3,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":4},{\"did\":\"437149551\",\"siid\":2,\"piid\":3}]}","signature":"T4jgfXkodQPYcUkPK5tLB3D0sHrMVlqN01aJtN9jjiE="}
[2021/12/17 下午8:58:48] [miot] [My airer] Device setup finished! Device ready, you can now control your device!
[2021/12/17 下午8:58:48] [miot] [My airer] Device connected!
[2021/12/17 下午8:58:48] [miot] [My airer] Successfully saved device info!
[2021/12/17 下午8:58:48] [miot] [My airer] Error on initial property request! Error: No response or response empty!
  ciao:Responder Sending response via unicast to {"address":"192.168.0.109","port":5353,"interface":"ens1"} (took 9 ms): [PTR] answers and [TXT,SRV,A,AAAA,AAAA,NSEC,NSEC] additionals with size 361B (UPS: 1440) +20s
[2021/12/17 下午8:58:55] [miot] [My airer] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14
[2021/12/17 下午8:58:55] [miot] [My airer] Chunks:  [
 [
  "light_power",
  "device_fault",
  "status",
  "current_position"
 ]
]
[2021/12/17 下午8:58:55] [miot] [My airer] MiCloud request https://api.io.mi.com/app/miotspec/prop/get - {"_nonce":"cwqx3ZihojUBoQJK","data":"{\"params\":[{\"did\":\"437149551\",\"siid\":3,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":4},{\"did\":\"437149551\",\"siid\":2,\"piid\":3}]}","signature":"fSSY1IVFl++0dwrBI42ju9CfvXVvhm5FEfbh/rfesV0="}
[2021/12/17 下午8:58:55] [miot] [My airer] Poll failed! No response from device! Error: No response or response empty!
  ciao:Responder Sending response via unicast to {"address":"192.168.0.109","port":5353,"interface":"ens1"} (took 7 ms): [PTR] answers and [TXT,SRV,A,AAAA,AAAA,NSEC,NSEC] additionals with size 361B (UPS: 1440) +6s
[2021/12/17 下午8:59:02] [miot] [My airer] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14
[2021/12/17 下午8:59:02] [miot] [My airer] Chunks:  [
 [
  "light_power",
  "device_fault",
  "status",
  "current_position"
 ]
]
[2021/12/17 下午8:59:02] [miot] [My airer] MiCloud request https://api.io.mi.com/app/miotspec/prop/get - {"_nonce":"XR/CerxUt3cBoQJL","data":"{\"params\":[{\"did\":\"437149551\",\"siid\":3,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":4},{\"did\":\"437149551\",\"siid\":2,\"piid\":3}]}","signature":"BePYfy9I+SF28raaMvcV5fiLonq7GgJpZ/DKH/2xSJo="}
[2021/12/17 下午8:59:02] [miot] [My airer] Poll failed! No response from device! Error: No response or response empty!
  haier-ac:error Connection closed>>> +17s
[2021/12/17 下午8:59:09] [miot] [My airer] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14
[2021/12/17 下午8:59:09] [miot] [My airer] Chunks:  [
 [
  "light_power",
  "device_fault",
  "status",
  "current_position"
 ]
]
[2021/12/17 下午8:59:09] [miot] [My airer] MiCloud request https://api.io.mi.com/app/miotspec/prop/get - {"_nonce":"9g1USRZDbWwBoQJL","data":"{\"params\":[{\"did\":\"437149551\",\"siid\":3,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":4},{\"did\":\"437149551\",\"siid\":2,\"piid\":3}]}","signature":"lx7g6Aue5wQBmZx6eWUQiw7ZfW8NuQeWQrrqOkxTZS8="}
[2021/12/17 下午8:59:09] [miot] [My airer] Poll failed! No response from device! Error: No response or response empty!
  ciao:Responder Sending response via unicast to {"address":"192.168.0.101","port":5353,"interface":"ens1"} (took 7 ms): [PTR] answers and [TXT,SRV,A,AAAA,AAAA,NSEC,NSEC] additionals with size 361B (UPS: 1440) +9s
[2021/12/17 下午8:59:16] [miot] [My airer] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14
[2021/12/17 下午8:59:16] [miot] [My airer] Chunks:  [
 [
  "light_power",
  "device_fault",
  "status",
  "current_position"
 ]
]
[2021/12/17 下午8:59:16] [miot] [My airer] MiCloud request https://api.io.mi.com/app/miotspec/prop/get - {"_nonce":"XO4gMGPkidEBoQJL","data":"{\"params\":[{\"did\":\"437149551\",\"siid\":3,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":1},{\"did\":\"437149551\",\"siid\":2,\"piid\":4},{\"did\":\"437149551\",\"siid\":2,\"piid\":3}]}","signature":"PQiEjViE61mBZ8Xd/dcnIxQsP4WUBq9lIUmWMC2ARcE="}
[2021/12/17 下午8:59:16] [miot] [My airer] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: No response or response empty!
[2021/12/17 下午8:59:16] [miot] [My airer] Logout from MiCloud for username 13764029083
[2021/12/17 下午8:59:16] [miot] [My airer] Trying to reconnect...
merdok commented 2 years ago

It might be that you have the wrong country specified. I see that mi cloud does not get any response for the airer device, do I suppose either it is not registered in the mi cloud or you specified the wrong country.

DotIN13 commented 2 years ago

Now after a restart this morning, the errors are gone. So it looks like a network issue. The banner in the mijia app indicated that the airer connection to my router is unstable, though I do not know the reasons as they are just meters away.

I think this can be closed as it doesn't seem to be anyway related to this gorgeous plugin.