From aba7931b4a464b313bab0a24ca8e2bba8a366637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Beye?= Date: Tue, 7 Feb 2023 18:00:40 +0100 Subject: [PATCH] fix(vendor.dreame): Don't raise the mop attachment reminder for robots that can dry their own mops --- backend/lib/robots/dreame/Dreame1CValetudoRobot.js | 1 - backend/lib/robots/dreame/DreameGen2ValetudoRobot.js | 7 ++++--- backend/lib/robots/dreame/DreameValetudoRobot.js | 3 ++- .../events/MopAttachmentReminderValetudoEvent.js | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/lib/robots/dreame/Dreame1CValetudoRobot.js b/backend/lib/robots/dreame/Dreame1CValetudoRobot.js index 7bdb7f8345..da2b44ecd1 100644 --- a/backend/lib/robots/dreame/Dreame1CValetudoRobot.js +++ b/backend/lib/robots/dreame/Dreame1CValetudoRobot.js @@ -35,7 +35,6 @@ class Dreame1CValetudoRobot extends DreameValetudoRobot { ) ); - this.lastMapPoll = new Date(0); this.isCharging = false; this.registerCapability(new capabilities.Dreame1CBasicControlCapability({ diff --git a/backend/lib/robots/dreame/DreameGen2ValetudoRobot.js b/backend/lib/robots/dreame/DreameGen2ValetudoRobot.js index 9e80fba5ba..68d4163840 100644 --- a/backend/lib/robots/dreame/DreameGen2ValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameGen2ValetudoRobot.js @@ -52,8 +52,6 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot { }; }); - this.lastMapPoll = new Date(0); - this.mode = 0; //Idle this.isCharging = false; this.errorCode = "0"; @@ -641,7 +639,10 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot { } else { if (this.errorCode === "68") { //Docked with mop still attached. For some reason, dreame decided to have this as an error statusValue = stateAttrs.StatusStateAttribute.VALUE.DOCKED; - this.valetudoEventStore.raise(new MopAttachmentReminderValetudoEvent({})); + + if (!this.hasCapability(capabilities.DreameMopDockDryManualTriggerCapability.TYPE)) { + this.valetudoEventStore.raise(new MopAttachmentReminderValetudoEvent({})); + } } else if (this.errorCode === "114") { //Reminder message to regularly clean the mop dock statusValue = stateAttrs.StatusStateAttribute.VALUE.DOCKED; } else { diff --git a/backend/lib/robots/dreame/DreameValetudoRobot.js b/backend/lib/robots/dreame/DreameValetudoRobot.js index 25683ae23e..17522e8718 100644 --- a/backend/lib/robots/dreame/DreameValetudoRobot.js +++ b/backend/lib/robots/dreame/DreameValetudoRobot.js @@ -13,6 +13,7 @@ const entities = require("../../entities"); const MiioDummycloudNotConnectedError = require("../../miio/MiioDummycloudNotConnectedError"); const MiioErrorResponseRobotFirmwareError = require("../../miio/MiioErrorResponseRobotFirmwareError"); const MiioValetudoRobot = require("../MiioValetudoRobot"); +const MopAttachmentReminderValetudoEvent = require("../../valetudo_events/events/MopAttachmentReminderValetudoEvent"); const PendingMapChangeValetudoEvent = require("../../valetudo_events/events/PendingMapChangeValetudoEvent"); const ValetudoMap = require("../../entities/map/ValetudoMap"); const ValetudoRobot = require("../../core/ValetudoRobot"); @@ -221,7 +222,7 @@ class DreameValetudoRobot extends MiioValetudoRobot { attachment.attached === false ) { try { - this.valetudoEventStore.setProcessed("mop_attachment_reminder"); + this.valetudoEventStore.setProcessed(MopAttachmentReminderValetudoEvent.ID); } catch (e) { //intentional } diff --git a/backend/lib/valetudo_events/events/MopAttachmentReminderValetudoEvent.js b/backend/lib/valetudo_events/events/MopAttachmentReminderValetudoEvent.js index 1edad34de4..ad3018f809 100644 --- a/backend/lib/valetudo_events/events/MopAttachmentReminderValetudoEvent.js +++ b/backend/lib/valetudo_events/events/MopAttachmentReminderValetudoEvent.js @@ -8,8 +8,10 @@ class MopAttachmentReminderValetudoEvent extends DismissibleValetudoEvent { * @class */ constructor(options) { - super(Object.assign({}, options, {id: "mop_attachment_reminder"})); + super(Object.assign({}, options, {id: MopAttachmentReminderValetudoEvent.ID})); } } +MopAttachmentReminderValetudoEvent.ID = "mop_attachment_reminder"; + module.exports = MopAttachmentReminderValetudoEvent;