merdok / homebridge-miot

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

[Xiaomi Mi Plug] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Resp invalid json. #333

Closed doanthuanthanh88 closed 2 years ago

doanthuanthanh88 commented 2 years ago

Describe the bug My Xiaomi Mi Plugs are always show error messages in logs.

Expected behavior Please fix it. It's made my orangepi slowly

Your config.json { "type": "MiPlugBase", "ip": "192.168.11.116", "token": "###", "outletName": "Floor Fan", "outletDisable": false, "temperatureDisable": true, "switchLEDDisable": true }

Debug log [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] Chunks: [ [ "switch:on", "switch:temperature", "indicator-light:on" ] ] [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) Call 192.168.11.116: get_properties - [{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}] - {} [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) Start handshake 192.168.11.116 [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- (2) {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":4} [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- !1�4 �ͽr @I�NzL�:҇,�� [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Data: {"id":4,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Message: {"id":4,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- Error during send! (-30001) Resp invalid json. | Request: {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":4} [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] Poll failed 2 times! [9/8/2022, 9:09:07 AM] [homebridge-miot] [Floor Fan] Poll failed! Error: Error: Resp invalid json. [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] Chunks: [ [ "switch:on", "switch:temperature", "indicator-light:on" ] ] [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) Call 192.168.11.116: get_properties - [{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}] - {} [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) Start handshake 192.168.11.116 [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- (2) {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":5} [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- !1�4 @I��.��U��� �h��; [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Data: {"id":5,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Message: {"id":5,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- Error during send! (-30001) Resp invalid json. | Request: {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":5} [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] Poll failed 3 times! [9/8/2022, 9:09:22 AM] [homebridge-miot] [Floor Fan] Poll failed! Error: Error: Resp invalid json. [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Chunks: [ [ "switch:on", "switch:temperature", "indicator-light:on" ] ] [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) Call 192.168.11.116: get_properties - [{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}] - {} [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) Start handshake 192.168.11.116 [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- (2) {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":6} [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- !1�4 @I�r�Q���/�&��k�� [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Data: {"id":6,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 -> Message: {"id":6,"error":{"code":-30001,"message":"Resp invalid json."}} [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] (Protocol) 192.168.11.116 <- Error during send! (-30001) Resp invalid json. | Request: {"method":"get_properties","params":[{"did":"120851520","siid":2,"piid":1},{"did":"120851520","siid":2,"piid":2},{"did":"120851520","siid":3,"piid":1}],"id":6} [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Poll failed 4 times! [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Resp invalid json. [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Device diconnected! [9/8/2022, 9:09:37 AM] [homebridge-miot] [Floor Fan] Trying to reconnect in 60 seconds...

merdok commented 2 years ago

You would need to specify what device do you have. I would need the unique device model.

doanthuanthanh88 commented 2 years ago

Ya, sorry about that. This is a device information

Model: chuangmi.plug.m3 Device Id: 120851520 Country: cn

If you need a token to test, i will send it to you via email to debug.

merdok commented 2 years ago

Hmmm it might be because of the temperature property... Are you able to locally modify the JavaScript file with the device implementation and comment out the line with temperature? Can you try that and see if the error continues?

doanthuanthanh88 commented 2 years ago

I've just tried to comment 3 lines (36, 41, 42) in the file "homebridge-miot/lib/modules/outlet/devices/chuangmi.plug.m3.js". It looks good now. Thanks for your suggestion !

LiuLiujie commented 1 year ago

@merdok FYI: I met the same problem with the same device with the latest version of this plugin. It seems that the Indicator light related service and property also need to be removed (lines 36 and 43). I remove these two lines, and it works properly now.