Skip to content

Commit

Permalink
fix(vendor.dreame): Don't raise the mop attachment reminder for robot…
Browse files Browse the repository at this point in the history
…s that can dry their own mops
  • Loading branch information
Hypfer committed Feb 7, 2023
1 parent a00280a commit aba7931
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion backend/lib/robots/dreame/Dreame1CValetudoRobot.js
Expand Up @@ -35,7 +35,6 @@ class Dreame1CValetudoRobot extends DreameValetudoRobot {
)
);

this.lastMapPoll = new Date(0);
this.isCharging = false;

this.registerCapability(new capabilities.Dreame1CBasicControlCapability({
Expand Down
7 changes: 4 additions & 3 deletions backend/lib/robots/dreame/DreameGen2ValetudoRobot.js
Expand Up @@ -52,8 +52,6 @@ class DreameGen2ValetudoRobot extends DreameValetudoRobot {
};
});

this.lastMapPoll = new Date(0);

this.mode = 0; //Idle
this.isCharging = false;
this.errorCode = "0";
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion backend/lib/robots/dreame/DreameValetudoRobot.js
Expand Up @@ -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");
Expand Down Expand Up @@ -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
}
Expand Down
Expand Up @@ -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;

0 comments on commit aba7931

Please sign in to comment.