Skip to content

Commit

Permalink
Dev (#644)
Browse files Browse the repository at this point in the history
* Add support for S8 MaxV (Ultra)

* Fix cleaning records creation for s8 maxv

* Change logging to warn for newly found attributes

* Improve S8 MaxV support

* Fix detection of home_sec

Only MaxV models support this

* Update README.md
  • Loading branch information
copystring authored Sep 8, 2024
1 parent 74bff36 commit 2fdf4be
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ This feature only works when map creation is enabled in the adapter options!
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
* (copystring) Add basic support for S8 MaxV Ultra
* (copystring) Newly found attributes are now warning instead of error
* (copystring) Improve detection of `home_sec`

### 0.6.12 (2024-09-08)
* (copystring) Change go2rtc github to go2rtc-static npm

Expand Down
37 changes: 35 additions & 2 deletions lib/deviceFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ const actions = {
set_switch_status: () => {
deviceStates.switch_status = "number";
},
set_task_id: () => {
cleaningRecordsString.task_id = { type: "number", name: "cleaning_record_task_id" };
},
set_monitor_status: () => {
deviceStates.monitor_status = "number";
},
};

class deviceFeatures {
Expand Down Expand Up @@ -419,7 +425,7 @@ class deviceFeatures {
deviceStates.camera_status = "number";
}

isPhotoUploadSupported() {
isVideoLiveCallSupported() {
deviceStates.home_sec_enable_password = "number";
deviceStates.home_sec_status = "number";
const ip = this.adapter.config.hostname_ip;
Expand Down Expand Up @@ -561,7 +567,8 @@ class deviceFeatures {
isDustCollectionSettingSupported: !!(33554432 & this.features),
isSupportedDrying: ((this.features / Math.pow(2, 32)) >> 15) & 1,
isShakeMopSetSupported: !!(262144 & this.features),
isVideoSettingSupported: !!(64 & this.features),
isVideoMonitorSupported: !!(8 & this.features), // I tested this for S7 MaxV, S8 MaxV
isVideoSettingSupported: !!(64 & this.features), // I tested this for S7 MaxV, S8 MaxV
isCarpetSupported: !!(512 & this.features),
isPhotoUploadSupported: !!(65536 & this.features),
isAvoidCollisionSupported: !!(134217728 & this.features),
Expand All @@ -588,6 +595,7 @@ class deviceFeatures {
"roborock.vacuum.a27", // S7 MaxV (Ultra)
"roborock.vacuum.a87", // Qrevo MaxV
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
].includes(this.model),
// isShakeMopStrengthSupported: p.DMM.currentProduct == p.Products.TanosS || p.DMM.currentProduct == p.Products.TanosSPlus || p.DMM.isGarnet || p.DMM.isTopazSV || p.DMM.isPearlPlus || p.DMM.isCoral || p.DMM.isTopazS || p.DMM.isTopazSPlus || p.DMM.isTopazSC || p.DMM.isTopazSV || p.DMM.isPearlPlus || p.DMM.isTanosSMax || p.DMM.isUltron || p.DMM.isUltronSPlus || p.DMM.isUltronSMop || p.DMM.isUltronSV || p.DMM.isPearl
isShakeMopStrengthSupported: [
Expand Down Expand Up @@ -628,6 +636,7 @@ class deviceFeatures {
"roborock.vacuum.a75", // Q Revo
"roborock.vacuum.a87", // Qrevo MaxV
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
].includes(this.model),
isCustomWaterBoxDistanceSupported: !!(2147483648 & this.features),
isBackChargeAutoWashSupported: this.featuresStr && !!(4096 & parseInt("0x" + this.featuresStr.slice(-8))),
Expand All @@ -646,6 +655,7 @@ class deviceFeatures {
"roborock.vacuum.a65", // S7 Max Ultra
"roborock.vacuum.a87", // Qrevo MaxV
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
].includes(this.model),
// this isn't the correct way to use this. This code must be from a different robot
// isVoiceControlSupported: !!(parseInt(`0x${this.featuresStr || "0"}`.slice(-10, -9)) & 2),
Expand All @@ -654,6 +664,12 @@ class deviceFeatures {
],
isElectronicWaterBoxSupported: [], // nothing for now. If this is needed, add the models here
isCleanRouteFastModeSupported: this.featuresStr && !!(256 & parseInt("0x" + this.featuresStr.slice(-8))),
isVideoLiveCallSupported: [
"roborock.vacuum.a10", // S6 MaxV
"roborock.vacuum.a27", // S7 MaxV (Ultra)
"roborock.vacuum.a97", // S8 MaxV (Ultra)
"roborock.vacuum.a87", // Qrevo MaxV
].includes(this.model),
};
}

Expand Down Expand Up @@ -807,6 +823,23 @@ class deviceFeatures {
"set_cleaned_area",
"set_switch_status",
],
// S8 MaxV (Ultra)
"roborock.vacuum.a97": [
"setCleaningRecordsString",
"setConsumablesInt",
"set_cleaned_area",
"set_last_clean_t",
"set_switch_status",
"set_monitor_status",
"set_kct",
"set_common_status",
"set_rss",
"set_clean_percent",
"set_charge_status",
"set_in_warmup",
"set_map_flag",
"set_task_id",
],
};

// process modelConfig
Expand Down
4 changes: 2 additions & 2 deletions lib/vacuum.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class vacuum {
const isCleaning = this.adapter.isCleaning(deviceStatus[0]["state"]);

if (!(await this.adapter.getObjectAsync(`Devices.${duid}.deviceStatus.${attribute}`))) {
this.adapter.catchError(
`Unsported attribute: ${attribute} of get_status with value ${deviceStatus[0][attribute]}. Please contact the dev to add the newly found attribute of your robot.`, "get_status", duid, this.robotModel
this.adapter.log.warn(
`Unsported attribute: ${attribute} of get_status with value ${deviceStatus[0][attribute]}. Please contact the dev to add the newly found attribute of your robot. Model: ${this.robotModel}`
);
continue; // skip unsupported attributes
}
Expand Down
10 changes: 9 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,15 @@ class Roborock extends utils.Adapter {
}

async createCleaningRecord(duid, state, type, states, unit) {
for (let i = 0; i < 20; i++) {
let start = 0;
let end = 19;
const robotModel = this.getRobotModel(duid);
if (robotModel == "roborock.vacuum.a97") {
start = 1;
end = 20;
}

for (let i = start; i <= end; i++) {
await this.setObjectAsync(`Devices.${duid}.cleaningInfo.records.${i}`, {
type: "folder",
common: {
Expand Down

0 comments on commit 2fdf4be

Please sign in to comment.