-
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,234 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const SerializableEntity = require("../SerializableEntity"); | ||
|
||
|
||
// noinspection JSCheckFunctionSignatures | ||
class ValetudoWaterUsagePreset extends SerializableEntity { | ||
/** | ||
* @param {object} options | ||
* @param {string} options.name | ||
* @param {any} options.value | ||
* @param {object} [options.metaData] | ||
* @class | ||
*/ | ||
constructor(options) { | ||
super(options); | ||
|
||
this.name = options.name; | ||
this.value = options.value; | ||
} | ||
} | ||
|
||
module.exports = ValetudoWaterUsagePreset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const StateAttribute = require("./StateAttribute"); | ||
|
||
class WaterUsageStateAttribute extends StateAttribute { | ||
/** | ||
* @param {object} options | ||
* @param {WaterUsageStateAttributeValue} options.value | ||
* @param {number} [options.customValue] | ||
* @param {object} [options.metaData] | ||
*/ | ||
constructor(options) { | ||
super(options); | ||
|
||
this.value = options.value; | ||
|
||
if (options.customValue) { | ||
if (this.value === WaterUsageStateAttribute.VALUE.CUSTOM) { | ||
this.customValue = options.customValue; | ||
} else { | ||
throw new Error("Custom water usage value requires water usage Value CUSTOM"); | ||
} | ||
} else if (this.value === WaterUsageStateAttribute.VALUE.CUSTOM) { | ||
throw new Error("Missing custom value for CUSTOM water usage"); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @typedef {string} WaterUsageStateAttributeValue | ||
* @enum {string} | ||
* | ||
*/ | ||
WaterUsageStateAttribute.VALUE = Object.freeze({ | ||
OFF: "off", | ||
MIN: "min", | ||
LOW: "low", | ||
MEDIUM: "medium", | ||
HIGH: "high", | ||
MAX: "max", | ||
CUSTOM: "custom" | ||
}); | ||
|
||
|
||
|
||
module.exports = WaterUsageStateAttribute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class MiioInvalidStampError extends Error { | ||
constructor() { | ||
super("Invalid MiioSocket stamp"); | ||
this.name = "MiioInvalidStampError"; | ||
} | ||
} | ||
|
||
module.exports = MiioInvalidStampError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const stateAttrs = require("../../entities/state/attributes"); | ||
|
||
// Common Viomi enums | ||
|
||
/** @enum {number} */ | ||
const ViomiOperationMode = Object.freeze({ | ||
VACUUM: 0, | ||
MIXED: 1, | ||
MOP: 2, | ||
}); | ||
|
||
/** @enum {number} */ | ||
const ViomiBoxType = Object.freeze({ | ||
NONE: 0, | ||
VACUUM: 1, | ||
WATER: 2, | ||
VACUUM_AND_WATER: 3 | ||
}); | ||
|
||
/** @enum {number} */ | ||
const ViomiOperation = Object.freeze({ | ||
STOP: 0, | ||
START: 1, | ||
PAUSE: 2 | ||
}); | ||
|
||
/** @enum {number} */ | ||
const ViomiMovementMode = Object.freeze({ | ||
NORMAL_CLEANING: 0, | ||
MOP_MOVES: 1, // back and forth mopping movement (unsure if this has an effect without mop-mode) | ||
OUTLINE: 2, // Only clean the rooms outline. | ||
ZONED_CLEAN_OR_MOPPING: 3, | ||
}); | ||
|
||
const FAN_SPEEDS = Object.freeze({ | ||
[stateAttrs.IntensityStateAttribute.VALUE.LOW]: 0, | ||
[stateAttrs.IntensityStateAttribute.VALUE.MEDIUM]: 1, | ||
[stateAttrs.IntensityStateAttribute.VALUE.HIGH]: 2, | ||
[stateAttrs.IntensityStateAttribute.VALUE.MAX]: 3 | ||
}); | ||
|
||
const WATER_GRADES = Object.freeze({ | ||
[stateAttrs.IntensityStateAttribute.VALUE.LOW]: 11, | ||
[stateAttrs.IntensityStateAttribute.VALUE.MEDIUM]: 12, | ||
[stateAttrs.IntensityStateAttribute.VALUE.HIGH]: 13, | ||
}); | ||
|
||
module.exports = { | ||
ViomiBoxType: ViomiBoxType, | ||
ViomiOperationMode: ViomiOperationMode, | ||
ViomiOperation: ViomiOperation, | ||
ViomiMovementMode: ViomiMovementMode, | ||
FAN_SPEEDS: FAN_SPEEDS, | ||
WATER_GRADES: WATER_GRADES | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const ViomiValetudoRobot = require("./ViomiValetudoRobot"); | ||
const MiioValetudoRobot = require("../MiioValetudoRobot"); | ||
|
||
|
||
class ViomiV7ValetudoRobot extends ViomiValetudoRobot { | ||
/** | ||
* @param {object} options | ||
* @param {import("../../Configuration")} options.config | ||
* @param {object} [options.fanSpeeds] | ||
* @param {object} [options.waterGrades] | ||
*/ | ||
constructor(options) { | ||
super(options); | ||
// TODO: register model-specific capabilities | ||
} | ||
|
||
getModelName() { | ||
return "Xiaomi Mijia STYJ02YM"; | ||
} | ||
|
||
static IMPLEMENTATION_AUTO_DETECTION_HANDLER() { | ||
const deviceConf = MiioValetudoRobot.READ_DEVICE_CONF(ViomiValetudoRobot.DEVICE_CONF_PATH); | ||
return !!(deviceConf && deviceConf.model === "viomi.vacuum.v7"); | ||
} | ||
} | ||
|
||
module.exports = ViomiV7ValetudoRobot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const ViomiValetudoRobot = require("./ViomiValetudoRobot"); | ||
const MiioValetudoRobot = require("../MiioValetudoRobot"); | ||
|
||
|
||
class ViomiV8ValetudoRobot extends ViomiValetudoRobot { | ||
/** | ||
* @param {object} options | ||
* @param {import("../../Configuration")} options.config | ||
* @param {object} [options.fanSpeeds] | ||
* @param {object} [options.waterGrades] | ||
*/ | ||
constructor(options) { | ||
super(options); | ||
// TODO: register model-specific capabilities | ||
} | ||
|
||
getModelName() { | ||
return "Xiaomi Mijia STYTJ02YM"; | ||
} | ||
|
||
static IMPLEMENTATION_AUTO_DETECTION_HANDLER() { | ||
const deviceConf = MiioValetudoRobot.READ_DEVICE_CONF(ViomiValetudoRobot.DEVICE_CONF_PATH); | ||
return !!(deviceConf && deviceConf.model === "viomi.vacuum.v8"); | ||
} | ||
} | ||
|
||
module.exports = ViomiV8ValetudoRobot; |
Oops, something went wrong.