From 46d55c0c2c3fb95102f214029df6e1a1a3726db1 Mon Sep 17 00:00:00 2001 From: A6blpka <46753414+A6blpka@users.noreply.github.com> Date: Sat, 18 Nov 2023 12:43:21 +0300 Subject: [PATCH] Added dock bin support for Roborock S7 (#1926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Update contributing.md * Added dock bin support for Roborock S7 --------- Co-authored-by: Sören Beye --- CONTRIBUTING.md | 30 ++++++++++++++++--- .../roborock/RoborockS7ValetudoRobot.js | 6 +++- .../RoborockConsumableMonitoringCapability.js | 12 ++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 54b20c99b0d..7a44ccbb3fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,13 +17,35 @@ Everything that _isn't_ a low-hanging-fruit on the other hand usually turns out any PRs for such changes, because I know from experience that after merging any such PR, I will be rewriting the whole thing anyway, which not only doesn't save me any time or effort but actually costs me even more. +
+ +Thirdly, Valetudo is not only mature software but specifically mature software that has become **infrastructure**. +As such, the decision process is different from the one in e.g. a new fun side-project to play around with. + +There are thousands of people using it. Not every one of them finds reinstalling nixOS/Gentoo/Arch every 72 hours enjoyable. +Some of them might even have children or elderly to care about. Or they might just also have a life outside of IT. + +Valetudo thus first and foremost needs to be **dependable**. It needs to work, and it needs to specifically work reliably +for those main use cases that the majority will have. If there's an issue that affects 3% of users doing something arcane +which can be fixed by either a large chunk of code or just by not doing that arcane thing, the latter will be the preferred solution. + +Being **infrastructure** means accepting that covering 80% is good enough if that means less code, less potential bugs and less potential vulnerabilities. + +Yes, this makes the project super boring. I know, I know. You bought a new Toy, you got root access on it, and now I'm +telling you that there will be no cool improvements coming from that. Just cloud removal. + +I know where you're coming from. Don't forget that I'm also a Hacker and I also enjoy playing around with technology.
+I just _also_ have different hats to wear. + +Keep on hacking, but.. elsewhere, please. Thank you for understanding. + ### A word on documentation -It's a similar story with documentation efforts. The docs are exactly how they are supposed to be. I know that the project -might not be immediately accessible to _everyone_ without further research but that filtering is a feature and not an oversight. +Documentation is a similar story to what was said above. The docs - for the most part - are how they are supposed to be. +I know that the project might not be immediately accessible to _everyone_ without further research but that filtering is a feature and not an oversight. -I do quite enjoy writing documentation, so I don't help in doing so. In fact, I think it's best if I do it, because I -know quite exactly how the software works.
+I do quite enjoy writing documentation, so I generally don't need help in doing so. In fact, I think it's best if I do it, +because I know quite exactly how the software works.
Playing a game of telephone will already happen further down the information chain. It shouldn't be part of the documentation itself. diff --git a/backend/lib/robots/roborock/RoborockS7ValetudoRobot.js b/backend/lib/robots/roborock/RoborockS7ValetudoRobot.js index 968de401950..e1150f0f05b 100644 --- a/backend/lib/robots/roborock/RoborockS7ValetudoRobot.js +++ b/backend/lib/robots/roborock/RoborockS7ValetudoRobot.js @@ -47,8 +47,12 @@ class RoborockS7ValetudoRobot extends RoborockGen4ValetudoRobot { liftModeId: 1 })); + this.registerCapability(new capabilities.RoborockConsumableMonitoringCapability({ + robot: this, + hasDock: true + })); + [ - capabilities.RoborockConsumableMonitoringCapability, capabilities.RoborockAutoEmptyDockAutoEmptyControlCapability, capabilities.RoborockAutoEmptyDockManualTriggerCapability, capabilities.RoborockKeyLockCapability, diff --git a/backend/lib/robots/roborock/capabilities/RoborockConsumableMonitoringCapability.js b/backend/lib/robots/roborock/capabilities/RoborockConsumableMonitoringCapability.js index aea321b8c3f..3beac8037d4 100644 --- a/backend/lib/robots/roborock/capabilities/RoborockConsumableMonitoringCapability.js +++ b/backend/lib/robots/roborock/capabilities/RoborockConsumableMonitoringCapability.js @@ -11,11 +11,13 @@ class RoborockConsumableMonitoringCapability extends ConsumableMonitoringCapabil * @param {object} options * @param {import("../RoborockValetudoRobot")} options.robot * @param {boolean} [options.hasUltraDock] + * @param {boolean} [options.hasDock] */ constructor(options) { super(options); this.hasUltraDock = options.hasUltraDock; + this.hasDock = options.hasDock || this. options.hasUltraDock; } /** * This function polls the current consumables state and stores the attributes in our robotState @@ -79,6 +81,11 @@ class RoborockConsumableMonitoringCapability extends ConsumableMonitoringCapabil unit: ConsumableStateAttribute.UNITS.PERCENT } }), + ); + } + + if (this.hasDock) { + consumables.push( new ConsumableStateAttribute({ type: ConsumableStateAttribute.TYPE.BIN, subType: ConsumableStateAttribute.SUB_TYPE.DOCK, @@ -162,6 +169,11 @@ class RoborockConsumableMonitoringCapability extends ConsumableMonitoringCapabil unit: ConsumableStateAttribute.UNITS.PERCENT, maxValue: 100 }, + ); + } + + if (this.hasDock) { + availableConsumables.push( { type: ConsumableStateAttribute.TYPE.BIN, subType: ConsumableStateAttribute.SUB_TYPE.DOCK,