@homebridge-plugins/homebridge-august 3.4.0-beta.2 → 3.4.0-beta.3
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/CHANGELOG.md +7 -0
- package/dist/homebridge-ui/public/index.html +281 -2
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
### Changed
|
|
4
4
|
|
|
5
5
|
- feat(matter): expose lock battery via a PowerSource cluster (@zbuc)
|
|
6
|
+
- feat(ui): add, remove and hide devices from the config via the devices tab
|
|
7
|
+
|
|
8
|
+
## v3.3.2 (2026-07-22)
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- fix(deps): bump august-yale to 1.2.5 so US August accounts use the correct api key again instead of getting "API key is not valid" (#238)
|
|
6
13
|
|
|
7
14
|
## v3.3.1 (2026-07-20)
|
|
8
15
|
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.min-w-50 {
|
|
3
|
+
min-width: 50px;
|
|
4
|
+
}
|
|
5
|
+
.action-desc {
|
|
6
|
+
font-size: 0.85rem;
|
|
7
|
+
}
|
|
8
|
+
.dark-mode .list-group-item {
|
|
9
|
+
background-color: #333333;
|
|
10
|
+
border-color: #444444;
|
|
11
|
+
color: #eeeeee;
|
|
12
|
+
}
|
|
13
|
+
.dark-mode .text-muted {
|
|
14
|
+
color: #aaaaaa !important;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
1
17
|
<p class="text-center">
|
|
2
18
|
<img src="https://raw.githubusercontent.com/homebridge-plugins/homebridge-august/latest/branding/Homebridge_x_August.svg"
|
|
3
19
|
alt="homebridge-august logo" style="width: 45%" />
|
|
@@ -23,11 +39,46 @@
|
|
|
23
39
|
<div id="pageDevices" class="mt-4" style="display: none">
|
|
24
40
|
<div id="deviceInfo">
|
|
25
41
|
<form>
|
|
26
|
-
<div class="form-group">
|
|
42
|
+
<div class="form-group mb-0">
|
|
27
43
|
<select class="form-control" id="deviceSelect"></select>
|
|
28
44
|
</div>
|
|
29
45
|
</form>
|
|
30
|
-
<
|
|
46
|
+
<ul class="list-group mt-4 mb-4 mx-0" id="configActionList" style="display: none">
|
|
47
|
+
<li class="list-group-item">
|
|
48
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
49
|
+
<div class="pr-2">
|
|
50
|
+
<div>Add All Devices</div>
|
|
51
|
+
<div class="text-muted action-desc">Add all devices to the config that are not already in the config.</div>
|
|
52
|
+
</div>
|
|
53
|
+
<button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="addAllBtn" aria-label="Add all devices to the config">
|
|
54
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
</li>
|
|
58
|
+
<li class="list-group-item">
|
|
59
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
60
|
+
<div class="pr-2">
|
|
61
|
+
<div id="deviceConfigTitle">Add This Device</div>
|
|
62
|
+
<div class="text-muted action-desc" id="deviceConfigText">Add this device to the plugin config.</div>
|
|
63
|
+
</div>
|
|
64
|
+
<button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="deviceConfigBtn" aria-label="Add this device to the config">
|
|
65
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
</li>
|
|
69
|
+
<li class="list-group-item">
|
|
70
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
71
|
+
<div class="pr-2">
|
|
72
|
+
<div id="hideDeviceTitle">Hide This Device</div>
|
|
73
|
+
<div class="text-muted action-desc" id="hideDeviceText">Hide this device from HomeKit. This adds the device to the config if needed.</div>
|
|
74
|
+
</div>
|
|
75
|
+
<button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="hideDeviceBtn" aria-label="Hide this device from HomeKit">
|
|
76
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
</li>
|
|
80
|
+
</ul>
|
|
81
|
+
<table class="table w-100 mt-0" id="deviceTable" style="display: none">
|
|
31
82
|
<thead>
|
|
32
83
|
<tr class="table-active">
|
|
33
84
|
<th scope="col" style="width: 40%">Device Name</th>
|
|
@@ -96,6 +147,227 @@
|
|
|
96
147
|
(async () => {
|
|
97
148
|
try {
|
|
98
149
|
const currentConfig = await homebridge.getPluginConfig();
|
|
150
|
+
|
|
151
|
+
// ===== Device picker (add/remove/hide config entries from the Devices tab) =====
|
|
152
|
+
// The control state is always computed from a fresh getPluginConfig() call,
|
|
153
|
+
// so staged-but-unsaved edits made in the Settings tab are respected
|
|
154
|
+
let pickerAccessories = [];
|
|
155
|
+
let removeConfirmTimer;
|
|
156
|
+
|
|
157
|
+
// The action buttons always show the settings-page arrow; the row text
|
|
158
|
+
// (and the button's aria-label) says what the arrow will do
|
|
159
|
+
const actionArrow = '<i aria-hidden="true" class="fas fa-arrow-right"></i>';
|
|
160
|
+
|
|
161
|
+
// Compare lock ids ignoring case and separators, the same comparison the
|
|
162
|
+
// platform itself uses when merging lock config
|
|
163
|
+
const looseId = (id) => (id || '').toString().toUpperCase().replace(/[^A-Z0-9]+/g, '');
|
|
164
|
+
|
|
165
|
+
const getConfigBlocks = async () => {
|
|
166
|
+
const blocks = await homebridge.getPluginConfig();
|
|
167
|
+
if (!blocks.length) {
|
|
168
|
+
blocks.push({ name: 'August' });
|
|
169
|
+
}
|
|
170
|
+
return blocks;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// The devices array lives nested under options
|
|
174
|
+
const getDevicesArray = (config, create) => {
|
|
175
|
+
if (!config.options || typeof config.options !== 'object') {
|
|
176
|
+
if (!create) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
config.options = {};
|
|
180
|
+
}
|
|
181
|
+
if (!Array.isArray(config.options.devices)) {
|
|
182
|
+
if (!create) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
config.options.devices = [];
|
|
186
|
+
}
|
|
187
|
+
return config.options.devices;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const findInConfig = (config, lockId) => {
|
|
191
|
+
const target = looseId(lockId);
|
|
192
|
+
const devices = getDevicesArray(config, false);
|
|
193
|
+
if (!devices) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const index = devices.findIndex((entry) => entry && looseId(entry.lockId) === target);
|
|
197
|
+
return index === -1 ? null : { index };
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const selectedAccessory = () => {
|
|
201
|
+
const uuid = document.getElementById('deviceSelect').value;
|
|
202
|
+
return pickerAccessories.find((x) => x.UUID === uuid);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const setHideControl = (hidden) => {
|
|
206
|
+
const btn = document.getElementById('hideDeviceBtn');
|
|
207
|
+
btn.dataset.hidden = hidden ? 'yes' : 'no';
|
|
208
|
+
btn.innerHTML = actionArrow;
|
|
209
|
+
btn.setAttribute('aria-label', hidden ? 'Show this device in HomeKit' : 'Hide this device from HomeKit');
|
|
210
|
+
document.getElementById('hideDeviceTitle').innerHTML = hidden ? 'Show This Device' : 'Hide This Device';
|
|
211
|
+
document.getElementById('hideDeviceText').innerHTML = hidden
|
|
212
|
+
? 'Show this device in HomeKit again. The config entry is kept.'
|
|
213
|
+
: 'Hide this device from HomeKit. This adds the device to the config if needed.';
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const setConfigButton = (inConfig) => {
|
|
217
|
+
const btn = document.getElementById('deviceConfigBtn');
|
|
218
|
+
clearTimeout(removeConfirmTimer);
|
|
219
|
+
delete btn.dataset.confirm;
|
|
220
|
+
btn.dataset.state = inConfig ? 'remove' : 'add';
|
|
221
|
+
btn.classList.remove('btn-danger');
|
|
222
|
+
btn.classList.add('btn-primary');
|
|
223
|
+
btn.innerHTML = actionArrow;
|
|
224
|
+
btn.setAttribute('aria-label', inConfig ? 'Remove this device from the config' : 'Add this device to the config');
|
|
225
|
+
document.getElementById('deviceConfigTitle').innerHTML = inConfig ? 'Remove This Device' : 'Add This Device';
|
|
226
|
+
document.getElementById('deviceConfigText').innerHTML = inConfig
|
|
227
|
+
? 'Remove this device from the plugin config.'
|
|
228
|
+
: 'Add this device to the plugin config.';
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const addDeviceToConfig = (config, acc) => {
|
|
232
|
+
const devices = getDevicesArray(config, true);
|
|
233
|
+
// configLockName is included so the entry is identifiable in the
|
|
234
|
+
// config editor; it matches the current name so nothing is renamed
|
|
235
|
+
devices.push({ lockId: acc.context.lockId, configLockName: acc.displayName });
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
document.getElementById('deviceConfigBtn').addEventListener('click', async () => {
|
|
239
|
+
try {
|
|
240
|
+
const btn = document.getElementById('deviceConfigBtn');
|
|
241
|
+
const acc = selectedAccessory();
|
|
242
|
+
if (!acc) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const blocks = await getConfigBlocks();
|
|
246
|
+
const config = blocks[0];
|
|
247
|
+
const found = findInConfig(config, acc.context.lockId);
|
|
248
|
+
if (btn.dataset.state === 'add') {
|
|
249
|
+
// The config may have changed since the button was drawn, so
|
|
250
|
+
// re-check and never add a duplicate - just correct the button
|
|
251
|
+
if (found) {
|
|
252
|
+
setConfigButton(true);
|
|
253
|
+
setHideControl(!!config.options.devices[found.index].hide_device);
|
|
254
|
+
homebridge.toast.info(acc.displayName + ' is already in the config.', 'Not Added');
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
addDeviceToConfig(config, acc);
|
|
258
|
+
await homebridge.updatePluginConfig(blocks);
|
|
259
|
+
setConfigButton(true);
|
|
260
|
+
setHideControl(false);
|
|
261
|
+
homebridge.toast.success(acc.displayName + ' added - press Save to apply.', 'Added To Config');
|
|
262
|
+
} else {
|
|
263
|
+
if (!found) {
|
|
264
|
+
setConfigButton(false);
|
|
265
|
+
setHideControl(false);
|
|
266
|
+
homebridge.toast.info(acc.displayName + ' is not in the config.', 'Not Removed');
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const entry = config.options.devices[found.index];
|
|
270
|
+
const extraKeys = Object.keys(entry).filter((k) => !['lockId', 'configLockName'].includes(k));
|
|
271
|
+
if (extraKeys.length > 0 && btn.dataset.confirm !== 'yes') {
|
|
272
|
+
// The entry has settings beyond id and name which would be
|
|
273
|
+
// lost, so ask for a second click within five seconds
|
|
274
|
+
btn.dataset.confirm = 'yes';
|
|
275
|
+
btn.classList.remove('btn-primary');
|
|
276
|
+
btn.classList.add('btn-danger');
|
|
277
|
+
btn.innerHTML = actionArrow;
|
|
278
|
+
btn.setAttribute('aria-label', 'Confirm removing this device from the config');
|
|
279
|
+
document.getElementById('deviceConfigText').innerHTML = 'This entry has extra settings which will be lost. Click again to remove it.';
|
|
280
|
+
removeConfirmTimer = setTimeout(() => setConfigButton(true), 5000);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
config.options.devices.splice(found.index, 1);
|
|
284
|
+
if (config.options.devices.length === 0) {
|
|
285
|
+
delete config.options.devices;
|
|
286
|
+
}
|
|
287
|
+
await homebridge.updatePluginConfig(blocks);
|
|
288
|
+
setConfigButton(false);
|
|
289
|
+
setHideControl(false);
|
|
290
|
+
homebridge.toast.success(acc.displayName + ' removed - press Save to apply.', 'Removed From Config');
|
|
291
|
+
}
|
|
292
|
+
} catch (err) {
|
|
293
|
+
homebridge.toast.error(err.message, 'Error');
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
document.getElementById('hideDeviceBtn').addEventListener('click', async () => {
|
|
298
|
+
try {
|
|
299
|
+
const acc = selectedAccessory();
|
|
300
|
+
if (!acc) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const blocks = await getConfigBlocks();
|
|
304
|
+
const config = blocks[0];
|
|
305
|
+
let found = findInConfig(config, acc.context.lockId);
|
|
306
|
+
const currentlyHidden = document.getElementById('hideDeviceBtn').dataset.hidden === 'yes';
|
|
307
|
+
if (!currentlyHidden) {
|
|
308
|
+
// Hiding needs a config entry to carry the flag, so create one if
|
|
309
|
+
// the device is not in the config yet
|
|
310
|
+
if (!found) {
|
|
311
|
+
addDeviceToConfig(config, acc);
|
|
312
|
+
found = findInConfig(config, acc.context.lockId);
|
|
313
|
+
}
|
|
314
|
+
config.options.devices[found.index].hide_device = true;
|
|
315
|
+
await homebridge.updatePluginConfig(blocks);
|
|
316
|
+
setConfigButton(true);
|
|
317
|
+
setHideControl(true);
|
|
318
|
+
homebridge.toast.success(acc.displayName + ' will be hidden from HomeKit - press Save to apply.', 'Device Hidden');
|
|
319
|
+
} else {
|
|
320
|
+
if (found) {
|
|
321
|
+
// Drop the flag rather than storing hide_device false, to keep
|
|
322
|
+
// the entry clean
|
|
323
|
+
delete config.options.devices[found.index].hide_device;
|
|
324
|
+
await homebridge.updatePluginConfig(blocks);
|
|
325
|
+
}
|
|
326
|
+
setConfigButton(!!found);
|
|
327
|
+
setHideControl(false);
|
|
328
|
+
homebridge.toast.success(acc.displayName + ' will be shown in HomeKit - press Save to apply.', 'Device Unhidden');
|
|
329
|
+
}
|
|
330
|
+
} catch (err) {
|
|
331
|
+
homebridge.toast.error(err.message, 'Error');
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
document.getElementById('addAllBtn').addEventListener('click', async () => {
|
|
336
|
+
try {
|
|
337
|
+
const blocks = await getConfigBlocks();
|
|
338
|
+
const config = blocks[0];
|
|
339
|
+
let added = 0;
|
|
340
|
+
let skipped = 0;
|
|
341
|
+
pickerAccessories.forEach((acc) => {
|
|
342
|
+
if (!acc.context?.lockId) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (findInConfig(config, acc.context.lockId)) {
|
|
346
|
+
skipped += 1;
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
addDeviceToConfig(config, acc);
|
|
350
|
+
added += 1;
|
|
351
|
+
});
|
|
352
|
+
if (added > 0) {
|
|
353
|
+
await homebridge.updatePluginConfig(blocks);
|
|
354
|
+
homebridge.toast.success(added + ' device(s) added, ' + skipped + ' already in the config - press Save to apply.', 'Added To Config');
|
|
355
|
+
} else {
|
|
356
|
+
homebridge.toast.info('All devices are already in the config.', 'Nothing To Add');
|
|
357
|
+
}
|
|
358
|
+
const acc = selectedAccessory();
|
|
359
|
+
if (acc) {
|
|
360
|
+
const nowFound = findInConfig(config, acc.context.lockId);
|
|
361
|
+
setConfigButton(!!nowFound);
|
|
362
|
+
if (nowFound) {
|
|
363
|
+
setHideControl(!!config.options.devices[nowFound.index].hide_device);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
} catch (err) {
|
|
367
|
+
homebridge.toast.error(err.message, 'Error');
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
// ===== End device picker =====
|
|
99
371
|
showIntro = () => {
|
|
100
372
|
const introLink = document.getElementById('introLink');
|
|
101
373
|
introLink.addEventListener('click', () => {
|
|
@@ -127,6 +399,7 @@
|
|
|
127
399
|
return a.displayName.toLowerCase() > b.displayName.toLowerCase() ? 1 : b.displayName.toLowerCase() > a.displayName.toLowerCase() ? -1 : 0;
|
|
128
400
|
});
|
|
129
401
|
}
|
|
402
|
+
pickerAccessories = cachedAccessories;
|
|
130
403
|
const deviceSelect = document.getElementById('deviceSelect');
|
|
131
404
|
deviceSelect.innerHTML = '';
|
|
132
405
|
cachedAccessories.forEach((a) => {
|
|
@@ -145,6 +418,11 @@
|
|
|
145
418
|
document.getElementById('model').innerHTML = context.model;
|
|
146
419
|
document.getElementById('firmwareRevision').innerHTML = context.firmwareRevision || 'N/A';
|
|
147
420
|
document.getElementById('deviceTable').style.display = 'inline-table';
|
|
421
|
+
const configBlocks = await getConfigBlocks();
|
|
422
|
+
const configEntry = findInConfig(configBlocks[0], context.lockId);
|
|
423
|
+
setConfigButton(!!configEntry);
|
|
424
|
+
setHideControl(!!(configEntry && configBlocks[0].options.devices[configEntry.index].hide_device));
|
|
425
|
+
document.getElementById('configActionList').style.display = 'block';
|
|
148
426
|
homebridge.hideSpinner();
|
|
149
427
|
};
|
|
150
428
|
deviceSelect.addEventListener('change', (event) => showDeviceInfo(event.target.value));
|
|
@@ -154,6 +432,7 @@
|
|
|
154
432
|
const option = document.createElement('option');
|
|
155
433
|
option.text = 'No Devices';
|
|
156
434
|
deviceSelect.add(option);
|
|
435
|
+
document.getElementById('configActionList').style.display = 'none';
|
|
157
436
|
}
|
|
158
437
|
homebridge.hideSpinner();
|
|
159
438
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@homebridge-plugins/homebridge-august",
|
|
3
3
|
"displayName": "August",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "3.4.0-beta.
|
|
5
|
+
"version": "3.4.0-beta.3",
|
|
6
6
|
"description": "The August plugin allows you to access your August & Yale device(s) from HomeKit.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "bwp91",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"homebridge-plugin",
|
|
45
|
+
"supports-matter",
|
|
45
46
|
"august",
|
|
46
47
|
"yale",
|
|
47
48
|
"lock"
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
71
72
|
"@homebridge/plugin-ui-utils": "^2.2.5",
|
|
72
|
-
"august-yale": "^1.2.
|
|
73
|
+
"august-yale": "^1.2.5",
|
|
73
74
|
"rxjs": "^7.8.2"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|