homebridge-ttlock-accesscode 2.4.0-beta.0 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -37
- package/config.schema.json +13 -113
- package/dist/api/ttlockApi.d.ts +66 -12
- package/dist/api/ttlockApi.js +581 -121
- package/dist/api/ttlockApi.js.map +1 -1
- package/dist/api/usageTracker.d.ts +23 -9
- package/dist/api/usageTracker.js +340 -134
- package/dist/api/usageTracker.js.map +1 -1
- package/dist/config.d.ts +1 -33
- package/dist/config.js +28 -132
- package/dist/config.js.map +1 -1
- package/dist/devices/baseDevice.d.ts +26 -12
- package/dist/devices/baseDevice.js +326 -107
- package/dist/devices/baseDevice.js.map +1 -1
- package/dist/devices/descriptorHelpers.js +9 -4
- package/dist/devices/descriptorHelpers.js.map +1 -1
- package/dist/devices/deviceManager.d.ts +8 -14
- package/dist/devices/deviceManager.js +49 -149
- package/dist/devices/deviceManager.js.map +1 -1
- package/dist/devices/deviceTypes.d.ts +12 -1
- package/dist/devices/homekitLock.d.ts +9 -1
- package/dist/devices/homekitLock.js +327 -66
- package/dist/devices/homekitLock.js.map +1 -1
- package/dist/platform.d.ts +39 -14
- package/dist/platform.js +436 -69
- package/dist/platform.js.map +1 -1
- package/dist/taskQueue.d.ts +1 -1
- package/dist/taskQueue.js +7 -5
- package/dist/taskQueue.js.map +1 -1
- package/dist/utils.d.ts +5 -2
- package/dist/utils.js +44 -16
- package/dist/utils.js.map +1 -1
- package/homebridge-ui/public/app.js +54 -966
- package/homebridge-ui/public/styles.css +4 -148
- package/homebridge-ui/server.js +26 -45
- package/package.json +11 -15
- package/dist/api/dirigeraApi.d.ts +0 -34
- package/dist/api/dirigeraApi.js +0 -127
- package/dist/api/dirigeraApi.js.map +0 -1
- package/dist/devices/homekitDoor.d.ts +0 -50
- package/dist/devices/homekitDoor.js +0 -268
- package/dist/devices/homekitDoor.js.map +0 -1
package/dist/api/usageTracker.js
CHANGED
|
@@ -2,6 +2,38 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { SimpleMutex } from '../utils.js';
|
|
5
|
+
// The user reserve: the larger of these
|
|
6
|
+
const USER_RESERVE_MIN_CALLS = 50;
|
|
7
|
+
const USER_RESERVE_FRACTION = 0.01;
|
|
8
|
+
const USAGE_FILE_READ_ATTEMPTS = 2;
|
|
9
|
+
const USAGE_FILE_READ_RETRY_DELAY_MS = 1000;
|
|
10
|
+
// What a usage file must hold to be used; totalAllowed always comes from the config
|
|
11
|
+
function isStoredUsage(value) {
|
|
12
|
+
if (typeof value !== 'object' || value === null) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const { year, month, used } = value;
|
|
16
|
+
return Number.isInteger(year) && Number.isInteger(month) && month >= 1 && month <= 12 &&
|
|
17
|
+
typeof used === 'number' && Number.isFinite(used) && used >= 0;
|
|
18
|
+
}
|
|
19
|
+
function daysInMonthOf(date) {
|
|
20
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
21
|
+
}
|
|
22
|
+
function errorText(error) {
|
|
23
|
+
return error instanceof Error ? error.message : String(error);
|
|
24
|
+
}
|
|
25
|
+
// EPERM or EACCES on writing, moving or replacing the usage file most often means that it or its folder belongs to
|
|
26
|
+
// another user (Homebridge once run as root, for example), though an immutable file or some mounts refuse it too
|
|
27
|
+
function ownershipHint(error) {
|
|
28
|
+
const code = error?.code;
|
|
29
|
+
return code === 'EPERM' || code === 'EACCES'
|
|
30
|
+
? '. The usage file or its folder may belong to another user; if so, that must be fixed for API usage to be saved'
|
|
31
|
+
: '';
|
|
32
|
+
}
|
|
33
|
+
function withOwnershipHint(error) {
|
|
34
|
+
const hint = ownershipHint(error);
|
|
35
|
+
return hint ? new Error(`${errorText(error)}${hint}`, { cause: error }) : error;
|
|
36
|
+
}
|
|
5
37
|
export class UsageTracker extends EventEmitter {
|
|
6
38
|
totalAllowed;
|
|
7
39
|
storageFilePath;
|
|
@@ -12,6 +44,13 @@ export class UsageTracker extends EventEmitter {
|
|
|
12
44
|
rolloverInterval;
|
|
13
45
|
currentTier = 0;
|
|
14
46
|
pendingReserved = 0;
|
|
47
|
+
// Every call saves the usage, so a failing save is logged once until it works again
|
|
48
|
+
persistFailing = false;
|
|
49
|
+
// The usage file could not be read, or did not hold valid usage. It stays where it is until a save has been written,
|
|
50
|
+
// and is then moved aside.
|
|
51
|
+
unusableFile;
|
|
52
|
+
// Background work stopping for the user reserve is logged once a month
|
|
53
|
+
backgroundPaused = false;
|
|
15
54
|
constructor(api, log, totalAllowed) {
|
|
16
55
|
super();
|
|
17
56
|
this.totalAllowed = totalAllowed;
|
|
@@ -21,56 +60,139 @@ export class UsageTracker extends EventEmitter {
|
|
|
21
60
|
async init() {
|
|
22
61
|
const base = this.api.user.storagePath();
|
|
23
62
|
const dir = path.join(base, 'ttlock-accesscode');
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
63
|
+
const storageFilePath = path.join(dir, 'ttlock-accesscode-usage.json');
|
|
64
|
+
this.log.debug(`UsageTracker storage path: ${storageFilePath}`);
|
|
65
|
+
try {
|
|
66
|
+
await fs.mkdir(dir, { recursive: true });
|
|
67
|
+
this.storageFilePath = storageFilePath;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
// Usage is then counted in memory only, starting from an estimate
|
|
71
|
+
this.log.error(`Could not create the folder for the API usage file ${dir}: ${errorText(err)}`);
|
|
72
|
+
}
|
|
27
73
|
await this.loadOrInit();
|
|
28
74
|
this.scheduleRolloverCheck();
|
|
29
75
|
}
|
|
76
|
+
// A usage file that cannot be read or does not hold valid usage must neither turn the budget off nor start the
|
|
77
|
+
// month again at 0: usage then starts from the last save left in .tmp (see useSaveLeftInTemp), or else from what an
|
|
78
|
+
// evenly used month would have used by today.
|
|
30
79
|
async loadOrInit() {
|
|
80
|
+
const now = new Date();
|
|
81
|
+
let stored = this.storageFilePath ? await this.readStoredUsage(this.storageFilePath) : undefined;
|
|
82
|
+
if (this.storageFilePath) {
|
|
83
|
+
stored = await this.useSaveLeftInTemp(this.storageFilePath, stored, now);
|
|
84
|
+
}
|
|
85
|
+
if (stored === null) {
|
|
86
|
+
this.log.debug('Usage file not found, initializing new usage state');
|
|
87
|
+
this.state = this.newMonthState(now, 0);
|
|
88
|
+
}
|
|
89
|
+
else if (stored === undefined) {
|
|
90
|
+
const used = Math.ceil(this.totalAllowed * (now.getDate() - 1) / daysInMonthOf(now));
|
|
91
|
+
this.log.warn(`Counting API usage from an estimate of ${used} of ${this.totalAllowed} calls used so far this month`);
|
|
92
|
+
this.state = this.newMonthState(now, used);
|
|
93
|
+
}
|
|
94
|
+
else if (this.isNewMonth(stored, now)) {
|
|
95
|
+
this.log.debug('Usage file month mismatch, resetting usage for new month');
|
|
96
|
+
this.state = this.newMonthState(now, 0);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.state = this.newMonthState(now, stored.used);
|
|
100
|
+
}
|
|
101
|
+
await this.persist();
|
|
102
|
+
// Starting from 0 instead would report a tier change at the first call after every restart
|
|
103
|
+
this.currentTier = this.computeTier();
|
|
104
|
+
}
|
|
105
|
+
// The stored usage; null when there is no usage file yet, undefined when it cannot be read or does not hold valid
|
|
106
|
+
// usage. Such a file may still hold this month's count, so it stays where it is: only once a save has been written
|
|
107
|
+
// is it moved aside and the save put in its place. If saves fail too (EMFILE, EIO), the next start reads it again.
|
|
108
|
+
async readStoredUsage(filePath) {
|
|
109
|
+
let data;
|
|
31
110
|
try {
|
|
32
|
-
|
|
33
|
-
const parsed = JSON.parse(data);
|
|
34
|
-
const now = new Date();
|
|
35
|
-
if (parsed.year !== now.getFullYear() || parsed.month !== now.getMonth() + 1) {
|
|
36
|
-
this.log.debug('Usage file month mismatch, resetting usage for new month');
|
|
37
|
-
this.state = {
|
|
38
|
-
year: now.getFullYear(),
|
|
39
|
-
month: now.getMonth() + 1,
|
|
40
|
-
totalAllowed: this.totalAllowed,
|
|
41
|
-
used: 0,
|
|
42
|
-
lastUpdatedISO: now.toISOString(),
|
|
43
|
-
};
|
|
44
|
-
await this.persist();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
if (parsed.totalAllowed !== this.totalAllowed) {
|
|
48
|
-
this.log.debug('Updating stored totalAllowed to current config value');
|
|
49
|
-
parsed.totalAllowed = this.totalAllowed;
|
|
50
|
-
}
|
|
51
|
-
parsed.lastUpdatedISO = new Date().toISOString();
|
|
52
|
-
this.state = parsed;
|
|
53
|
-
await this.persist();
|
|
54
|
-
}
|
|
111
|
+
data = await this.readUsageFile(filePath);
|
|
55
112
|
}
|
|
56
113
|
catch (err) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
114
|
+
this.unusableFile = 'unreadable';
|
|
115
|
+
this.log.error(`Could not read the API usage file ${filePath}: ${errorText(err)}; it is left in place until API usage can be ` +
|
|
116
|
+
'saved, and then moved aside');
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
if (data === null) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
let parsed;
|
|
123
|
+
try {
|
|
124
|
+
parsed = JSON.parse(data);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
parsed = undefined;
|
|
128
|
+
}
|
|
129
|
+
if (isStoredUsage(parsed)) {
|
|
130
|
+
return parsed;
|
|
131
|
+
}
|
|
132
|
+
this.unusableFile = 'corrupt';
|
|
133
|
+
this.log.error(`The API usage file ${filePath} does not hold valid usage; it is left in place until API usage can be saved, and ` +
|
|
134
|
+
'then moved aside');
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
// A save is written to .tmp in full before it is renamed into place, so a .tmp that is still there holds a whole save
|
|
138
|
+
// that did not get into place: Homebridge stopped between moving an unusable usage file aside and the rename, or the
|
|
139
|
+
// rename failed. It is used when it holds this month's usage and the usage file is missing, cannot be read, does not
|
|
140
|
+
// hold valid usage, or counts fewer calls this month.
|
|
141
|
+
async useSaveLeftInTemp(filePath, stored, now) {
|
|
142
|
+
const tempPath = `${filePath}.tmp`;
|
|
143
|
+
let saved;
|
|
144
|
+
try {
|
|
145
|
+
saved = JSON.parse(await fs.readFile(tempPath, 'utf8'));
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
if (err?.code !== 'ENOENT') {
|
|
149
|
+
this.log.debug(`Not using the API usage saved in ${tempPath}: ${errorText(err)}`);
|
|
70
150
|
}
|
|
71
|
-
|
|
72
|
-
throw err;
|
|
151
|
+
return stored;
|
|
73
152
|
}
|
|
153
|
+
if (!isStoredUsage(saved) || this.isNewMonth(saved, now)) {
|
|
154
|
+
this.log.debug(`Not using the API usage saved in ${tempPath}: it does not hold valid usage for this month`);
|
|
155
|
+
return stored;
|
|
156
|
+
}
|
|
157
|
+
if (stored && !this.isNewMonth(stored, now) && stored.used >= saved.used) {
|
|
158
|
+
return stored;
|
|
159
|
+
}
|
|
160
|
+
const usageFile = stored === null ? 'was not found' :
|
|
161
|
+
stored === undefined ? 'could not be used' : 'counts fewer calls this month';
|
|
162
|
+
this.log.warn(`The API usage file ${filePath} ${usageFile}; counting API usage from the last save, left in ${tempPath}: ` +
|
|
163
|
+
`${saved.used} of ${this.totalAllowed} calls used so far this month`);
|
|
164
|
+
return saved;
|
|
165
|
+
}
|
|
166
|
+
// The file's content, or null when there is none. A file that is there but could not be read this time (EIO,
|
|
167
|
+
// EMFILE) is read once more before giving up on it.
|
|
168
|
+
async readUsageFile(filePath) {
|
|
169
|
+
for (let attempt = 1;; attempt++) {
|
|
170
|
+
try {
|
|
171
|
+
return await fs.readFile(filePath, 'utf8');
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
if (err?.code === 'ENOENT') {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (attempt >= USAGE_FILE_READ_ATTEMPTS) {
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
this.log.debug(`Could not read the API usage file ${filePath}, trying again: ${errorText(err)}`);
|
|
181
|
+
await new Promise(resolve => setTimeout(resolve, USAGE_FILE_READ_RETRY_DELAY_MS));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
newMonthState(now, used) {
|
|
186
|
+
return {
|
|
187
|
+
year: now.getFullYear(),
|
|
188
|
+
month: now.getMonth() + 1,
|
|
189
|
+
totalAllowed: this.totalAllowed,
|
|
190
|
+
used,
|
|
191
|
+
lastUpdatedISO: now.toISOString(),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
isNewMonth(usage, now) {
|
|
195
|
+
return usage.year !== now.getFullYear() || usage.month !== now.getMonth() + 1;
|
|
74
196
|
}
|
|
75
197
|
async persist() {
|
|
76
198
|
if (!this.storageFilePath || !this.state) {
|
|
@@ -78,77 +200,118 @@ export class UsageTracker extends EventEmitter {
|
|
|
78
200
|
}
|
|
79
201
|
const tempPath = `${this.storageFilePath}.tmp`;
|
|
80
202
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
203
|
+
try {
|
|
204
|
+
await fs.writeFile(tempPath, JSON.stringify(this.state), 'utf8');
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
throw withOwnershipHint(err);
|
|
208
|
+
}
|
|
209
|
+
const asidePath = await this.moveUnusableFileAside(this.storageFilePath);
|
|
210
|
+
try {
|
|
211
|
+
await fs.rename(tempPath, this.storageFilePath);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
if (asidePath) {
|
|
215
|
+
await this.moveAsideFileBack(asidePath, this.storageFilePath);
|
|
216
|
+
}
|
|
217
|
+
throw withOwnershipHint(err);
|
|
218
|
+
}
|
|
219
|
+
if (asidePath) {
|
|
220
|
+
const what = this.unusableFile === 'unreadable' ? 'could not be read' : 'did not hold valid usage';
|
|
221
|
+
this.unusableFile = undefined;
|
|
222
|
+
this.log.info(`Moved the API usage file that ${what} to ${asidePath}`);
|
|
223
|
+
}
|
|
224
|
+
if (this.persistFailing) {
|
|
225
|
+
this.persistFailing = false;
|
|
226
|
+
this.log.info('Saving API usage data works again');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
if (this.persistFailing) {
|
|
231
|
+
this.log.debug(`Failed to persist usage data: ${errorText(err)}`);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.persistFailing = true;
|
|
235
|
+
this.log.error(`Failed to persist usage data; it is still counted while Homebridge runs: ${errorText(err)}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Called once the save that replaces the file has been written, so a save that cannot be written leaves the file in
|
|
240
|
+
// place. When the file cannot be moved, the save is not put in its place either. Returns where the file was moved.
|
|
241
|
+
async moveUnusableFileAside(filePath) {
|
|
242
|
+
const kind = this.unusableFile;
|
|
243
|
+
if (!kind) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
const asidePath = `${filePath}.${kind}-${Date.now()}`;
|
|
247
|
+
try {
|
|
248
|
+
await fs.rename(filePath, asidePath);
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
if (err?.code !== 'ENOENT') {
|
|
252
|
+
throw new Error(`could not move the API usage file aside to ${asidePath}: ${errorText(err)}${ownershipHint(err)}`, { cause: err });
|
|
253
|
+
}
|
|
254
|
+
// It is gone already
|
|
255
|
+
this.unusableFile = undefined;
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
return asidePath;
|
|
259
|
+
}
|
|
260
|
+
// The save could not be put in place after the unusable file was moved aside. Put the file back, so the usage path
|
|
261
|
+
// is not left empty and the next save moves it aside again. If it stays aside, the next start reads the save left in
|
|
262
|
+
// .tmp, and the next save goes straight into place.
|
|
263
|
+
async moveAsideFileBack(asidePath, filePath) {
|
|
264
|
+
try {
|
|
265
|
+
await fs.rename(asidePath, filePath);
|
|
83
266
|
}
|
|
84
267
|
catch (err) {
|
|
85
|
-
this.
|
|
268
|
+
this.unusableFile = undefined;
|
|
269
|
+
this.log.error(`The API usage file was moved to ${asidePath} and could not be moved back after the save failed: ` +
|
|
270
|
+
errorText(err));
|
|
86
271
|
}
|
|
87
272
|
}
|
|
88
273
|
getUsage() {
|
|
89
274
|
if (!this.state) {
|
|
90
275
|
throw new Error('UsageTracker not initialized');
|
|
91
276
|
}
|
|
92
|
-
const remaining = Math.max(0, this.state.totalAllowed - this.state.used);
|
|
93
277
|
const now = new Date();
|
|
94
|
-
|
|
278
|
+
// Until the first call of a new month starts its budget, report that budget rather than last month's
|
|
279
|
+
const newMonth = this.isNewMonth(this.state, now);
|
|
280
|
+
const used = newMonth ? 0 : this.state.used;
|
|
281
|
+
const totalAllowed = newMonth ? this.totalAllowed : this.state.totalAllowed;
|
|
282
|
+
const remaining = Math.max(0, totalAllowed - used);
|
|
283
|
+
const daysInMonth = daysInMonthOf(now);
|
|
95
284
|
const currentDay = now.getDate();
|
|
96
285
|
const daysRemaining = Math.max(1, daysInMonth - (currentDay - 1));
|
|
97
|
-
const
|
|
286
|
+
const userReserve = this.userReserve;
|
|
287
|
+
// What polls and discovery may use per day: they stop at the user reserve
|
|
288
|
+
const remainingDailyAllowance = daysRemaining > 0 ? Math.floor(Math.max(0, remaining - userReserve) / daysRemaining) : 0;
|
|
98
289
|
return {
|
|
99
|
-
used
|
|
100
|
-
totalAllowed
|
|
290
|
+
used,
|
|
291
|
+
totalAllowed,
|
|
101
292
|
daysInMonth,
|
|
102
293
|
remaining,
|
|
103
294
|
daysRemaining,
|
|
104
295
|
remainingDailyAllowance,
|
|
296
|
+
userReserve,
|
|
105
297
|
lastUpdatedISO: this.state.lastUpdatedISO,
|
|
106
298
|
};
|
|
107
299
|
}
|
|
108
|
-
async
|
|
300
|
+
async tryReserve(n = 1, reason, priority = 'background') {
|
|
109
301
|
if (!this.state) {
|
|
110
302
|
throw new Error('UsageTracker not initialized');
|
|
111
303
|
}
|
|
112
304
|
const release = await this.mutex.acquire();
|
|
113
305
|
try {
|
|
114
|
-
this.
|
|
115
|
-
|
|
116
|
-
await this.persist();
|
|
117
|
-
if (reason) {
|
|
118
|
-
this.log.debug(`Usage incremented by ${n} (${reason}). New used=${this.state.used}`);
|
|
119
|
-
}
|
|
120
|
-
const newTier = this.computeTier();
|
|
121
|
-
if (newTier !== this.currentTier) {
|
|
122
|
-
const old = this.currentTier;
|
|
123
|
-
this.currentTier = newTier;
|
|
124
|
-
this.emit('tierChanged', { old, new: newTier, usage: this.getUsage() });
|
|
125
|
-
this.log.info(`Usage tier changed: ${old} -> ${newTier}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
finally {
|
|
129
|
-
release();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async tryReserve(n = 1, reason) {
|
|
133
|
-
if (!this.state) {
|
|
134
|
-
throw new Error('UsageTracker not initialized');
|
|
135
|
-
}
|
|
136
|
-
const release = await this.mutex.acquire();
|
|
137
|
-
try {
|
|
138
|
-
const remaining = this.state.totalAllowed - this.state.used;
|
|
139
|
-
if (remaining >= n) {
|
|
306
|
+
await this.rolloverIfNeededLocked();
|
|
307
|
+
if (this.fitsLocked(n, priority)) {
|
|
140
308
|
this.state.used += n;
|
|
141
309
|
this.state.lastUpdatedISO = new Date().toISOString();
|
|
142
310
|
await this.persist();
|
|
143
311
|
if (reason) {
|
|
144
312
|
this.log.debug(`Reserved ${n} calls (${reason}). New used=${this.state.used}`);
|
|
145
313
|
}
|
|
146
|
-
|
|
147
|
-
if (newTier !== this.currentTier) {
|
|
148
|
-
const old = this.currentTier;
|
|
149
|
-
this.currentTier = newTier;
|
|
150
|
-
this.emit('tierChanged', { old, new: newTier, usage: this.getUsage() });
|
|
151
|
-
}
|
|
314
|
+
this.updateTier();
|
|
152
315
|
return true;
|
|
153
316
|
}
|
|
154
317
|
this.log.debug('Not enough calls remaining, returning false');
|
|
@@ -158,14 +321,14 @@ export class UsageTracker extends EventEmitter {
|
|
|
158
321
|
release();
|
|
159
322
|
}
|
|
160
323
|
}
|
|
161
|
-
async beginBatch(n = 1, reason) {
|
|
324
|
+
async beginBatch(n = 1, reason, priority = 'background') {
|
|
162
325
|
if (!this.state) {
|
|
163
326
|
throw new Error('UsageTracker not initialized');
|
|
164
327
|
}
|
|
165
328
|
const release = await this.mutex.acquire();
|
|
166
329
|
try {
|
|
167
|
-
|
|
168
|
-
if (
|
|
330
|
+
await this.rolloverIfNeededLocked();
|
|
331
|
+
if (this.fitsLocked(n, priority)) {
|
|
169
332
|
this.state.used += n;
|
|
170
333
|
this.pendingReserved += n;
|
|
171
334
|
this.state.lastUpdatedISO = new Date().toISOString();
|
|
@@ -173,13 +336,7 @@ export class UsageTracker extends EventEmitter {
|
|
|
173
336
|
if (reason) {
|
|
174
337
|
this.log.debug(`Reserve ${n} calls (${reason}). New used=${this.state.used}`);
|
|
175
338
|
}
|
|
176
|
-
|
|
177
|
-
if (newTier !== this.currentTier) {
|
|
178
|
-
const old = this.currentTier;
|
|
179
|
-
this.currentTier = newTier;
|
|
180
|
-
this.emit('tierChanged', { old, new: newTier, usage: this.getUsage() });
|
|
181
|
-
this.log.info(`Usage tier changed: ${old} -> ${newTier}`);
|
|
182
|
-
}
|
|
339
|
+
this.updateTier();
|
|
183
340
|
return true;
|
|
184
341
|
}
|
|
185
342
|
return false;
|
|
@@ -191,6 +348,8 @@ export class UsageTracker extends EventEmitter {
|
|
|
191
348
|
async consumePendingReservation(n = 1) {
|
|
192
349
|
const release = await this.mutex.acquire();
|
|
193
350
|
try {
|
|
351
|
+
// A new month drops last month's reservations, so this call is counted in the new month
|
|
352
|
+
await this.rolloverIfNeededLocked();
|
|
194
353
|
if (this.pendingReserved >= n) {
|
|
195
354
|
this.pendingReserved -= n;
|
|
196
355
|
return true;
|
|
@@ -201,6 +360,84 @@ export class UsageTracker extends EventEmitter {
|
|
|
201
360
|
release();
|
|
202
361
|
}
|
|
203
362
|
}
|
|
363
|
+
// At the end of a discovery: the calls it reserved but did not make (it failed or found fewer locks) are no longer
|
|
364
|
+
// counted. Left in the pool, polls would make them without the reserve check. A reserved call is taken from the pool
|
|
365
|
+
// only right before it is sent, so these were never attempted.
|
|
366
|
+
async endBatch() {
|
|
367
|
+
const release = await this.mutex.acquire();
|
|
368
|
+
try {
|
|
369
|
+
await this.rolloverIfNeededLocked();
|
|
370
|
+
if (this.releasePendingLocked()) {
|
|
371
|
+
await this.persist();
|
|
372
|
+
this.updateTier();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
finally {
|
|
376
|
+
release();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
releasePendingLocked() {
|
|
380
|
+
if (!this.state || this.pendingReserved === 0) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
const unused = this.pendingReserved;
|
|
384
|
+
this.state.used = Math.max(0, this.state.used - unused);
|
|
385
|
+
this.pendingReserved = 0;
|
|
386
|
+
this.state.lastUpdatedISO = new Date().toISOString();
|
|
387
|
+
this.log.debug(`Released ${unused} reserved calls that were not made. New used=${this.state.used}`);
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
// Polls and discovery stop short of the user reserve, so HomeKit can still lock, unlock and change access codes once
|
|
391
|
+
// they have used up the rest of the month's calls
|
|
392
|
+
fitsLocked(n, priority) {
|
|
393
|
+
if (!this.state) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
const remaining = this.state.totalAllowed - this.state.used;
|
|
397
|
+
if (priority === 'user') {
|
|
398
|
+
return remaining >= n;
|
|
399
|
+
}
|
|
400
|
+
if (remaining - n >= this.userReserve) {
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
// A discovery that does not fit while polls still do is not the pause; the platform logs the skipped discovery
|
|
404
|
+
if (remaining - 1 >= this.userReserve) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
if (!this.backgroundPaused) {
|
|
408
|
+
this.backgroundPaused = true;
|
|
409
|
+
this.log.warn(`Only ${Math.max(0, remaining)} of ${this.state.totalAllowed} API calls are left this month. Polling and discovery ` +
|
|
410
|
+
'pause until the month ends, so that the rest stay available for locking, unlocking and access codes.');
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
get userReserve() {
|
|
415
|
+
return Math.max(USER_RESERVE_MIN_CALLS, Math.ceil(this.totalAllowed * USER_RESERVE_FRACTION));
|
|
416
|
+
}
|
|
417
|
+
// The month's budget starts at its first call, not at the next hourly check: until then, calls would count against
|
|
418
|
+
// (and be refused by) last month's budget. Discovery reservations left from last month go with it.
|
|
419
|
+
async rolloverIfNeededLocked(now = new Date()) {
|
|
420
|
+
if (!this.state || !this.isNewMonth(this.state, now)) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
this.state = this.newMonthState(now, 0);
|
|
424
|
+
this.pendingReserved = 0;
|
|
425
|
+
this.backgroundPaused = false;
|
|
426
|
+
await this.persist();
|
|
427
|
+
this.currentTier = this.computeTier();
|
|
428
|
+
this.log.info(`New month: API usage starts again at 0 of ${this.state.totalAllowed} calls`);
|
|
429
|
+
// Polling is paced from the budget left, so the platform recalculates it
|
|
430
|
+
this.emit('monthStarted', { usage: this.getUsage() });
|
|
431
|
+
}
|
|
432
|
+
updateTier() {
|
|
433
|
+
const newTier = this.computeTier();
|
|
434
|
+
if (newTier !== this.currentTier) {
|
|
435
|
+
const old = this.currentTier;
|
|
436
|
+
this.currentTier = newTier;
|
|
437
|
+
this.log.debug(`Usage tier changed: ${old} -> ${newTier}`);
|
|
438
|
+
this.emit('tierChanged', { old, new: newTier, usage: this.getUsage() });
|
|
439
|
+
}
|
|
440
|
+
}
|
|
204
441
|
computeTier() {
|
|
205
442
|
if (!this.state) {
|
|
206
443
|
return 0;
|
|
@@ -221,66 +458,35 @@ export class UsageTracker extends EventEmitter {
|
|
|
221
458
|
}
|
|
222
459
|
return 0;
|
|
223
460
|
}
|
|
224
|
-
|
|
225
|
-
if (!this.state) {
|
|
226
|
-
throw new Error('UsageTracker not initialized');
|
|
227
|
-
}
|
|
228
|
-
const remaining = this.state.totalAllowed - this.state.used;
|
|
229
|
-
return remaining >= n;
|
|
230
|
-
}
|
|
231
|
-
async resetForNewMonth() {
|
|
232
|
-
if (!this.state) {
|
|
233
|
-
throw new Error('UsageTracker not initialized');
|
|
234
|
-
}
|
|
235
|
-
const release = await this.mutex.acquire();
|
|
236
|
-
try {
|
|
237
|
-
const now = new Date();
|
|
238
|
-
this.state.year = now.getFullYear();
|
|
239
|
-
this.state.month = now.getMonth() + 1;
|
|
240
|
-
this.state.used = 0;
|
|
241
|
-
this.state.totalAllowed = this.totalAllowed;
|
|
242
|
-
this.state.lastUpdatedISO = now.toISOString();
|
|
243
|
-
await this.persist();
|
|
244
|
-
this.log.info('UsageTracker: month reset performed');
|
|
245
|
-
}
|
|
246
|
-
finally {
|
|
247
|
-
release();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
461
|
+
// A backstop for a month without calls; the month also starts at its first call
|
|
250
462
|
scheduleRolloverCheck() {
|
|
251
463
|
this.rolloverInterval = setInterval(() => void this.checkRollover(), 60 * 60 * 1000);
|
|
464
|
+
this.rolloverInterval.unref();
|
|
252
465
|
}
|
|
253
466
|
async checkRollover() {
|
|
254
467
|
if (!this.state) {
|
|
255
468
|
return;
|
|
256
469
|
}
|
|
257
|
-
const now = new Date();
|
|
258
|
-
if (now.getFullYear() !== this.state.year || (now.getMonth() + 1) !== this.state.month) {
|
|
259
|
-
this.log.info('Detected month change - performing usage reset');
|
|
260
|
-
await this.resetForNewMonth();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
async updateTotalAllowed(newTotal) {
|
|
264
|
-
if (!this.state) {
|
|
265
|
-
throw new Error('UsageTracker not initialized');
|
|
266
|
-
}
|
|
267
470
|
const release = await this.mutex.acquire();
|
|
268
471
|
try {
|
|
269
|
-
this.
|
|
270
|
-
this.state.totalAllowed = newTotal;
|
|
271
|
-
await this.persist();
|
|
472
|
+
await this.rolloverIfNeededLocked();
|
|
272
473
|
}
|
|
273
474
|
finally {
|
|
274
475
|
release();
|
|
275
476
|
}
|
|
276
477
|
}
|
|
277
478
|
async stop() {
|
|
479
|
+
// Before waiting for the mutex, so a save that hangs cannot keep the timer
|
|
480
|
+
if (this.rolloverInterval) {
|
|
481
|
+
clearInterval(this.rolloverInterval);
|
|
482
|
+
this.rolloverInterval = undefined;
|
|
483
|
+
}
|
|
278
484
|
const release = await this.mutex.acquire();
|
|
279
485
|
try {
|
|
486
|
+
// A discovery cut off by shutdown ends after this, too late to save its release. Shutdown stops the TTLock API
|
|
487
|
+
// first, so no request takes from the reservation any more.
|
|
488
|
+
this.releasePendingLocked();
|
|
280
489
|
await this.persist();
|
|
281
|
-
if (this.rolloverInterval) {
|
|
282
|
-
clearInterval(this.rolloverInterval);
|
|
283
|
-
}
|
|
284
490
|
}
|
|
285
491
|
finally {
|
|
286
492
|
release();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usageTracker.js","sourceRoot":"","sources":["../../src/api/usageTracker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,MAAM,OAAO,YAAa,SAAQ,YAAY;IAUA;IATpC,eAAe,CAAU;IACzB,KAAK,GAAuB,IAAI,CAAC;IACjC,GAAG,CAAU;IACb,GAAG,CAAM;IACT,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;IAC1B,gBAAgB,CAAkB;IAClC,WAAW,GAAG,CAAC,CAAC;IAChB,eAAe,G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