merdok / homebridge-miot

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

Why I get this message? #210

Closed Mitsosxat closed 1 year ago

Mitsosxat commented 2 years ago

CEFF5448-D5D5-405B-8ADB-F952DB696A0F

is this normal? Or am I doing something wrong?

merdok commented 2 years ago

Does the device still work in HomeKit? If yes you would need to provide a debug log so I can have a look at what might be the cause.

Mitsosxat commented 2 years ago

[09/02/2022, 15:55:45] [miot] [Cleaner] (Protocol) 192.168.68.105 <- !1 �A�hx�p�����,S�{�^ [09/02/2022, 15:55:45] [miot] [Cleaner] (Protocol) 192.168.68.105 <- Reached maximum number of retries, giving up get_properties - [{"did":"428491177","siid":2,"piid":1},{"did":"428491177","siid":2,"piid":19},{"did":"428491177","siid":2,"piid":2},{"did":"428491177","siid":3,"piid":1},{"did":"428491177","siid":4,"piid":11},{"did":"428491177","siid":4,"piid":10},{"did":"428491177","siid":4,"piid":9},{"did":"428491177","siid":4,"piid":8},{"did":"428491177","siid":4,"piid":13},{"did":"428491177","siid":4,"piid":12},{"did":"428491177","siid":4,"piid":26},{"did":"428491177","siid":4,"piid":27}] [09/02/2022, 15:55:45] [miot] [Cleaner] Poll failed 1 times! [09/02/2022, 15:55:45] [miot] [Cleaner] Poll failed! Error: Error: Call to device timed out [09/02/2022, 15:55:46] [miot] [Cleaner] (Protocol) 192.168.68.105 -> Handshake reply [09/02/2022, 15:55:46] [miot] [Cleaner] (Protocol) 192.168.68.105 <- (-1) {"method":"get_properties","params":[{"did":"428491177","siid":2,"piid":1},{"did":"428491177","siid":2,"piid":19},{"did":"428491177","siid":2,"piid":2},{"did":"428491177","siid":3,"piid":1},{"did":"428491177","siid":4,"piid":11},{"did":"428491177","siid":4,"piid":10},{"did":"428491177","siid":4,"piid":9},{"did":"428491177","siid":4,"piid":8},{"did":"428491177","siid":4,"piid":13},{"did":"428491177","siid":4,"piid":12},{"did":"428491177","siid":4,"piid":26},{"did":"428491177","siid":4,"piid":27}],"id":2527}

i think this is what you need

merdok commented 2 years ago

Seems like your device requires a micloud connection. You need to specify your micloud credentials in the config.json and set the forceMiCloud flag to true on the device.

Mitsosxat commented 2 years ago

what if country is not in the list. i live in greece so in xiaomi app the region is Greece

merdok commented 2 years ago

I think Greece would be assigned to "de" servers.

Mitsosxat commented 2 years ago

[09/02/2022, 16:35:51] [miot] [Cleaner] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: FetchError: network timeout at: https://de.api.io.mi.com/app/miotspec/prop/get

Mitsosxat commented 2 years ago

[09/02/2022, 16:36:31] [miot] [Cleaner] Device found: viomi.vacuum.v19 [09/02/2022, 16:36:31] [miot] [Cleaner] Setting up miot device! [09/02/2022, 16:36:31] [miot] [Cleaner] Device requires MiCloud! Trying to connect! [09/02/2022, 16:36:32] [miot] [Cleaner] Successfully connected to MiCloud! [09/02/2022, 16:36:32] [miot] [Cleaner] Device setup finished! Miot device ready! [09/02/2022, 16:36:32] [miot] [Cleaner] [Miot Device] Connected to device: viomi.vacuum.v19 [09/02/2022, 16:36:32] [miot] [Cleaner] Doing initial property fetch. [09/02/2022, 16:36:33] [miot] [Cleaner] Main brush left time: 334 hours. [09/02/2022, 16:36:33] [miot] [Cleaner] Main brush life level: 92%. [09/02/2022, 16:36:33] [miot] [Cleaner] Side brush left time: 154 hours. [09/02/2022, 16:36:33] [miot] [Cleaner] Side brush life level: 85%. [09/02/2022, 16:36:33] [miot] [Cleaner] Filter life level: 85%. [09/02/2022, 16:36:33] [miot] [Cleaner] Starting property polling. [09/02/2022, 16:37:18] [miot] [Cleaner] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: FetchError: network timeout at: https://de.api.io.mi.com/app/miotspec/prop/get

merdok commented 2 years ago

I mean then you should find out on what server your device is. You can use homebridge ui for that, under the plugin settings there is a "Discover" button which will connect to the cloud and get all devices and also list the sever where your device is located.

Mitsosxat commented 2 years ago

i did it and is indeed de server. After 2 loops of the log i sent you i stop getting this message [09/02/2022, 16:35:02] [miot] [Cleaner] Successfully created a RobotCleaner device! It is a Viomi Robot Vacuum SE. [09/02/2022, 16:35:02] [miot] [Cleaner] Initializing accessory! [09/02/2022, 16:35:02] [miot] [Cleaner] Accessory successfully initialized! [09/02/2022, 16:35:02] [miot] [Cleaner] Registering 1 accessories! [09/02/2022, 16:35:02] [miot] [Cleaner] Everything looks good! Initiating property polling! [09/02/2022, 16:35:02] [miot] [Cleaner] Device found: viomi.vacuum.v19 [09/02/2022, 16:35:02] [miot] [Cleaner] Setting up miot device! [09/02/2022, 16:35:02] [miot] [Cleaner] Device requires MiCloud! Trying to connect! [09/02/2022, 16:35:05] [miot] [Cleaner] Successfully connected to MiCloud! [09/02/2022, 16:35:05] [miot] [Cleaner] Getting device info from MiCloud! [09/02/2022, 16:35:05] [miot] [Cleaner] Device setup finished! Miot device ready! [09/02/2022, 16:35:05] [miot] [Cleaner] [Miot Device] Connected to device: viomi.vacuum.v19 [09/02/2022, 16:35:05] [miot] [Cleaner] Doing initial property fetch. [09/02/2022, 16:35:06] [miot] [Cleaner] Main brush left time: 334 hours. [09/02/2022, 16:35:06] [miot] [Cleaner] Main brush life level: 92%. [09/02/2022, 16:35:06] [miot] [Cleaner] Side brush left time: 154 hours. [09/02/2022, 16:35:06] [miot] [Cleaner] Side brush life level: 85%. [09/02/2022, 16:35:06] [miot] [Cleaner] Filter life level: 85%. [09/02/2022, 16:35:06] [miot] [Cleaner] Starting property polling. [09/02/2022, 16:35:34] [Toyotomi] Scan finished. [09/02/2022, 16:35:51] [miot] [Cleaner] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: FetchError: network timeout at: https://de.api.io.mi.com/app/miotspec/prop/get [09/02/2022, 16:36:31] [miot] [Cleaner] Device found: viomi.vacuum.v19 [09/02/2022, 16:36:31] [miot] [Cleaner] Setting up miot device! [09/02/2022, 16:36:31] [miot] [Cleaner] Device requires MiCloud! Trying to connect! [09/02/2022, 16:36:32] [miot] [Cleaner] Successfully connected to MiCloud! [09/02/2022, 16:36:32] [miot] [Cleaner] Device setup finished! Miot device ready! [09/02/2022, 16:36:32] [miot] [Cleaner] [Miot Device] Connected to device: viomi.vacuum.v19 [09/02/2022, 16:36:32] [miot] [Cleaner] Doing initial property fetch. [09/02/2022, 16:36:33] [miot] [Cleaner] Main brush left time: 334 hours. [09/02/2022, 16:36:33] [miot] [Cleaner] Main brush life level: 92%. [09/02/2022, 16:36:33] [miot] [Cleaner] Side brush left time: 154 hours. [09/02/2022, 16:36:33] [miot] [Cleaner] Side brush life level: 85%. [09/02/2022, 16:36:33] [miot] [Cleaner] Filter life level: 85%. [09/02/2022, 16:36:33] [miot] [Cleaner] Starting property polling. [09/02/2022, 16:37:18] [miot] [Cleaner] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: FetchError: network timeout at: https://de.api.io.mi.com/app/miotspec/prop/get [09/02/2022, 16:37:58] [miot] [Cleaner] Device found: viomi.vacuum.v19 [09/02/2022, 16:37:58] [miot] [Cleaner] Setting up miot device! [09/02/2022, 16:37:58] [miot] [Cleaner] Device requires MiCloud! Trying to connect! [09/02/2022, 16:38:00] [miot] [Cleaner] Successfully connected to MiCloud! [09/02/2022, 16:38:00] [miot] [Cleaner] Device setup finished! Miot device ready! [09/02/2022, 16:38:00] [miot] [Cleaner] [Miot Device] Connected to device: viomi.vacuum.v19 [09/02/2022, 16:38:00] [miot] [Cleaner] Doing initial property fetch. [09/02/2022, 16:38:00] [miot] [Cleaner] Main brush left time: 334 hours. [09/02/2022, 16:38:00] [miot] [Cleaner] Main brush life level: 92%. [09/02/2022, 16:38:00] [miot] [Cleaner] Side brush left time: 154 hours. [09/02/2022, 16:38:00] [miot] [Cleaner] Side brush life level: 85%. [09/02/2022, 16:38:00] [miot] [Cleaner] Filter life level: 85%. [09/02/2022, 16:38:00] [miot] [Cleaner] Starting property polling.

any idea what is this?

merdok commented 2 years ago

It seems to me like you have some kind of network issues, you could try to increase the timeout to lets say 10000 and increase your pollingInterval to also at least 10000 and see if that helps

danielkit83 commented 2 years ago

I have similar msg on cuco.plug.sp5 image

merdok commented 2 years ago

@danielkit83 i guess your issue is due to bad network connectivity, like mentioned above you can try to increase the timeout and polling interval.

danielkit83 commented 2 years ago

Thanks. Let me try to adjust the timeout and polling interval. It is very strange, because the error message only happned on one miot device....another miot devices are ok

merdok commented 2 years ago

Depends if other devices also use micloud and to what country server they connect.

charleszhai1991 commented 2 years ago

This issue happened to me AFTER I updated the plugin to v1.0.4 and updated the Node.js to 16.x from 14.x I've rolled back both the plugin and Node.js to previous versions and now issue got resolved. I don't think I had issue with my network and I don't want to expose my Mi account to third-party. Anyway, it's good to stick with the old version.

merdok commented 2 years ago

@charleszhai1991 what third party are you talking about?

charleszhai1991 commented 2 years ago

@charleszhai1991 what third party are you talking about?

Thanks for your efforts in developing such great plugin! I'm just very careful with my micloud credentials for privacy matters and I mistakenly assumed that my issue involved to micloud which was not required previously.

merdok commented 2 years ago

First of there is no third party involved here. All your code is on your machine. Second, only certain older devices require a micloud connection. Most of the device which natively use the miot protocol does not require a micloud connection.

sidxul commented 2 years ago

I have similar msg on cuco.plug.sp5

image

Mine too on cuco.plug.cp1(Gosund smart plug).

and I try to install the old version 0.9.x my gosund plug works well. When updating 1.0.x it doesn't work. My config files never change. So I think there is a bug or else? Hope to help me.🙏

merdok commented 2 years ago

Hmmm, I wonder if this is due to the encrypted micloud connection...

sidxul commented 2 years ago

Hmmm, I wonder if this is due to the encrypted micloud connection...

Ha,then how to solve it? Are there some good alternatives?

Mitsosxat commented 2 years ago

I still have the problem if you solve it it would be awesome

merdok commented 2 years ago

I mean if there is a problem then it first needs to be identified. I myself also use micloud for some devices and they seems to work fine. So my question would be, even if you guys see the error, does the devices still work? I would need to know a little bit more how it affects your device control and if it is all the time there or only sporadically

Mitsosxat commented 2 years ago

For me it works great. It just keep coming up but this message won’t affect the plug in

merdok commented 2 years ago

That there is sometimes a timeout should be fine. Sometimes the servers have more load so the sync might run into a timeout...

Mitsosxat commented 2 years ago

For me, it’s the only plug in with the only device. So I don’t get how the server has more load. Am I right?

charleszhai1991 commented 2 years ago

I mean if there is a problem then it first needs to be identified. I myself also use micloud for some devices and they seems to work fine. So my question would be, even if you guys see the error, does the devices still work? I would need to know a little bit more how it affects your device control and if it is all the time there or only sporadically

My issue happened on cuco.plug.cp1(Gosund smart plug) too. Besides the log "Pull failed 4 times...", the Gosund CP1 smart plug in Apple Home App appeared to be out-of-sync, i.e the HomeBridge/Apple Home could not get the real time ON/OFF status, however, I was able to control the smart plug when I toggled the smart plug button in Apple Home. I also noticed the status of the smart plug in Apple Home changed itself between ON and OFF at the interval of every couple minutes.

sidxul commented 2 years ago

My both chuangmi.plug.m1 and lumi.acpartner.mcn02 work fine use micloud. My cuco.plug.cp1 doesn't work, and every time run "poll failed 4 times in a row!...trying to reconnect..." my gosund plug of mijia app is offline then online, and HomeKit doesn't respond. It only occur gosund plug.

merdok commented 2 years ago

Oh, that is interesting. I wonder why are mostly the plugs affected? Can any of you guys try out some local code changes and see if it helps? For that you would need to comment out the return await this._requestEncrypted(path, data); and uncomment out the //return await this._requestUnencrypted(path, data); https://github.com/merdok/homebridge-miot/blob/main/lib/protocol/MiCloud.js#L102-L103

sidxul commented 2 years ago

Both are the same result!!! 1 2 3 4 .

merdok commented 2 years ago

Yeah so it has nothing to do with the encrypted micloud requests. @sidxul i see that you still use the default 5000 timeout, you could try to increase that to 10000 or 15000, in that case you would also need to increase the pollingInterval to the same values. That not only reduces the requests and the load on the device but also waits longer if for some reason a request takes longer. Check if that helps...

Mitsosxat commented 2 years ago

I increased it for a month now but nothing changed

merdok commented 2 years ago

@Mitsosxat did you also increase the polling interval? Increasing the timeout without the polling interval will have no effect. Did you also try values like 30000?

Mitsosxat commented 2 years ago

I increased both to 10000. I will do 30000 and tell you about it

sidxul commented 2 years ago

Yeah so it has nothing to do with the encrypted micloud requests.

@sidxul i see that you still use the default 5000 timeout, you could try to increase that to 10000 or 15000, in that case you would also need to increase the pollingInterval to the same values. That not only reduces the requests and the load on the device but also waits longer if for some reason a request takes longer. Check if that helps...

I had increased both timeout and "pollingInterval" to 10000, but nothing changed.

As I said before, all my devices(chuangmi.plug.m1, lumi.acpartner.mcn02, cuco.plug.cp1) worked well on version 0.9.x. both chuangmi.plug.m1 and lumi.acpartner.mcn02 need to connect micloud. And cuco.plug.cp1 didn’t.

So I think something wrong from version 1.0.0. I found there is “Global MiCloud Settings”. Whether i set “Global MiCloud Settings” or “MiCloud Settings”below separately. My all devices need to connect MiCloud first. Actually my cuco.plug.cp1 doesn’t need to connect MiCloud.

I don’t know if I’m right. thank you so much.

merdok commented 2 years ago

The only relevant thing which changed between 0.9.x and 1.0.0 was the use of a encrypted micloud connection. But apparently that is not what is causing the issue. If a device requires a micloud connection and you specified a global micloud setting then that will be used for connecting to the cloud. Devices which do not require micloud will ignore that. If you did specify the forceMiCloud flag on a device then it will use the cloud even if it is not required.

Could somebody also post some debug log from the warning appears, ideally with the deepDebugLog flag enabled?

Mitsosxat commented 2 years ago

i have posted debug

merdok commented 2 years ago

@Mitsosxat your log looks like a normal timeout, nothing unusual there... so I would like to see debug log from others to check whether maybe there I can find something unusual.

merdok commented 2 years ago

@sidxul the cuco.plug.cp1 seems to require a MiCloud connection but the device is marked as not required, that is why you getting the error. You need to set forceMiCloud: true on the micloud config for that device to force it to use MiCloud. If that will work then i will mark the device as MiCloud required in the next update!

merdok commented 2 years ago

@sidxul i still see that you use the default timeout, like i mentioned you should increase it to something more higher.

merdok commented 2 years ago

Yes, well i guess it is simply the device that is so slow. The error code "code":-704083036 mean: Device operation timed out. Also i see an error code "code":-704042011 which means device offline. So either you have a very instable network connection or the device is simply overloaded. Make sure that not other apps or plugins access the device and if the issue still persists you can try to reset it.

sidxul commented 2 years ago

Yes, well i guess it is simply the device that is so slow. The error code "code":-704083036 mean: Device operation timed out. Also i see an error code "code":-704042011 which means device offline. So either you have a very instable network connection or the device is simply overloaded. Make sure that not other apps or plugins access the device and if the issue still persists you can try to reset it.

Let me try. thank you very much.

ddong3000 commented 2 years ago

image I had the same problem. There were no problems until yesterday.

merdok commented 2 years ago

@ddong3000 your issue is related to the device itself. You should try to unplug your device for a while or reset it, that should help you.

crazykiwi2003 commented 2 years ago

Here exactly the same with two vacuum robots (viomi.vacuum.v7) and one Purifier 3H. All of them showing the same issue "Poll failed 4 times..." and they stopped working in homebridge. This can't be a network problem or a problem with micloud - all the devices are controllable without cloud connection (the robots even have installed Valetudo) and it perfectly worked in the past. Must be a bug in homebridge-miot in my opinion

merdok commented 2 years ago

@crazykiwi2003 just telling that you also have this does not bring anything into the topic. You should post some homebridge debug log so I can at least check what is causing the message for you...

crazykiwi2003 commented 2 years ago

Sorry, forgot to attach... homebridge.log

merdok commented 2 years ago

@crazykiwi2003 your devices run into timeouts, this can have multiply reasons. You can try to reduce the polling interval to reduce the load on the devices, also it might be due to instable network connection.

crazykiwi2003 commented 2 years ago

Polling interval is 30 seconds, so should not be issue I guess? Network is super stable and reliable. All devices are around 3 meters away from router, two of them without any walls in-between. A few weeks ago everything worked absolutely stable, after upgrading homebridge/plugins it stopped working.

romontei commented 2 years ago

The very same issue for me. As @crazykiwi2003, any network issues, I have recently moved and still have the same issue from old to new house whereas I change my internet provider. So I am pretty sure the internet connection is not the cause.

Sometimes on plugin update the issue disappear but it came back again on other update.

Here is some log : Capture d’écran 2022-06-07 à 10 27 54