bwp91 / homebridge-deebot

Homebridge plugin to integrate ECOVACS Deebot devices into HomeKit.
MIT License
64 stars 4 forks source link

Enable/disable TrueDetect #138

Open mgmellia opened 1 year ago

mgmellia commented 1 year ago

The TrueDetect 3D feature can be disabled only "globally" from the advanced menu. It would be nice to be able to program it from the plugin and then use it coupled with the predefined areas to dis/enable it based on the room.

The rationale is that TrueDetect in some rooms does not work properly and this confuses the robot that avoids entering some part of the floor as it thinks there is something there (which is not correct). The ability to disable/enable the TrueDetect feature would solve this issue.

bwp91 commented 1 year ago

@mrbungle64 is this something that can be exposed via your client?

mgmellia commented 1 year ago

yes, it's an option that one can de/activate using the mobile app. I already extracted the command (using MITM and intercepting the messages). I can share it if this can be useful as soon as I get back to my home PC. https://www.ecovacs.com/us/support/DEEBOT-OZMO-T8-AMR/faq-detail?id=184&product_id=40

mrbungle64 commented 1 year ago

@bwp91

bwp91 commented 1 year ago

@mgmellia have just published a beta version of the plugin. uses the Eve app to enable/disable. Please note that I have not been able to test this, so please keep an eye on the hb log. Let me know you get on!

@mrbungle64 thank you!

mgmellia commented 1 year ago

Thanks @bwp91 ! I installed the beta, and played a bit with it. In the EVE app, I see two new lines, but those are called "Configured..." and do not look like switches :( image Here is a screenshot of the app as it looks like now. It's in Italian, but pretty clear.

I also added a "supportTrueDetect": true in the config file, but nothing changes. Not clear to me if this shall be done though.

Here is part of the log from the homebridge if this can help

[24/07/2023, 21:23:24] [Deebot] [1] device(s) found in your account. [24/07/2023, 21:23:25] [Deebot] [Giacomo 3] no air drying available or not configured. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] initialising with options: {"hideMotionSensor":false,"motionDuration":30,"lowBattThreshold":15,"showMotionLowBatt":false,"showBattHumidity":false,"showAirDryingSwitch":"presetting","supportTrueDetect":false,"commandType1":"","spotAreaCommand1":"","customAreaCommand1":"","commandNote1":"","commandType2":"","spotAreaCommand2":"","customAreaCommand2":"","commandNote2":"","commandType3":"","spotAreaCommand3":"","customAreaCommand3":"","commandNote3":"","commandType4":"","spotAreaCommand4":"","customAreaCommand4":"","commandNote4":"","commandType5":"","spotAreaCommand5":"","customAreaCommand5":"","commandNote5":"","commandType6":"","spotAreaCommand6":"","customAreaCommand6":"","commandNote6":"","commandType7":"","spotAreaCommand7":"","customAreaCommand7":"","commandNote7":"","commandType8":"","spotAreaCommand8":"","customAreaCommand8":"","commandNote8":"","commandType9":"","spotAreaCommand9":"","customAreaCommand9":"","commandNote9":"","commandType10":"","spotAreaCommand10":"","customAreaCommand10":"","commandNote10":"","commandType11":"","spotAreaCommand11":"","customAreaCommand11":"","commandNote11":"","commandType12":"","spotAreaCommand12":"","customAreaCommand12":"","commandNote12":"","commandType13":"","spotAreaCommand13":"","customAreaCommand13":"","commandNote13":"","commandType14":"","spotAreaCommand14":"","customAreaCommand14":"","commandNote14":"","commandType15":"","spotAreaCommand15":"","customAreaCommand15":"","commandNote15":""}. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] initialised with id [.....] additional info {"did":"...","name":"....","class":"0bdtzz","resource":"tYnd","nick":"Giacomo 3","company":"eco-ng","bindTs":1682341555024,"service":{"jmq":"jmq-ngiot-eu.dc.ww.ecouser.net","mqs":"api-ngiot.dc-as.ww.ecouser.net"},"homeId":"...","homeSort":1,"deviceName":"DEEBOT OZMO T8 PURE","icon":"https://portal-ww.ecouser.net/api/pim/file/get/5fa105bbd16a99000667eb52","ota":true,"UILogicId":"DT_8G","materialNo":"...","pid":"...","product_category":"DEEBOT","model":"OT8_PURE","updateInfo":{"needUpdate":false,"changeLog":""},"status":1,"offmap":true,"otaUpgrade":{},"deviceNumber":0}. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] sending update [GetBatteryState]. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] sending update [GetChargeState]. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] sending update [GetCleanState_V2]. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] sending update [GetCleanSpeed]. [24/07/2023, 21:23:28] [Deebot] [Giacomo 3] sending update [GetNetInfo]. [24/07/2023, 21:23:28] [Deebot] ✓ Setup complete. This plugin has been made with ♥ by bwp91, please consider a ☆ on GitHub if you are finding it useful! [24/07/2023, 21:23:29] [Deebot] [Giacomo 3] receiving update [BatteryInfo: 100]. [24/07/2023, 21:23:29] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:29] [Deebot] [Giacomo 3] receiving update [CleanReport: idle]. [24/07/2023, 21:23:29] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetBatteryState]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetChargeState]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetCleanState_V2]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetCleanSpeed]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetNetInfo]. [24/07/2023, 21:23:30] [Deebot] [Giacomo 3] sending update [GetMaps]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [NetInfoIP: 192.168.1.95]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [NetInfoMAC: ...]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [CleanSpeed: 2]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [NetInfoIP: 192.168.1.95]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [NetInfoMAC: ...]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [CleanReport: idle]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [BatteryInfo: 100]. [24/07/2023, 21:23:31] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:32] [Deebot] [Giacomo 3] Maps: {"maps":[{"mapID":"1118464773","mapIndex":2,"mapName":"","mapStatus":0,"mapIsCurrentMap":true,"mapIsBuilt":true}]}. [24/07/2023, 21:23:32] [Deebot] [Giacomo 3] receiving update [CleanSpeed: 2]. [24/07/2023, 21:23:33] [Deebot] [Giacomo 3] has been reported [online]. [24/07/2023, 21:23:34] [Deebot] [Giacomo 3] receiving update [ChargeState: charging]. [24/07/2023, 21:23:34] [Deebot] [Giacomo 3] MapSpotAreas: {"mapID":"1118464773","mapSetID":"1059424960","mapSpotAreas":[{"mapSpotAreaID":"0"},{"mapSpotAreaID":"1"},{"mapSpotAreaID":"2"},{"mapSpotAreaID":"3"},{"mapSpotAreaID":"4"},{"mapSpot

incline02 commented 1 year ago

Hey all @mgmellia @mrbungle64 @bwp91

Following this closely, am I correct to assume that only/all features that can be disabled "globally from the advanced" menu can be implemented into the homebridge plugin?

I have bunch of request but I can't personally what is realistic ask from you if I can't know what can be implemented into the plug. Would you be interested in working on improvements with a zealous user? I've event sent a mail today to Ecovcas suggesting various things

xyz667 commented 1 year ago

@mgmellia have just published a beta version of the plugin. uses the Eve app to enable/disable. Please note that I have not been able to test this, so please keep an eye on the hb log. Let me know you get on!

Wow, this is great! I was able to create a scene that cleans one room with TrueDetect off (or AIVI 3D as it’s called in my X1).

But could you please explain the logic a bit more? The TrueDetect switch in the Eve app does not reflect the current global setting in the ECOVACS app - is this supposed to be like that?

Also, once I activate a scene that has the TrueDetect switch off, it stays like that, even after the cleaning job is finished. This could/should be improved I think. I would prefer TrueDetect to return to the previous setting (maybe define a default value that is always set once cleaning jobs are finished).

But great work so far!

bwp91 commented 1 year ago

The first beta was just a test to try to control the status of true detect.

The newer beta (just pushed now) is an attempt to retrieve the current status and update. This probably won't work at first because I don't know the incoming values for on/off but if anyone can share some logs of hopefully

[accessory] receiving update [TrueDetect: XXX]

this would be super

bwp91 commented 1 year ago

i don't own a device with this feature (i dont think!) so may take a bit of to-ing and frow-ing to get this to work!

xyz667 commented 1 year ago

The newer beta (just pushed now) is an attempt to retrieve the current status and update. This probably won't work at first because I don't know the incoming values for on/off but if anyone can share some logs of hopefully

[accessory] receiving update [TrueDetect: XXX]

When enabling TrueDetect in the ECOVACS app instantly: „receiving update (TrueDetect: 1]“ When disabling TrueDetect: nothing?!

EDIT: I notice the ChargeState update is output twice when TrueDetect is disabled.

bwp91 commented 1 year ago

Please try newest beta

xyz667 commented 1 year ago

Please try newest beta

Looking good!

[26.7.2023, 22:33:02] [Deebot] [device] receiving update [TrueDetect: 0].
[26.7.2023, 22:33:02] [Deebot] [device] current true detection state [0].
[26.7.2023, 22:33:30] [Deebot] [device] receiving update [TrueDetect: 1].
[26.7.2023, 22:33:30] [Deebot] [device] current true detection state [1].
xyz667 commented 1 year ago

In the periodic updates the ChargeState is output three times however??

[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetBatteryState].
[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetChargeState].
[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetCleanState_V2].
[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetCleanSpeed].
[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetNetInfo].
[26.7.2023, 22:39:46] [Deebot] [device] sending update [GetTrueDetect].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [BatteryInfo: 100].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [CleanSpeed: 2].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [CleanReport: idle].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [ChargeState: charging].
[26.7.2023, 22:39:47] [Deebot] [device] CurrentCustomAreaValues: "".
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [ChargeState: charging].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [TrueDetect: 1].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [NetInfoIP: 192.168.xx.xx].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [NetInfoMAC: xx:xx:xx:xx:xx:xx].
[26.7.2023, 22:39:47] [Deebot] [device] receiving update [ChargeState: charging].
bwp91 commented 1 year ago

@xyz667 just pushed one more beta to try

bwp91 commented 1 year ago

@xyz667

In the periodic updates the ChargeState is output three times however??

Don't worry about this - beta versions of the plugin display more logging than necessary, it's just how it's all working behind the scenes

mgmellia commented 1 year ago

on my Deebot OZMO T8 Pure the beta version seems to not correctly detect the TrueDetect feature :(

[Deebot] [Giacomo 3] initialising with options: {"hideMotionSensor":false,"motionDuration":30,"lowBattThreshold":15,"showMotionLowBatt":false,"showBattHumidity":false,"showAirDryingSwitch":"presetting","supportTrueDetect":false,"commandType1":"","spotAreaCommand1":"",

the log in fact do not show such property which exists on the app (and I can turn it on/off from there)

bwp91 commented 1 year ago

@mgmellia and in fact i will tag @xyz667 for reasons explained later

i try to keep this plugin as 'clean' as possible rather than by default exposing any features that end up showing as 100 switches in the home app.

so the features that i expose by default, generally, are the "clean" and "go charge" options.

Things like this new true detect I like to keep 'opt-in' meaning you will need to use the plugin config to enable this per device if it supports it. I don't have access to my homebridge instance right now, so that's why I was hoping that @xyz667 could share a screenshot of the config setting and how it appears in the homebridge ui 😀

bwp91 commented 1 year ago

@incline02 the above message may start to help with your query. Any additional features I tend not to immediately implement in the plugin unless it's starting to cause a stir on here.

Optimistically speaking, anything possible through the ecovacs app should be possible with the plugin. But this also depends on whether the lovely mrbungle64 has implemented the feature on his package that this plugin heavily relies on.

bwp91 commented 1 year ago

feedback on newest beta would be great, @mgmellia i assume you are no longer encountering the issue in your first screenshot earlier about the eve app?

xyz667 commented 1 year ago

Things like this new true detect I like to keep 'opt-in' meaning you will need to use the plugin config to enable this per device if it supports it. I don't have access to my homebridge instance right now, so that's why I was hoping that @xyz667 could share a screenshot of the config setting and how it appears in the homebridge ui 😀

As requested, here‘s a screenshot (unchanged to previous beta versions): IMG_0151

xyz667 commented 1 year ago

feedback on newest beta would be great, @mgmellia i assume you are no longer encountering the issue in your first screenshot earlier about the eve app?

I too am seeing the additional „Config Name“ entries in EVE, even in the latest beta? (German language EVE app) IMG_7186

Btw why am I defining names for the different predefined areas when they are not shown anywhere (only 1,2,3 in EVE)?

mgmellia commented 1 year ago

feedback on newest beta would be great, @mgmellia i assume you are no longer encountering the issue in your first screenshot earlier about the eve app?

Sorry but last night I had to fight against nodejd update and homebridge that lost all plugins and configurations. This evening I'll try. On the app I still see "Configured..." as above. Beta5 if I'm not mistaken (not able to access now to raspy@home ;))

bwp91 commented 1 year ago

Oh the configured name thing i understand now. Ironically at the time i assumed it was something in german (without thinking) but it’s actually english 🤣 This extra configured name is so the switches properly display the correct names (Clean, Go Charge) in the home app. Otherwise due to a recent homekit update, all the switches just showed the name of the accessory which was very unhelpful when trying to determine which switch does what

bwp91 commented 1 year ago

@xyz667

Btw why am I defining names for the different predefined areas when they are not shown anywhere (only 1,2,3 in EVE)?

do you mean in the plugin settings screen?

xyz667 commented 1 year ago

@xyz667

Btw why am I defining names for the different predefined areas when they are not shown anywhere (only 1,2,3 in EVE)?

do you mean in the plugin settings screen?

Yes. But I just noticed that this screen says „Note“ not „Name“ - I misread. Still would be nice to show the Name of the area in EVE and not the technical ID that I have to lookup all the time as I can‘t remember. But that‘s another issue….

mgmellia commented 1 year ago

I did some test with my DEEBOT OZMO T8 PURE and the Beta-5 version of the plugin. Unfortunately it detects the support TrueDetect as false, so nothing happens. Shall I add some additional configuration entry to enable it? I tried adding “TrueDetect”: true, and “supportTrueDetect”: true, but nothing changes.

EDIT - Solved :) I added the DeviceID and then I was able to enable the TrueDetect switch from the homebridge configuration helper. Once enabled, the EVE app allows me to enable/disable the TrueDetect. The change is reflected in the Deboot app consistently (viceversa works as well).

xyz667 commented 1 year ago

EDIT - Solved :) I added the DeviceID and then I was able to enable the TrueDetect switch from the homebridge configuration helper. Once enabled, the EVE app allows me to enable/disable the TrueDetect. The change is reflected in the Deboot app consistently (viceversa works as well).

Cool. Now you need to set the areas as well, and you could create HomeKit scenes for certain areas/rooms with TrueDetect on or off.

In theory this actually works for me. However:

  1. if a scene has TrueDetect off it stays off, even after the cleaning job is done,
  2. my Deebot happily announces the start of area cleaning (by voice), but instead actually starts an Auto clean of all areas/rooms (AUTO in cleaning log in the Ecovacs app, instead of Area)?! The Homebridge log states it starts cleaning of (for example) area 4, while the bot starts cleaning in Auto mode in area 1.

Edit: one of my 5 areas works as expected, the respective scene starts a cleaning job of this area, the others just start an Auto job as described in 2 above. No idea why.

mgmellia commented 1 year ago

I managed to create a scene to clean the kitchen with TrueDetect disabled, and two scenes to enable/disable it. everything works as supposed 👍

1) For TrueDetect remaining disabled, I guess that's the desired behaviour. It's a on/off switch... so once it goes off it stays off. One option is to create a scene/shortcut that disabled it, starts cleaning, and then reenabled it.

2) Same here. The Ecovacs logs the cleaning as an auto cleaning instead of an area. I'll check it better this weekend.

My problem is that the kitchen area ID is equal to 0. So I'm not sure this is allowed. As said, I'll do more tests during the weekend. But for now - it works much better than the Ecovacs app which does not allow disabling the TrueDetect on a per-room basis.

bwp91 commented 1 year ago

My problem is that the kitchen area ID is equal to 0.

No, 0 is really a placeholder for when no area is set. There are 15 available numbers to choose from, if needed i can increase this to, say, 20.

mgmellia commented 1 year ago

My problem is that the kitchen area ID is equal to 0.

No, 0 is really a placeholder for when no area is set. There are 15 available numbers to choose from, if needed i can increase this to, say, 20.

My problem is that the kitchen has mapSpotAreaID=0... It is not clear to me how can I set a scene via the EVE app to clean only the kitchen. If I understood correctly, the value "0" is kind of a "no specific area" -- or "all areas". Am I correct? Or is "0" a regular areaID?

Below a snap of the logs

[30/07/2023, 08:43:35] [Deebot] [Giacomo 3] MapSpotAreas: {"mapID":"1118464773","mapSetID":"647257770","mapSpotAreas":[{"mapSpotAreaID":"0"},{"mapSpotAreaID":"1"},{"mapSpotAreaID":"4"},{"mapSpotAreaID":"5"},{"mapSpotAreaID":"2"},{"mapSpotAreaID":"6"},{"mapSpotAreaID":"7"},{"mapSpotAreaID":"10"},{"mapSpotAreaID":"9"}]}. [30/07/2023, 08:43:36] [Deebot] [Giacomo 3] MapSpotAreaInfo: {"mapID":"1118464773","mapSpotAreaID":"0","mapSpotAreaName":"Kitchen","mapSpotAreaConnections":"1,","mapSpotAreaBoundaries":"...","mapSpotAreaSubType":"5","mapSpotAreaSequenceNumber":0,"mapSpotAreaCleanSet":{"cleanCount":2,"cleanSpeed":2,"waterLevel":2}}. [30/07/2023, 08:43:36] [Deebot] [Giacomo 3] MapSpotAreaInfo: {"mapID":"1118464773","mapSpotAreaID":"1","mapSpotAreaName":"Dining room","mapSpotAreaConnections":"4,5,2,6,7,10,9,0,","mapSpotAreaBoundaries":"...","mapSpotAreaSubType":"2","mapSpotAreaSequenceNumber":0,"mapSpotAreaCleanSet":{"cleanCount":1,"cleanSpeed":2,"waterLevel":2}}.

EDIT: I figured out how this works: the "predefined area" in the EVE app has a different meaning than the "mapSpotAreaID" in the Deebot logs. In practice, in the EVE app, the area=0 means "no area selected". Then area=1 corresponds to the "AreaType1" in the plugin config. Area=2 is the AreaType2 in the plugin etc. Quite confusing, but it works in fact.

xyz667 commented 1 year ago

Something is definitely off with those area definitions. I’ve checked 20 times. Area 3 in the Homebridge device settings is set to MapSpotAreaID 3, but it doesn’t go and clean that area when triggered. At least not the area as shown in Ecovacs app with the corresponding name in Homebridge log.

Another thing I don’t understand: why is the Deebot switch on all the time? (Either the Clean or the Go Charge subswitch always enabled) Shouldn’t the Go Charge subswitch disable when the boot is back in the base and charging?

xyz667 commented 1 year ago

Hi @bwp91 , while we’re at it, what about adding a few more toggles on top of TrueDetect? ;-)

These are the ones that could be useful IMO: Cleaning Times 1, 2 Suction Power Quiet, Standard, Strong, Max Water Flow Level Low, Medium, High Mopping Mode Standard, Deep Mop-Only On/Off

xyz667 commented 1 year ago

Another thing I don’t understand: why is the Deebot switch on all the time? (Either the Clean or the Go Charge subswitch always enabled) Shouldn’t the Go Charge subswitch disable when the boot is back in the base and charging?

Hm. Currently all 2 switches are off. Maybe because Air Drying is in progress and I’ve disabled the switch for that in Homebridge config?

bwp91 commented 1 year ago

Hi @bwp91 , while we’re at it, what about adding a few more toggles on top of TrueDetect? ;-)

These are the ones that could be useful IMO: Cleaning Times 1, 2 Suction Power Quiet, Standard, Strong, Max Water Flow Level Low, Medium, High Mopping Mode Standard, Deep Mop-Only On/Off

Anything here would be possible 😄

https://github.com/mrbungle64/ecovacs-deebot.js/wiki/Shortcut-functions#more-or-less-full-list-of-commands

mgmellia commented 11 months ago

Getting back to this. After 4+ weeks of testing, the new features work perfectly for me. Are these changes pushed to the stable version? Or better not to update to 6.1.0?