mirror of https://github.com/Hypfer/Valetudo.git
35 lines
860 B
JavaScript
35 lines
860 B
JavaScript
const KeyLockCapability = require("../../../core/capabilities/KeyLockCapability");
|
|
|
|
/**
|
|
* @extends KeyLockCapability<import("../RoborockValetudoRobot")>
|
|
*/
|
|
class RoborockKeyLockCapability extends KeyLockCapability {
|
|
|
|
/**
|
|
* This function polls the current key lock state
|
|
*
|
|
* @returns {Promise<boolean>}
|
|
*/
|
|
async isEnabled() {
|
|
const res = await this.robot.sendCommand("get_child_lock_status", [], {});
|
|
|
|
return res["lock_status"] === 1;
|
|
}
|
|
|
|
/**
|
|
* @returns {Promise<void>}
|
|
*/
|
|
async enable() {
|
|
await this.robot.sendCommand("set_child_lock_status", {"lock_status": 1}, {});
|
|
}
|
|
|
|
/**
|
|
* @returns {Promise<void>}
|
|
*/
|
|
async disable() {
|
|
await this.robot.sendCommand("set_child_lock_status", {"lock_status": 0}, {});
|
|
}
|
|
}
|
|
|
|
module.exports = RoborockKeyLockCapability;
|