diff --git a/backend/lib/robots/dreame/DreameL10SProUltraHeatValetudoRobot.js b/backend/lib/robots/dreame/DreameL10SProUltraHeatValetudoRobot.js index 36aceba50f..ab6c94bf7c 100644 --- a/backend/lib/robots/dreame/DreameL10SProUltraHeatValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameL10SProUltraHeatValetudoRobot.js @@ -177,6 +177,7 @@ class DreameL10SProUltraHeatValetudoRobot extends DreameGen4ValetudoRobot { QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_WATER_USAGE), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_CLEANING_PROCESS_TRIGGER), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.WATER_HOOKUP_TEST_TRIGGER), + QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE_WITH_QUICK), ] })); diff --git a/backend/lib/robots/dreame/DreameL40UltraValetudoRobot.js b/backend/lib/robots/dreame/DreameL40UltraValetudoRobot.js index 8981627ecb..4997f5cde8 100644 --- a/backend/lib/robots/dreame/DreameL40UltraValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameL40UltraValetudoRobot.js @@ -183,6 +183,7 @@ class DreameL40UltraValetudoRobot extends DreameGen4ValetudoRobot { QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.DETACH_MOPS), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_CLEANING_PROCESS_TRIGGER), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.WATER_HOOKUP_TEST_TRIGGER), + QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE_WITH_QUICK), ] })); diff --git a/backend/lib/robots/dreame/DreameMovaS20UltraValetudoRobot.js b/backend/lib/robots/dreame/DreameMovaS20UltraValetudoRobot.js index 3f866359a1..8c4fae904f 100644 --- a/backend/lib/robots/dreame/DreameMovaS20UltraValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameMovaS20UltraValetudoRobot.js @@ -177,6 +177,7 @@ class DreameMovaS20UltraValetudoRobot extends DreameGen4ValetudoRobot { QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CAMERA_LIGHT), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_CLEANING_PROCESS_TRIGGER), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.WATER_HOOKUP_TEST_TRIGGER), + QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE), ] })); diff --git a/backend/lib/robots/dreame/DreameQuirkFactory.js b/backend/lib/robots/dreame/DreameQuirkFactory.js index 8c7bf45bad..d97ba7a84c 100644 --- a/backend/lib/robots/dreame/DreameQuirkFactory.js +++ b/backend/lib/robots/dreame/DreameQuirkFactory.js @@ -1179,6 +1179,111 @@ class DreameQuirkFactory { } } }); + case DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE: + return new Quirk({ + id: id, + title: "Clean Route", + description: "Trade speed for thoroughness and vice-versa. \"Intensive\" and \"Deep\" only apply when mopping.", + options: ["Standard", "Intensive", "Deep"], + getter: async () => { + const res = await this.helper.readProperty( + DreameMiotServices["GEN2"].VACUUM_2.SIID, + DreameMiotServices["GEN2"].VACUUM_2.PROPERTIES.MISC_TUNABLES.PIID + ); + + const deserializedResponse = DreameUtils.DESERIALIZE_MISC_TUNABLES(res); + switch (deserializedResponse.CleanRoute) { + case 3: + return "Deep"; + case 2: + return "Intensive"; + case 1: + return "Standard"; + default: + throw new Error(`Received invalid value ${deserializedResponse.FillinLight}`); + } + }, + setter: async (value) => { + let val; + + switch (value) { + case "Deep": + val = 3; + break; + case "Intensive": + val = 2; + break; + case "Standard": + val = 1; + break; + default: + throw new Error(`Received invalid value ${value}`); + } + + return this.helper.writeProperty( + DreameMiotServices["GEN2"].VACUUM_2.SIID, + DreameMiotServices["GEN2"].VACUUM_2.PROPERTIES.MISC_TUNABLES.PIID, + DreameUtils.SERIALIZE_MISC_TUNABLES_SINGLE_TUNABLE({ + CleanRoute: val + }) + ); + } + }); + case DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE_WITH_QUICK: + return new Quirk({ + id: id, + title: "Clean Route", + description: "Trade speed for thoroughness and vice-versa. \"Intensive\" and \"Deep\" only apply when mopping.", + options: ["Quick", "Standard", "Intensive", "Deep"], + getter: async () => { + const res = await this.helper.readProperty( + DreameMiotServices["GEN2"].VACUUM_2.SIID, + DreameMiotServices["GEN2"].VACUUM_2.PROPERTIES.MISC_TUNABLES.PIID + ); + + const deserializedResponse = DreameUtils.DESERIALIZE_MISC_TUNABLES(res); + switch (deserializedResponse.CleanRoute) { + case 4: + return "Quick"; + case 3: + return "Deep"; + case 2: + return "Intensive"; + case 1: + return "Standard"; + default: + throw new Error(`Received invalid value ${deserializedResponse.FillinLight}`); + } + }, + setter: async (value) => { + let val; + + switch (value) { + case "Quick": + val = 4; + break; + case "Deep": + val = 3; + break; + case "Intensive": + val = 2; + break; + case "Standard": + val = 1; + break; + default: + throw new Error(`Received invalid value ${value}`); + } + + return this.helper.writeProperty( + DreameMiotServices["GEN2"].VACUUM_2.SIID, + DreameMiotServices["GEN2"].VACUUM_2.PROPERTIES.MISC_TUNABLES.PIID, + DreameUtils.SERIALIZE_MISC_TUNABLES_SINGLE_TUNABLE({ + CleanRoute: val + }) + ); + } + }); default: throw new Error(`There's no quirk with id ${id}`); } @@ -1211,7 +1316,9 @@ DreameQuirkFactory.KNOWN_QUIRKS = { CAMERA_LIGHT: "bba079c2-293b-4ad5-99b8-4102a1220b12", DETACH_MOPS: "4a52e16b-3c73-479d-b308-7f0bbdde0884", MOP_DOCK_CLEANING_PROCESS_TRIGGER: "42c7db4b-2cad-4801-a526-44de8944a41f", - WATER_HOOKUP_TEST_TRIGGER: "86094736-d66e-40c3-807c-3f5ef33cbf09" + WATER_HOOKUP_TEST_TRIGGER: "86094736-d66e-40c3-807c-3f5ef33cbf09", + CLEAN_ROUTE: "ce44b688-f8bc-43a4-b44d-6db0d003c859", + CLEAN_ROUTE_WITH_QUICK: "924c82a8-1c3f-4363-9303-e6158e0ca41c", }; module.exports = DreameQuirkFactory; diff --git a/backend/lib/robots/dreame/DreameUtils.js b/backend/lib/robots/dreame/DreameUtils.js index 82047eb843..ddb236e8b5 100644 --- a/backend/lib/robots/dreame/DreameUtils.js +++ b/backend/lib/robots/dreame/DreameUtils.js @@ -139,6 +139,7 @@ class DreameUtils { * * @property {number} [AutoDry] * @property {number} [CleanType] + * @property {number} [CleanRoute] * @property {number} [FillinLight] * @property {number} [FluctuationConfirmResult] * @property {number} [FluctuationTestResult] diff --git a/backend/lib/robots/dreame/DreameX40MasterValetudoRobot.js b/backend/lib/robots/dreame/DreameX40MasterValetudoRobot.js index 860a11c370..ac6f1d25da 100644 --- a/backend/lib/robots/dreame/DreameX40MasterValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameX40MasterValetudoRobot.js @@ -183,6 +183,7 @@ class DreameX40MasterValetudoRobot extends DreameGen4ValetudoRobot { QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.DETACH_MOPS), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_CLEANING_PROCESS_TRIGGER), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.WATER_HOOKUP_TEST_TRIGGER), + QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE_WITH_QUICK), ] })); diff --git a/backend/lib/robots/dreame/DreameX40UltraValetudoRobot.js b/backend/lib/robots/dreame/DreameX40UltraValetudoRobot.js index bc51222dde..18dfcdc544 100644 --- a/backend/lib/robots/dreame/DreameX40UltraValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameX40UltraValetudoRobot.js @@ -183,6 +183,7 @@ class DreameX40UltraValetudoRobot extends DreameGen4ValetudoRobot { QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.DETACH_MOPS), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.MOP_DOCK_CLEANING_PROCESS_TRIGGER), QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.WATER_HOOKUP_TEST_TRIGGER), + QuirkFactory.getQuirk(DreameQuirkFactory.KNOWN_QUIRKS.CLEAN_ROUTE_WITH_QUICK), ] }));