nicoduj / homebridge-deebotEcovacs

Homebridge Deebot (from Ecovacs) plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin causes huge amount of dns request

Roy-H23 opened this issue · comments

This plugin pings the url portal-eu.ecouser.net every second.
Sometimes multiple times per second.
It pinged portal-eu.ecouser.net 229.668 times the last 7 days.
Set the refresh timer to 120. Seems not to work.

Please check on that thanks!

Hi (first thing first ...),

Thanks for reporting, I think it might be in an underlying lib but will check. What model are you using ? What is your conf ? Ae you using a refresh timer ?

Greetings,

I‘ve ran the Addon on RPI4. Latest Portainer/Homebridge Image and latest addon version.

The Refreshtimer was set to 120.

I would still need your conf and especially your deebot model . Have to check with underlying lib maker :)

I would still need your conf and especially your deebot model . Have to check with underlying lib maker :)

@nicoduj
Are you speaking of me?

I would still need your conf and especially your deebot model . Have to check with underlying lib maker :)

@nicoduj
Are you speaking of me?

YES indeed :) Sorry, on my phone, made a quick answer

I would still need your conf and especially your deebot model . Have to check with underlying lib maker :)

@nicoduj
Are you speaking of me?

YES indeed :) Sorry, on my phone, made a quick answer

What did you find out? I already checked and couldn't find any code that could cause this without it being triggered via the API.

Ok, did a quick check by my side too, but will try to reproduce then and have a deeper look. Might be related to automations that update the status of the bot.

@Roy-H23
What model are you using?

@nicoduj
For XMPP based devices, there is an interval in the library that triggers a ping every 30 seconds (a fixed value).

Hi guys,

Its a Deebot Ozmo 950.

I am seeing the same issue on my Deebot 901. About 1K DNS requests within one hour.

Homebridge v1.3.1
homebridge-deebotecovacs v1.4.4

{
    "email": "XXXX",
    "password": "XXXX",
    "countryCode": "DE",
    "deebotNames": [
        "XXXX"
    ],
    "refreshTimer": 240,
    "publishBipSwitch": false,
    "publishSwitch": true,
    "publishFan": true,
    "publishMotionDetector": true,
    "publishAutoSwitch": true,
    "publishEdgeSwitch": false,
    "publishSpotSwitch": false,
    "publishSpotAreaSwitches": [
        "0",
        "1",
        "2",
        "3"
    ],
    "platform": "DeebotEcovacs"
}

@Roy-H23 @ucsbricks

What tool are you using to analyze the traffic?

I'm using tcpflow:

sudo tcpflow -i eth0 -c host portal-eu.ecouser.net

I'm currently not using the plugin but I'm the developer of the deebot-ecovacs library that this plugin is using.
I own a OZMO 920 (nearly identical to OZMO 950) and also a Deebot 901.

There's only the expected amount of traffic while running 2 instances of my ioBroker adapter for that 2 devices.
The ioBroker adapter is also using the ecovacs-deebot library.
@nicoduj
I still don't think it's the library that's causing this large amount of traffic.

@mrbungle64 ok, fine, could be homebridge refresh process on getter.

@Roy-H23 / @ucsbricks do you have any always connected device with homekit enable (like a tablet) and/or set any automation with those deebots and/or maybe using homebridge interface (unsecure mode) to display your devices ?

Will try to reproduce, I only have an ozmo slim however but I think it uses the same protocol.

@mrbungle64 I can see the number of DNS request in my Pi-hole statistics.

I have put a wireshark in place quickly : as soon as I launch Homebridge, I can see 3 ping requests. However it stops just after, but If I launch home app it starts again for 3 more and If I let it open, yes, it asks for the state on the web again quite often I think to refresh the state.

@Roy-H23 @ucsbricks : could you confirm you have some always on home app or automatons that could explain the behavoior ?

If I want to prevent that, I would have to put some logic on the plugin, and to prevent triggering a refresh if the event channel is properly connected I think, because it would mean that any state change would be triggered by it.

@nicoduj my iPad is used as HomeKit bridge that uses HomeKit automations. And I have homebridge-alexa installed, exposing my Deebot to Alexa using some automation too. The Alexa plugin requires to turn Homebridge in insecure mode.

HomeKit automations are about start to clean room 1 at 10:00am on certain days and all rooms at 10:00am on the other days.

Alexa routines are voice output when motion sensor (needs attention) fires and "clean room [0|1|2|3]".

I tried to remove the motion sensor but it seemed to make no difference.

If you launch homebridge in debug mode, do you see frequent logs saying it is updating characteristics ?

@nicoduj I switched Homebridge to debug mode. Will run a full cleaning and wait some idle time. Then check the logs. See you later…

@nicoduj here are some typical excerpts from my Homebridge logs:

Logs while cleaning

[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - stopping deebots discovery, number of deebots found : 1
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - Discovered Deebot : XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - Edge Cleaning for XXXX : false
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - Spot Cleaning for XXXX : false
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - SpotArea Cleaning for XXXX : true
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - CustomArea Cleaning for XXXX : true
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - Setting Timer for background refresh every  : 240s
...
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getLowBatteryCharacteristic for XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getBatteryLevelCharacteristic for XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getChargingStateCharacteristic for XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getDeebotEcovacsOnCharacteristic for XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getDeebotEcovacsSpeedCharacteristic for XXXX
[24/02/2021, 10:02:59] [DeebotEcovacs] INFO - getDeebotEcovacsOnCharacteristic for XXXX
...
[24/02/2021, 10:03:00] [DeebotEcovacs] INFO - Vacbot XXXX ready: "Client connected. Subscribe successful"
...
[24/02/2021, 10:03:00] [DeebotEcovacs] INFO - Battery level for XXXX : 98 98 98
[24/02/2021, 10:03:00] [DeebotEcovacs] INFO - Clean speed fro XXXX : 2 - 2
[24/02/2021, 10:03:00] [DeebotEcovacs] INFO - Charge status for XXXX : idle true false
[24/02/2021, 10:03:00] [DeebotEcovacs] INFO - Clean status for XXXX : auto
...
[24/02/2021, 10:03:01] [DeebotEcovacs] INFO - Charge status for XXXX : idle true false
[24/02/2021, 10:03:01] [DeebotEcovacs] INFO - Charge status for XXXX : idle true false
[24/02/2021, 10:03:01] [DeebotEcovacs] INFO - Clean status for XXXX : auto
[24/02/2021, 10:03:01] [DeebotEcovacs] INFO - Clean status for XXXX : auto
...
[24/02/2021, 10:03:37] [DeebotEcovacs] INFO - Battery level for XXXX : 97 97 98
...
[24/02/2021, 10:04:45] [DeebotEcovacs] INFO - Battery level for XXXX : 96 96 97
...
[24/02/2021, 10:05:54] [DeebotEcovacs] INFO - Battery level for XXXX : 95 95 96
...
[24/02/2021, 10:06:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 10:06:59] [DeebotEcovacs] INFO - Clean status for XXXX : auto
[24/02/2021, 10:06:59] [DeebotEcovacs] INFO - Charge status for XXXX : idle true false
[24/02/2021, 10:06:59] [DeebotEcovacs] INFO - Battery level for XXXX : 95 95 95
[24/02/2021, 10:07:02] [DeebotEcovacs] INFO - Battery level for XXXX : 94 94 95
...
[24/02/2021, 10:08:11] [DeebotEcovacs] INFO - Battery level for XXXX : 93 93 94
...
[24/02/2021, 10:09:19] [DeebotEcovacs] INFO - Battery level for XXXX : 92 92 93
...
[24/02/2021, 10:10:28] [DeebotEcovacs] INFO - Battery level for XXXX : 91 91 92
...
[24/02/2021, 10:10:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 10:10:59] [DeebotEcovacs] INFO - Battery level for XXXX : 91 91 91
[24/02/2021, 10:10:59] [DeebotEcovacs] INFO - Charge status for XXXX : idle true false
[24/02/2021, 10:10:59] [DeebotEcovacs] INFO - Clean status for XXXX : auto
...
[24/02/2021, 10:11:36] [DeebotEcovacs] INFO - Battery level for XXXX : 90 90 91

Logs while charging

[24/02/2021, 11:37:23] [DeebotEcovacs] INFO - Battery level for XXXX : 65 65 64
...
[24/02/2021, 11:38:47] [DeebotEcovacs] INFO - Battery level for XXXX : 66 66 65
[24/02/2021, 11:38:48] [DeebotEcovacs] INFO - Battery level for XXXX : 65 65 66
...
[24/02/2021, 11:38:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:38:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:38:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:38:59] [DeebotEcovacs] INFO - Battery level for XXXX : 65 65 65
...
[24/02/2021, 11:40:33] [DeebotEcovacs] INFO - Battery level for XXXX : 66 66 65
...
[24/02/2021, 11:40:50] [DeebotEcovacs] INFO - Battery level for XXXX : 67 67 66
[24/02/2021, 11:40:51] [DeebotEcovacs] INFO - Battery level for XXXX : 66 66 67
...
[24/02/2021, 11:42:51] [DeebotEcovacs] INFO - Battery level for XXXX : 67 67 66
[24/02/2021, 11:42:52] [DeebotEcovacs] INFO - Battery level for XXXX : 66 66 67
...
[24/02/2021, 11:42:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:42:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:42:59] [DeebotEcovacs] INFO - Battery level for XXXX : 66 66 66
[24/02/2021, 11:42:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
...
[24/02/2021, 11:43:42] [DeebotEcovacs] INFO - Battery level for XXXX : 67 67 66
...
[24/02/2021, 11:44:54] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 67
[24/02/2021, 11:44:55] [DeebotEcovacs] INFO - Battery level for XXXX : 67 67 68
...
[24/02/2021, 11:46:52] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 67
...
[24/02/2021, 11:46:55] [DeebotEcovacs] INFO - Battery level for XXXX : 69 69 68
[24/02/2021, 11:46:56] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 69
...
[24/02/2021, 11:46:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:46:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:46:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:46:59] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 68
...
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getLowBatteryCharacteristic for XXXX
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getBatteryLevelCharacteristic for XXXX
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getChargingStateCharacteristic for XXXX
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getDeebotEcovacsOnCharacteristic for XXXX
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getDeebotEcovacsSpeedCharacteristic for XXXX
[24/02/2021, 11:47:55] [DeebotEcovacs] INFO - getDeebotEcovacsOnCharacteristic for XXXX
...
[24/02/2021, 11:47:56] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 68
[24/02/2021, 11:47:57] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:47:57] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:47:57] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:47:57] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
...
[24/02/2021, 11:48:58] [DeebotEcovacs] INFO - Battery level for XXXX : 69 69 68
[24/02/2021, 11:48:59] [DeebotEcovacs] INFO - Battery level for XXXX : 68 68 69
...
[24/02/2021, 11:50:02] [DeebotEcovacs] INFO - Battery level for XXXX : 69 69 68
...
[24/02/2021, 11:50:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:50:59] [DeebotEcovacs] INFO - Battery level for XXXX : 70 70 69
[24/02/2021, 11:50:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:50:59] [DeebotEcovacs] INFO - Battery level for XXXX : 70 70 70
[24/02/2021, 11:50:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:51:00] [DeebotEcovacs] INFO - Battery level for XXXX : 69 69 70
...
[24/02/2021, 11:53:01] [DeebotEcovacs] INFO - Battery level for XXXX : 70 70 69
[24/02/2021, 11:53:02] [DeebotEcovacs] INFO - Battery level for XXXX : 69 69 70
...
[24/02/2021, 11:54:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:54:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:54:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 11:54:59] [DeebotEcovacs] INFO - Battery level for XXXX : 70 70 70
[24/02/2021, 11:55:02] [DeebotEcovacs] INFO - Battery level for XXXX : 71 71 70
...
[24/02/2021, 11:55:03] [DeebotEcovacs] INFO - Battery level for XXXX : 70 70 71
...
[24/02/2021, 11:56:20] [DeebotEcovacs] INFO - Battery level for XXXX : 71 71 70
...
[24/02/2021, 11:57:05] [DeebotEcovacs] INFO - Battery level for XXXX : 72 72 71
[24/02/2021, 11:57:06] [DeebotEcovacs] INFO - Battery level for XXXX : 71 71 72
...
[24/02/2021, 11:58:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 11:58:59] [DeebotEcovacs] INFO - Battery level for XXXX : 71 71 71
[24/02/2021, 11:58:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 11:58:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop

Logs after battery completed charging

[24/02/2021, 13:32:56] [DeebotEcovacs] INFO - Battery level for XXXX : 100 100 100
[24/02/2021, 13:32:57] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 13:32:57] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 13:32:57] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 13:32:57] [DeebotEcovacs] INFO - Clean status for XXXX : stop
...
[24/02/2021, 13:34:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 13:34:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 13:34:59] [DeebotEcovacs] INFO - Battery level for XXXX : 100 100 100
[24/02/2021, 13:34:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
...
[24/02/2021, 13:38:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 13:38:59] [DeebotEcovacs] INFO - Battery level for XXXX : 100 100 100
[24/02/2021, 13:38:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 13:39:00] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
...
[24/02/2021, 13:42:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 13:42:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop
[24/02/2021, 13:42:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 13:42:59] [DeebotEcovacs] INFO - Battery level for XXXX : 100 100 100
...
[24/02/2021, 13:46:59] [DeebotEcovacs] INFO - refreshing - XXXX
[24/02/2021, 13:46:59] [DeebotEcovacs] INFO - Charge status for XXXX : charging false true
[24/02/2021, 13:46:59] [DeebotEcovacs] INFO - Battery level for XXXX : 100 100 100
[24/02/2021, 13:46:59] [DeebotEcovacs] INFO - Clean status for XXXX : stop

[UPDATE] When completely charged, there were 12 "[DeebotEcovacs] INFO - getXXXXCharacteristic for XXXX" log entries grouped in two blocks of six within one hour.

Thanks. With battery fully charged, it seems to do a refresh every 4 minutes, which is what you set. Each refreshing log should cause a call to ecovacs server. other are not. So I don't see what is causing so much calls ... If you "stop" alexa plugin , do you have the same behavior ? Will try to investigate, but so far di not reproduce / see this with wireshark enable .

With Alexa Plugin disabled, it is still the same. More than 20 DNS requests from my Homebridge server for portal-eu.ecouser.net every 2nd minute. All requests are send within roughly 10 seconds. But the 2 minute blocks are not exactly every 120 seconds, sometimes it’s from XX:XX:04 to XX:XX:11, the next run from YY:YY:42 to YY:YY:51 etc.

[Update] I can see one 2 minute block was skipped: XX:07:XX, XX:09:XX, XX:11:XX and XX:15:XX. The next one was skipped too XX:19:XX. Matching the 4 minute refresh cycle for now.

ok, so it helps, it seems to be "batched" every 2 minutes or so. You refresh timer is still at 240 ? Without any automation / other home app launched, I would expect those batch to be every 240 minutes (or with refresh timer disable at each home app launched). but still, will try to check how much are done on a refresh as soon as I can .

Yes it’s still 240 seconds(?) on my machine. Since XX:11:XX the server seems to be on the 4 minute schedule (as expected). And has reduced the number of DNS requests to 6 per cycle. Was 20+ when the 2 minute cycle was recorded.

@mrbungle64 Hi, In my refresh logic I use code like this :

      if (homebridgeAccessory.vacBot && homebridgeAccessory.vacBot.is_ready) {
        homebridgeAccessory.vacBot.run('GetCleanState');
        homebridgeAccessory.vacBot.run('GetChargeState');
      } else {
        homebridgeAccessory.vacBot.connect_and_wait_until_ready();
      }

Do you think it is ok ? Does each run could generate one or more connect ? Thanks for your help on this.

Some quick math: If 6 DNS requests are done every 4 minutes, that’s 2,160 requests per day. Makes it 15,120 per week. A lot but far from the numbers @Roy-H23 encountered.

His numbers would match a 20+ DNS requests every single minute scenario (201,600 per week).

@ucsbricks yes, right, I did the same :) But he can have some automation or always on home app that could trigger frequent update. I will try to drill down this, by first understanding why there is so much request per refresh :) Might be the way I use the lib and Not syncing multiple service refresh (homekit is quite tricky on this since it launches for each service in parrallel the getter to have the info)

@mrbungle64 Hi, In my refresh logic I use code like this :

      if (homebridgeAccessory.vacBot && homebridgeAccessory.vacBot.is_ready) {
        homebridgeAccessory.vacBot.run('GetCleanState');
        homebridgeAccessory.vacBot.run('GetChargeState');
      } else {
        homebridgeAccessory.vacBot.connect_and_wait_until_ready();
      }

Do you think it is ok ? Does each run could generate one or more connect ? Thanks for your help on this.

@nicoduj
I'll have a look at it later.

@mrbungle64 Hi, In my refresh logic I use code like this :

      if (homebridgeAccessory.vacBot && homebridgeAccessory.vacBot.is_ready) {
        homebridgeAccessory.vacBot.run('GetCleanState');
        homebridgeAccessory.vacBot.run('GetChargeState');
      } else {
        homebridgeAccessory.vacBot.connect_and_wait_until_ready();
      }

Do you think it is ok ? Does each run could generate one or more connect ? Thanks for your help on this.

@nicoduj
You should call vacBot.connect_and_wait_until_ready() only once per login session but there are 7 matches in index.js for that.
I don't know how often this is usually triggered.

It should not have a serious effect on the above models, but it could potentially cause a negative effect on the XMPP-based models.

@nicoduj
You should call vacBot.connect_and_wait_until_ready() only once per login session but there are 7 matches in index.js for that.
I don't know how often this is usually triggered.

It should not have a serious effect on the above models, but it could potentially cause a negative effect on the XMPP-based models.

Thank you. Indeed the code is not really well factorised :) , but the idea there is to connect if it is not connected, so it should be triggered only if the vacbot is not declared as ready (which I think means the vacbot is disconnected). I have the logic in each getter since they are called in // by homekit. It might happen that multiples are called so at once, but not in "normal" codition where the initial connection succeeded.

@nicoduj last night the plugin suddenly gone nuts. Between 02:47am and 02:58am (GMT) it send +10K DNS requests. It returned to a 4 minute cycle after this incident.

BTW: I removed the "needs attention" motion sensor and all associated automation yesterday after it triggered a false notification at around midnight. The warning was not recorded in the Ecovas companion app.

@nicoduj last night my Homebridge reached @Roy-H23’s numbers: It send 176K DNS requests within 6 hours.

[Update] The Deebot stand slightly off-center on its loading dock. It automatically shut off to preserve battery. Therefore it was offline. Maybe you should try to add some rule that increases the interval between retries when the plugin becomes aware that the robot could not be contacted for some time. My logs showed that the plugin send requests to the Ecovas server about a dozen times per second since the robot hibernated.

@ucsbricks Thank you, it seems that indeed the huge amount of request is not done in "normal" condition, will check this

Ok, I think I found the condition : when there is a timeout, I send 4 updates Commands. If they fail for a timeout, each one send 4 update commands, and so on .... Will try a fix asap for this, thank you for your help @ucsbricks

@ucsbricks @Roy-H23 Could you please check if it is better with latest 1.4.5-beta.0 ?

I will try next week. Currently I cannot check. But it was a basic config in Homebridge and i had no automations. The identified issue sounds promising.

@nicoduj OK, version 1.4.5-beta.0 is installed now. I will keep an eye on the logs and post a report tomorrow.

The 176K request event did not happen today when I turned the Deebot’s power switch off to simulate a non-normal condition.

[Update] The number of daily requests was around 5.3K DNS requests in the past days. I did not encounter any new incidents so far.

Will wait a bit, and if evrything is ok will publish a final version. Thank you !

I found a new issue w/ this version, that happened five times so far:

At some point – w/o any known reason – the plugin completely stops to send requests to the Ecovas server. Restarting Homebridge "fixes" the issue for some hours/days.

I stopped counting… The issue of stopped requests happened 20+ times so far.

Hi, It seems that what I did to prevent huge dns request results in some case of update lost. It does not happen with my deebot, so I have to rethink this but don't have a lot of time thoses days, sorry.

to be tested again in 1.4.5-beta.1

Thanks. I will update my Homebridge instance tonight and send you feedback.