Skip to content

Commit

Permalink
merge dev (#728)
Browse files Browse the repository at this point in the history
* Fix reset of consumables

* Add cleaned_area to S8

* Fix #679

* Revert "Fix #679"

This reverts commit 2934c4c.

* Q5 Pro doesn't support carpet_clean_mode

* Fix `extra_time` in general and for Qrevo Curve

* Add `dss` to Qrevo Curve

* Fix #683

* Update README.md

* Add basic Roborock Qrevo Master support

* Add more features to Qrevo Master

* lol

* Add more features to Qrevo Master

* Refactor login api and renew login every 12 hours

* Fix Qrevo Curv name

* Add and update new map block types

These are not used for now

* Add water box support to S6

* Improve api re-init logic

* Fix calculation for cleaned_area in records

* add unit clean_percent in % (#703)

* Make area and clean_area have 2 decimals

* Increase request timeout from 10s to 30s

* Add extra debugging for testing

* Update README.md

This adapter cannot work on MacOS

* S6 uses string consumables

* Update roborock_mqtt_connector.js

* Update main.js

* Update roborock_mqtt_connector.js

* Update main.js

* Update messageQueueHandler.js

* Update main.js

* Update main.js

* Update main.js

* Revert "Update main.js"

This reverts commit 0fa6ef7.

* Revert "Update main.js"

This reverts commit 86e428f.

* Update main.js

* Add max+ vacuum mode to S8 Pro Ultra

* set info.connection to false on stop of adapter

* Add basic Roborock Qrevo Slim support

* Update main.js

* Disconnect mqtt client before creating a new one

* Maybe fix this stupid mqtt connect bug 🙄

* Fix #727

* Update README.md

---------

Co-authored-by: fL4sH3r <[email protected]>
  • Loading branch information
copystring and fL4sH3r authored Dec 11, 2024
1 parent cbd948a commit 0fcb481
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 335 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ This adapter allows you the control, get states, cleaning history and view the m

**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.

### This adapter cannot work on on MacOS

## The supported robots are:

- Roborock S4
Expand Down Expand Up @@ -55,6 +57,17 @@ 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 cleaned_area to S8
* (copystring) Bugfixes for Qrevo Curve
* (copystring) Fix reset of consumables
* (copystring) Fix io-package.json
* (copystring) Add Roborock Qrevo Master
* (copystring) Refactor login api and renew login every 3 hours
* (fL4sH3r) Fix unit of clean_percent
* (copystring) Add water box support to S6
* (copystring) Many small fixed I can't be bothered to list 😅

### 0.6.17 (2024-10-14)
* (copystring) Add some missing attributes
* (copystring) Change min of update interval to 60s to prevent issues
Expand Down
1 change: 1 addition & 0 deletions admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"clean_type": "Clean Type",
"cleaningInfo_description": "Description of cleaning information.",
"cleaningRecords_description": "Description of the cleaning records.",
"cleaningRecord_extra_time": "Extra cleaning time",
"cleaning_area": "Cleaning Area",
"cleaning_brush_work_times": "How many times the high-speed maintenance brush has been used",
"collision_avoid_status": "Collision Avoid Status",
Expand Down
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"link": "%web_protocol%://%ip%:%webserverPort%/map.html",
"fa-icon": "</i><img style='width:24px;margin-bottom:-6px;' src='/adapter/admin/roborock.png'><i>"
},
"localLink": "%web_protocol%://%ip%:%webserverPort%/map.html",
"localLinks": { "_default": "%web_protocol%://%ip%:%webserverPort%/map.html" },
"dependencies": [
{
"js-controller": ">=5.0.19"
Expand Down
7 changes: 7 additions & 0 deletions lib/RRMapParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ const TYPES = {
IGNORE_DIRTY_RECT: 43, // not currently processed
BRUSH_PT: 44, // not currently processed
DIRTY_NEW: 45, // not currently processed
MOP_ERR_PT: 46, // not currently processed
ERAZER_ZONE: 47, // not currently processed
LONG_CARPET: 48, // not currently processed
DS_SIDES: 49, // not currently processed
STEERING_PT: 50, // not currently processed
SENSOR_INFO: 51, // not currently processed
LOW_SPACES: 52, // not currently processed
DIGEST: 1024,
};
const TYPES_REVERSE = Object.fromEntries(Object.entries(TYPES).map(([key, value]) => [value, key]));
Expand Down
62 changes: 50 additions & 12 deletions lib/deviceFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const actions = {
deviceStates.charge_status = "number";
},
set_clean_percent: async () => {
deviceStates.clean_percent = "number";
deviceStates.clean_percent = { type: "number", unit: "%" };
},
set_common_status: () => {
deviceStates.common_status = "number";
Expand Down Expand Up @@ -273,7 +273,7 @@ const actions = {
deviceStates.repeat = "number";
},
set_cleaned_area: () => {
cleaningRecordsString.cleaned_area = { type: "number", name: "cleaning_record_cleaned_area", unit: "m²", divider: 1000000 };
cleaningRecordsString.cleaned_area = { type: "number", name: "cleaning_record_cleaned_area", unit: "m²" };
},
set_clean_times: () => {
cleaningRecordsString.clean_times = { type: "number", name: "cleaning_record_clean_times" };
Expand All @@ -291,14 +291,18 @@ const actions = {
deviceStates.clean_fluid = "number";
},
set_extra_time: () => {
cleaningRecordsString.extra_time = "number";
cleaningRecordsString.extra_time = { type: "number", name: "cleaningRecord_extra_time" },
deviceStates.extra_time = "number";
},
set_cleaning_info: () => {
deviceStates.cleaning_info = "string";
},
set_exit_dock: () => {
deviceStates.exit_dock = "number";
},
set_custom_mode_max_plus: () => {
commands.set_custom_mode.states[108] = "Max+";
}
};

class deviceFeatures {
Expand Down Expand Up @@ -600,7 +604,8 @@ class deviceFeatures {
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
"roborock.vacuum.a104", // Roborock Qrevo S
"roborock.vacuum.a135" // Qrevo Curve
"roborock.vacuum.a135", // Qrevo Curv
"roborock.vacuum.a117" // Qrevo Master
].includes(robotModel),
// 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 All @@ -624,6 +629,7 @@ class deviceFeatures {
// isWaterBoxSupported: [p.Products.Tanos_CE, p.Products.Tanos_CN].hasElement(p.DMM.currentProduct)
isWaterBoxSupported: [
"roborock.vacuum.s5e", // S5 Max
"roborock.vacuum.s6", // S6
"roborock.vacuum.a08", // S6 Pure
"roborock.vacuum.a10", // S6 MaxV
"roborock.vacuum.a15", // S7
Expand All @@ -641,15 +647,15 @@ class deviceFeatures {
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
"roborock.vacuum.a104", // Roborock Qrevo S
"roborock.vacuum.a135" // Qrevo Curve
"roborock.vacuum.a135", // Qrevo Curv
"roborock.vacuum.a117" // Qrevo Master
].includes(robotModel),
isCustomWaterBoxDistanceSupported: !!(2147483648 & this.features),
isBackChargeAutoWashSupported: this.featuresStr && !!(4096 & parseInt("0x" + this.featuresStr.slice(-8))),
isAvoidCarpetSupported: [
"roborock.vacuum.a10", // S6 MaxV
"roborock.vacuum.a40", // Q7
"roborock.vacuum.s6", // S6
"roborock.vacuum.a72", // Q5 Pro
"roborock.vacuum.a73", // Q8 Max
"roborock.vacuum.a38", // Q7 Max
"roborock.vacuum.a51", // S8
Expand All @@ -663,7 +669,8 @@ class deviceFeatures {
"roborock.vacuum.a101", // Q Revo Pro
"roborock.vacuum.a97", // S8 MaxV (Ultra)
"roborock.vacuum.a104", // Roborock Qrevo S
"roborock.vacuum.a135" // Qrevo Curve
"roborock.vacuum.a135", // Qrevo Curv
"roborock.vacuum.a117" // Qrevo Master
].includes(robotModel),
// 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 @@ -677,7 +684,8 @@ class deviceFeatures {
"roborock.vacuum.a27", // S7 MaxV (Ultra)
"roborock.vacuum.a97", // S8 MaxV (Ultra)
"roborock.vacuum.a87", // Qrevo MaxV
"roborock.vacuum.a135", // Qrevo Curve
"roborock.vacuum.a135", // Qrevo Curv
"roborock.vacuum.a117" // Qrevo Master
].includes(robotModel),
};
}
Expand Down Expand Up @@ -722,6 +730,7 @@ class deviceFeatures {
"set_charge_status",
"set_clean_percent",
"set_switch_status",
"set_cleaned_area"
],
// S7 Pro Ultra
"roborock.vacuum.a62": ["setCleaningRecordsString", "setConsumablesInt", "set_dss", "set_rss", "set_map_flag", "set_charge_status", "set_clean_percent"],
Expand Down Expand Up @@ -751,8 +760,8 @@ class deviceFeatures {
"set_back_type",
"set_charge_status",
"set_switch_status",

"set_clean_percent",
"set_custom_mode_max_plus",
],
// Q5 Pro
"roborock.vacuum.a72": [
Expand Down Expand Up @@ -782,6 +791,7 @@ class deviceFeatures {
"set_map_flag",
"set_charge_status",
"set_clean_percent",
"set_switch_status",
],
// Q Revo
"roborock.vacuum.a75": [
Expand All @@ -806,7 +816,7 @@ class deviceFeatures {
// S5 Max
"roborock.vacuum.s5e": ["setCleaningRecordsMixed", "setConsumablesInt"],
// S6
"roborock.vacuum.s6": ["setCleaningRecordsMixed", "setConsumablesInt"],
"roborock.vacuum.s6": ["setCleaningRecordsMixed", "setConsumablesString"],
// Qrevo MaxV
"roborock.vacuum.a87": [
"setCleaningRecordsString",
Expand Down Expand Up @@ -877,7 +887,7 @@ class deviceFeatures {
"set_cleaned_area",

],
// Roborock Qrevo Curve
// Roborock Qrevo Curv
"roborock.vacuum.a135": [
"setCleaningRecordsString",
"setConsumablesInt",
Expand All @@ -896,8 +906,36 @@ class deviceFeatures {
"set_map_flag",
"set_cleaned_area",
"set_task_id",
"set_extra_time",
"set_dss",
],
// Roborock Qrevo Master
"roborock.vacuum.a117": [
"setCleaningRecordsString",
"setConsumablesInt",
"set_last_clean_t",
"set_switch_status",
"set_kct",
"set_common_status",
"set_dss",
"set_rss",
"set_clean_percent",
"set_charge_status",
"set_in_warmup",
"set_monitor_status",
"set_task_id",
"set_cleaned_area",
"set_map_flag",
],
// Roborock Qrevo Slim
"roborock.vacuum.a21": [
"setCleaningRecordsString",
"setConsumablesInt",
"set_map_flag",
"set_cleaned_area",
"set_replenish_mode",
"set_clean_times",
"set_task_id",
]
};

// process modelConfig
Expand Down
6 changes: 3 additions & 3 deletions lib/messageQueueHandler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const requestTimeout = 10000; // 10s
const requestTimeout = 30000; // 10s

class messageQueueHandler {
constructor(adapter) {
Expand Down Expand Up @@ -49,9 +49,9 @@ class messageQueueHandler {
this.adapter.pendingRequests.delete(messageID);
this.adapter.localConnector.clearChunkBuffer(duid);
if (remoteConnection) {
reject(new Error(`Cloud request with id ${messageID} with method ${method} timed out after 10 seconds. MQTT connection state: ${mqttConnectionState}`));
reject(new Error(`Cloud request with id ${messageID} with method ${method} timed out after 30 seconds. MQTT connection state: ${mqttConnectionState}`));
} else {
reject(new Error(`Local request with id ${messageID} with method ${method} timed out after 10 seconds Local connect state: ${localConnectionState}`));
reject(new Error(`Local request with id ${messageID} with method ${method} timed out after 30 seconds Local connect state: ${localConnectionState}`));
}
}, requestTimeout);

Expand Down
Loading

0 comments on commit 0fcb481

Please sign in to comment.