mirror of
https://github.com/Hypfer/Valetudo.git
synced 2025-10-26 11:27:27 +00:00
fix(vendor.dreame): Fix DreameAutoEmptyDockAutoEmptyIntervalControlCapabilityV1
This commit is contained in:
parent
fb7870e1cd
commit
c0136def9d
@ -15,41 +15,49 @@ class DreameAutoEmptyDockAutoEmptyIntervalControlCapabilityV1 extends AutoEmptyD
|
||||
super(options);
|
||||
|
||||
this.siid = DreameMiotServices["GEN2"].AUTO_EMPTY_DOCK.SIID;
|
||||
this.piid = DreameMiotServices["GEN2"].AUTO_EMPTY_DOCK.PROPERTIES.INTERVAL.PIID;
|
||||
this.auto_empty_piid = DreameMiotServices["GEN2"].AUTO_EMPTY_DOCK.PROPERTIES.AUTO_EMPTY_ENABLED.PIID;
|
||||
this.interval_piid = DreameMiotServices["GEN2"].AUTO_EMPTY_DOCK.PROPERTIES.INTERVAL.PIID;
|
||||
|
||||
this.helper = new DreameMiotHelper({robot: this.robot});
|
||||
}
|
||||
|
||||
async getInterval() {
|
||||
const res = await this.helper.readProperty(this.siid, this.piid);
|
||||
const res = await this.helper.readProperty(this.siid, this.auto_empty_piid);
|
||||
const intervalRes = await this.helper.readProperty(this.siid, this.interval_piid);
|
||||
|
||||
if (res > 1) {
|
||||
return AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.INFREQUENT;
|
||||
} else if (res > 0) {
|
||||
return AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.NORMAL;
|
||||
} else {
|
||||
if (res === 0) {
|
||||
return AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.OFF;
|
||||
}
|
||||
if (intervalRes === 1) {
|
||||
return AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.NORMAL;
|
||||
}
|
||||
|
||||
return AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.INFREQUENT;
|
||||
}
|
||||
|
||||
async setInterval(newInterval) {
|
||||
let val;
|
||||
let autoEmptyValue;
|
||||
let intervalValue;
|
||||
|
||||
switch (newInterval) {
|
||||
case AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.OFF:
|
||||
val = 0;
|
||||
autoEmptyValue = 0;
|
||||
intervalValue = 1;
|
||||
break;
|
||||
case AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.NORMAL:
|
||||
val = 1;
|
||||
autoEmptyValue = 1;
|
||||
intervalValue = 1;
|
||||
break;
|
||||
case AutoEmptyDockAutoEmptyIntervalControlCapability.INTERVAL.INFREQUENT:
|
||||
val = 3;
|
||||
autoEmptyValue = 1;
|
||||
intervalValue = 3;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Received invalid interval ${newInterval}`);
|
||||
}
|
||||
|
||||
await this.helper.writeProperty(this.siid, this.piid, val);
|
||||
await this.helper.writeProperty(this.siid, this.auto_empty_piid, autoEmptyValue);
|
||||
await this.helper.writeProperty(this.siid, this.interval_piid, intervalValue);
|
||||
}
|
||||
|
||||
getProperties() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user