-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathdeletePassageMode.js
37 lines (31 loc) · 949 Bytes
/
deletePassageMode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const { TTLockClient, sleep, PassageModeType } = require('../dist');
const settingsFile = "lockData.json";
async function doStuff() {
let lockData = await require("./common/loadData")(settingsFile);
let options = require("./common/options")(lockData);
const client = new TTLockClient(options);
await client.prepareBTService();
client.startScanLock();
console.log("Scan started");
client.on("foundLock", async (lock) => {
console.log(lock.toJSON());
console.log();
if (lock.isInitialized() && lock.isPaired()) {
await lock.connect();
console.log("Trying to set passage mode");
console.log();
console.log();
const result = await lock.deletePassageMode({
type: PassageModeType.WEEKLY,
weekOrDay: 5,
month: 0,
startHour: "0000",
endHour: "2359"
});
await lock.disconnect();
process.exit(0);
}
});
}
doStuff();