@homebridge-plugins/homebridge-govee 11.32.0-beta.0 → 11.32.0-beta.2

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 CHANGED
@@ -8,6 +8,8 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
8
8
 
9
9
  - chore(github): use the shared homebridge action to deprecate past pre-releases
10
10
  - feat(ui): add and remove devices from the config via the my devices tab (#1323)
11
+ - feat(ui): hide or show a device in homekit from the my devices tab
12
+ - style(ui): present the device config actions as a settings-style list
11
13
 
12
14
  ## v11.31.0 (2026-07-24)
13
15
 
@@ -17,6 +17,15 @@
17
17
  color: #eeeeee !important;
18
18
  font-weight: 500 !important;
19
19
  }
20
+
21
+ .list-group-item {
22
+ background-color: #333333;
23
+ border-color: #444444;
24
+ color: #eeeeee;
25
+ }
26
+ }
27
+ .min-w-50 {
28
+ min-width: 50px;
20
29
  }
21
30
  select {
22
31
  background-image:
@@ -77,6 +86,26 @@
77
86
  <select class="form-control" id="deviceSelect"></select>
78
87
  </div>
79
88
  </form>
89
+ <ul class="list-group mt-2 mb-3 mx-0" id="configActionList" style="display: none;">
90
+ <li class="list-group-item">
91
+ <div class="d-flex justify-content-between align-items-center">
92
+ <span class="pr-2">Adds all devices to the config.</span>
93
+ <button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="addAllBtn">Add All</button>
94
+ </div>
95
+ </li>
96
+ <li class="list-group-item">
97
+ <div class="d-flex justify-content-between align-items-center">
98
+ <span class="pr-2" id="deviceConfigText">Adds this device to the config.</span>
99
+ <button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="deviceConfigBtn">Add</button>
100
+ </div>
101
+ </li>
102
+ <li class="list-group-item">
103
+ <div class="d-flex justify-content-between align-items-center">
104
+ <span class="pr-2" id="hideDeviceText">Hide this device from HomeKit.</span>
105
+ <button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="hideDeviceBtn">Hide</button>
106
+ </div>
107
+ </li>
108
+ </ul>
80
109
  <table class="table w-100 mt-3" id="deviceTable" style="display: none;">
81
110
  <thead>
82
111
  <tr class="table-active">
@@ -166,10 +195,6 @@
166
195
  </tr>
167
196
  </tbody>
168
197
  </table>
169
- <div id="configBtnRow" class="text-center mt-2 mb-3" style="display: none;">
170
- <button type="button" class="btn btn-primary" id="deviceConfigBtn">Add To Config</button>
171
- <button type="button" class="btn btn-secondary" id="addAllBtn">Add All To Config</button>
172
- </div>
173
198
  </div>
174
199
  </div>
175
200
  <div id="pageSupport" class="mt-4" style="display: none;">
@@ -356,6 +381,15 @@
356
381
  return null
357
382
  }
358
383
 
384
+ const setHideControl = hidden => {
385
+ const btn = document.getElementById('hideDeviceBtn')
386
+ btn.dataset.hidden = hidden ? 'yes' : 'no'
387
+ btn.innerHTML = hidden ? 'Show' : 'Hide'
388
+ document.getElementById('hideDeviceText').innerHTML = hidden
389
+ ? 'Show this device in HomeKit.'
390
+ : 'Hide this device from HomeKit.'
391
+ }
392
+
359
393
  const setConfigButton = inConfig => {
360
394
  const btn = document.getElementById('deviceConfigBtn')
361
395
  clearTimeout(removeConfirmTimer)
@@ -363,7 +397,10 @@
363
397
  btn.dataset.state = inConfig ? 'remove' : 'add'
364
398
  btn.classList.remove('btn-danger')
365
399
  btn.classList.add('btn-primary')
366
- btn.innerHTML = inConfig ? 'Remove From Config' : 'Add To Config'
400
+ btn.innerHTML = inConfig ? 'Remove' : 'Add'
401
+ document.getElementById('deviceConfigText').innerHTML = inConfig
402
+ ? 'Removes this device from the config.'
403
+ : 'Adds this device to the config.'
367
404
  }
368
405
 
369
406
  const addDeviceToConfig = (config, acc) => {
@@ -392,16 +429,19 @@
392
429
  // re-check and never add a duplicate - just correct the button
393
430
  if (found) {
394
431
  setConfigButton(true)
432
+ setHideControl(!!config[found.key][found.index].ignoreDevice)
395
433
  homebridge.toast.info(acc.displayName + ' is already in the config.', 'Not Added')
396
434
  return
397
435
  }
398
436
  addDeviceToConfig(config, acc)
399
437
  await homebridge.updatePluginConfig(blocks)
400
438
  setConfigButton(true)
439
+ setHideControl(false)
401
440
  homebridge.toast.success(acc.displayName + ' added - press Save to apply.', 'Added To Config')
402
441
  } else {
403
442
  if (!found) {
404
443
  setConfigButton(false)
444
+ setHideControl(false)
405
445
  homebridge.toast.info(acc.displayName + ' is not in the config.', 'Not Removed')
406
446
  return
407
447
  }
@@ -413,7 +453,8 @@
413
453
  btn.dataset.confirm = 'yes'
414
454
  btn.classList.remove('btn-primary')
415
455
  btn.classList.add('btn-danger')
416
- btn.innerHTML = 'Click Again To Remove (entry has settings)'
456
+ btn.innerHTML = 'Confirm'
457
+ document.getElementById('deviceConfigText').innerHTML = 'This entry has extra settings which will be lost - click again to remove it.'
417
458
  removeConfirmTimer = setTimeout(() => setConfigButton(true), 5000)
418
459
  return
419
460
  }
@@ -423,6 +464,7 @@
423
464
  }
424
465
  await homebridge.updatePluginConfig(blocks)
425
466
  setConfigButton(false)
467
+ setHideControl(false)
426
468
  homebridge.toast.success(acc.displayName + ' removed - press Save to apply.', 'Removed From Config')
427
469
  }
428
470
  } catch (err) {
@@ -430,6 +472,45 @@
430
472
  }
431
473
  })
432
474
 
475
+ document.getElementById('hideDeviceBtn').addEventListener('click', async () => {
476
+ try {
477
+ const selectedId = document.getElementById('deviceSelect').value
478
+ const acc = pickerAccessories.find(x => x.context.gvDeviceId === selectedId)
479
+ if (!acc) {
480
+ return
481
+ }
482
+ const blocks = await getConfigBlocks()
483
+ const config = blocks[0]
484
+ let found = findInConfig(config, selectedId)
485
+ const currentlyHidden = document.getElementById('hideDeviceBtn').dataset.hidden === 'yes'
486
+ if (!currentlyHidden) {
487
+ // Hiding needs a config entry to carry the flag, so create one if
488
+ // the device is not in the config yet
489
+ if (!found) {
490
+ addDeviceToConfig(config, acc)
491
+ found = findInConfig(config, selectedId)
492
+ }
493
+ config[found.key][found.index].ignoreDevice = true
494
+ await homebridge.updatePluginConfig(blocks)
495
+ setConfigButton(true)
496
+ setHideControl(true)
497
+ homebridge.toast.success(acc.displayName + ' will be hidden from HomeKit - press Save to apply.', 'Device Hidden')
498
+ } else {
499
+ if (found) {
500
+ // Drop the flag rather than storing ignoreDevice false, to keep
501
+ // the entry clean
502
+ delete config[found.key][found.index].ignoreDevice
503
+ await homebridge.updatePluginConfig(blocks)
504
+ }
505
+ setConfigButton(!!found)
506
+ setHideControl(false)
507
+ homebridge.toast.success(acc.displayName + ' will be shown in HomeKit - press Save to apply.', 'Device Unhidden')
508
+ }
509
+ } catch (err) {
510
+ homebridge.toast.error(err.message, 'Error')
511
+ }
512
+ })
513
+
433
514
  document.getElementById('addAllBtn').addEventListener('click', async () => {
434
515
  try {
435
516
  const blocks = await getConfigBlocks()
@@ -455,7 +536,11 @@
455
536
  }
456
537
  const selectedId = document.getElementById('deviceSelect').value
457
538
  if (selectedId) {
458
- setConfigButton(!!findInConfig(config, selectedId))
539
+ const nowFound = findInConfig(config, selectedId)
540
+ setConfigButton(!!nowFound)
541
+ if (nowFound) {
542
+ setHideControl(!!config[nowFound.key][nowFound.index].ignoreDevice)
543
+ }
459
544
  }
460
545
  } catch (err) {
461
546
  homebridge.toast.error(err.message, 'Error')
@@ -632,8 +717,10 @@
632
717
  : ''
633
718
  document.getElementById('deviceTable').style.display = 'inline-table'
634
719
  const configBlocks = await getConfigBlocks()
635
- setConfigButton(!!findInConfig(configBlocks[0], context.gvDeviceId))
636
- document.getElementById('configBtnRow').style.display = 'block'
720
+ const configEntry = findInConfig(configBlocks[0], context.gvDeviceId)
721
+ setConfigButton(!!configEntry)
722
+ setHideControl(!!(configEntry && configBlocks[0][configEntry.key][configEntry.index].ignoreDevice))
723
+ document.getElementById('configActionList').style.display = 'block'
637
724
  homebridge.hideSpinner()
638
725
  }
639
726
  deviceSelect.addEventListener('change', event => showDeviceInfo(event.target.value))
@@ -644,7 +731,7 @@
644
731
  option.text = 'No Devices'
645
732
  deviceSelect.add(option)
646
733
  deviceSelect.disabled = true
647
- document.getElementById('configBtnRow').style.display = 'none'
734
+ document.getElementById('configActionList').style.display = 'none'
648
735
  }
649
736
  homebridge.hideSpinner()
650
737
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@homebridge-plugins/homebridge-govee",
3
3
  "alias": "Govee",
4
4
  "type": "module",
5
- "version": "11.32.0-beta.0",
5
+ "version": "11.32.0-beta.2",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",