@switchbot/homebridge-switchbot 5.0.0-beta.107 → 5.0.0-beta.108

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.
@@ -479,12 +479,19 @@
479
479
  }
480
480
  }
481
481
 
482
- const DEVICE_TYPES = [
483
- 'bot', 'curtain', 'fan', 'light', 'lightstrip', 'motion', 'contact',
484
- 'vacuum', 'lock', 'humidifier', 'temperature', 'relay', 'plug',
485
- 'wosweeper', 'blindtilt', 'curtain3', 'rollershade', 'meter',
486
- 'waterdetector', 'walletfinder', 'unknown'
487
- ]
482
+ // Complete list of SwitchBot API device types (from official API documentation)
483
+ const DEVICE_TYPES = {
484
+ 'Window Coverings': ['Blind Tilt', 'Curtain', 'Curtain3', 'Roller Shade'],
485
+ 'Locks & Access': ['Keypad', 'Keypad Touch', 'Keypad Vision', 'Keypad Vision Pro', 'Lock Lite', 'Smart Lock', 'Smart Lock Pro', 'Smart Lock Ultra', 'Video Doorbell'],
486
+ 'Sensors': ['Contact Sensor', 'Motion Sensor', 'Presence Sensor', 'Water Detector'],
487
+ 'Lighting': ['Candle Warmer Lamp', 'Ceiling Light', 'Ceiling Light Pro', 'Color Bulb', 'Floor Lamp', 'RGBIC Neon Rope Light', 'RGBIC Neon Wire Rope Light', 'RGBICWW Floor Lamp', 'RGBICWW Strip Light', 'Strip Light', 'Strip Light 3'],
488
+ 'Climate Control': ['Air Purifier PM2.5', 'Air Purifier Table PM2.5', 'Air Purifier VOC', 'Air Purifier Table VOC', 'Battery Circulator Fan', 'Circulator Fan', 'Humidifier', 'Humidifier2', 'Meter', 'MeterPlus', 'MeterPro', 'MeterPro(CO2)', 'Smart Radiator Thermostat', 'Standing Circulator Fan', 'WoIOSensor'],
489
+ 'Plugs & Switches': ['Garage Door Opener', 'Plug', 'Plug Mini (EU)', 'Plug Mini (JP)', 'Plug Mini (US)', 'Relay Switch 1', 'Relay Switch 1PM', 'Relay Switch 2PM'],
490
+ 'Robot Vacuums': ['K10+', 'K10+ Pro', 'Robot Vacuum Cleaner K10+ Pro Combo', 'Robot Vacuum Cleaner K11+', 'Robot Vacuum Cleaner K20 Plus Pro', 'Robot Vacuum Cleaner S1', 'Robot Vacuum Cleaner S1 Plus', 'Robot Vacuum Cleaner S10', 'Robot Vacuum Cleaner S20'],
491
+ 'Hubs': ['AI Hub', 'Hub', 'Hub 2', 'Hub 3', 'Hub Mini', 'Hub Plus'],
492
+ 'Cameras': ['Indoor Cam', 'Pan/Tilt Cam', 'Pan/Tilt Cam 2K', 'Pan/Tilt Cam Plus 2K', 'Pan/Tilt Cam Plus 3K'],
493
+ 'Other Devices': ['AI Art Frame', 'Bot', 'Home Climate Panel', 'Remote']
494
+ }
488
495
 
489
496
  async function editDevice(device) {
490
497
  // Create modal dialog for editing
@@ -524,8 +531,25 @@
524
531
  nameInput.style.width = '100%'
525
532
  nameInput.style.marginBottom = '16px'
526
533
 
534
+ // Read-only API device type field
535
+ const apiTypeLabel = document.createElement('label')
536
+ apiTypeLabel.textContent = 'Device Type (API - Read Only)'
537
+ apiTypeLabel.style.display = 'block'
538
+ apiTypeLabel.style.marginBottom = '8px'
539
+ apiTypeLabel.style.fontWeight = '500'
540
+
541
+ const apiTypeInput = document.createElement('input')
542
+ apiTypeInput.type = 'text'
543
+ apiTypeInput.value = device.deviceType || device.type || 'Unknown'
544
+ apiTypeInput.readOnly = true
545
+ apiTypeInput.style.width = '100%'
546
+ apiTypeInput.style.marginBottom = '16px'
547
+ apiTypeInput.style.opacity = '0.6'
548
+ apiTypeInput.style.cursor = 'not-allowed'
549
+
550
+ // Editable config device type dropdown
527
551
  const typeLabel = document.createElement('label')
528
- typeLabel.textContent = 'Device Type'
552
+ typeLabel.textContent = 'Config Device Type (Override)'
529
553
  typeLabel.style.display = 'block'
530
554
  typeLabel.style.marginBottom = '8px'
531
555
  typeLabel.style.fontWeight = '500'
@@ -539,12 +563,22 @@
539
563
  typeSelect.style.color = getComputedStyle(nameInput).color
540
564
  typeSelect.style.border = getComputedStyle(nameInput).border
541
565
 
542
- DEVICE_TYPES.forEach(t => {
543
- const opt = document.createElement('option')
544
- opt.value = t
545
- opt.text = t
546
- opt.selected = (device.type || 'unknown') === t
547
- typeSelect.appendChild(opt)
566
+ // Add option groups with all API device types
567
+ Object.keys(DEVICE_TYPES).forEach(categoryName => {
568
+ const optgroup = document.createElement('optgroup')
569
+ optgroup.label = categoryName
570
+
571
+ DEVICE_TYPES[categoryName].forEach(deviceType => {
572
+ const opt = document.createElement('option')
573
+ opt.value = deviceType
574
+ opt.text = deviceType
575
+ // Select current configDeviceType if set, otherwise match API deviceType
576
+ const currentType = device.configDeviceType || device.deviceType || device.type || ''
577
+ opt.selected = currentType === deviceType
578
+ optgroup.appendChild(opt)
579
+ })
580
+
581
+ typeSelect.appendChild(optgroup)
548
582
  })
549
583
 
550
584
  const buttons = document.createElement('div')
@@ -595,6 +629,8 @@
595
629
  modal.appendChild(title)
596
630
  modal.appendChild(nameLabel)
597
631
  modal.appendChild(nameInput)
632
+ modal.appendChild(apiTypeLabel)
633
+ modal.appendChild(apiTypeInput)
598
634
  modal.appendChild(typeLabel)
599
635
  modal.appendChild(typeSelect)
600
636
  modal.appendChild(buttons)
@@ -1 +1 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/c5094b100b48735027e1daace2cf49ad073773fb/src/index.ts#L12">index.ts:12</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/94a513250cd1aa4a9c8f6c573361070b4700ff90/src/index.ts#L12">index.ts:12</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@switchbot/homebridge-switchbot",
3
3
  "displayName": "SwitchBot",
4
4
  "type": "module",
5
- "version": "5.0.0-beta.107",
5
+ "version": "5.0.0-beta.108",
6
6
  "description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
7
7
  "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
8
8
  "contributors": [
@@ -479,12 +479,19 @@
479
479
  }
480
480
  }
481
481
 
482
- const DEVICE_TYPES = [
483
- 'bot', 'curtain', 'fan', 'light', 'lightstrip', 'motion', 'contact',
484
- 'vacuum', 'lock', 'humidifier', 'temperature', 'relay', 'plug',
485
- 'wosweeper', 'blindtilt', 'curtain3', 'rollershade', 'meter',
486
- 'waterdetector', 'walletfinder', 'unknown'
487
- ]
482
+ // Complete list of SwitchBot API device types (from official API documentation)
483
+ const DEVICE_TYPES = {
484
+ 'Window Coverings': ['Blind Tilt', 'Curtain', 'Curtain3', 'Roller Shade'],
485
+ 'Locks & Access': ['Keypad', 'Keypad Touch', 'Keypad Vision', 'Keypad Vision Pro', 'Lock Lite', 'Smart Lock', 'Smart Lock Pro', 'Smart Lock Ultra', 'Video Doorbell'],
486
+ 'Sensors': ['Contact Sensor', 'Motion Sensor', 'Presence Sensor', 'Water Detector'],
487
+ 'Lighting': ['Candle Warmer Lamp', 'Ceiling Light', 'Ceiling Light Pro', 'Color Bulb', 'Floor Lamp', 'RGBIC Neon Rope Light', 'RGBIC Neon Wire Rope Light', 'RGBICWW Floor Lamp', 'RGBICWW Strip Light', 'Strip Light', 'Strip Light 3'],
488
+ 'Climate Control': ['Air Purifier PM2.5', 'Air Purifier Table PM2.5', 'Air Purifier VOC', 'Air Purifier Table VOC', 'Battery Circulator Fan', 'Circulator Fan', 'Humidifier', 'Humidifier2', 'Meter', 'MeterPlus', 'MeterPro', 'MeterPro(CO2)', 'Smart Radiator Thermostat', 'Standing Circulator Fan', 'WoIOSensor'],
489
+ 'Plugs & Switches': ['Garage Door Opener', 'Plug', 'Plug Mini (EU)', 'Plug Mini (JP)', 'Plug Mini (US)', 'Relay Switch 1', 'Relay Switch 1PM', 'Relay Switch 2PM'],
490
+ 'Robot Vacuums': ['K10+', 'K10+ Pro', 'Robot Vacuum Cleaner K10+ Pro Combo', 'Robot Vacuum Cleaner K11+', 'Robot Vacuum Cleaner K20 Plus Pro', 'Robot Vacuum Cleaner S1', 'Robot Vacuum Cleaner S1 Plus', 'Robot Vacuum Cleaner S10', 'Robot Vacuum Cleaner S20'],
491
+ 'Hubs': ['AI Hub', 'Hub', 'Hub 2', 'Hub 3', 'Hub Mini', 'Hub Plus'],
492
+ 'Cameras': ['Indoor Cam', 'Pan/Tilt Cam', 'Pan/Tilt Cam 2K', 'Pan/Tilt Cam Plus 2K', 'Pan/Tilt Cam Plus 3K'],
493
+ 'Other Devices': ['AI Art Frame', 'Bot', 'Home Climate Panel', 'Remote']
494
+ }
488
495
 
489
496
  async function editDevice(device) {
490
497
  // Create modal dialog for editing
@@ -524,8 +531,25 @@
524
531
  nameInput.style.width = '100%'
525
532
  nameInput.style.marginBottom = '16px'
526
533
 
534
+ // Read-only API device type field
535
+ const apiTypeLabel = document.createElement('label')
536
+ apiTypeLabel.textContent = 'Device Type (API - Read Only)'
537
+ apiTypeLabel.style.display = 'block'
538
+ apiTypeLabel.style.marginBottom = '8px'
539
+ apiTypeLabel.style.fontWeight = '500'
540
+
541
+ const apiTypeInput = document.createElement('input')
542
+ apiTypeInput.type = 'text'
543
+ apiTypeInput.value = device.deviceType || device.type || 'Unknown'
544
+ apiTypeInput.readOnly = true
545
+ apiTypeInput.style.width = '100%'
546
+ apiTypeInput.style.marginBottom = '16px'
547
+ apiTypeInput.style.opacity = '0.6'
548
+ apiTypeInput.style.cursor = 'not-allowed'
549
+
550
+ // Editable config device type dropdown
527
551
  const typeLabel = document.createElement('label')
528
- typeLabel.textContent = 'Device Type'
552
+ typeLabel.textContent = 'Config Device Type (Override)'
529
553
  typeLabel.style.display = 'block'
530
554
  typeLabel.style.marginBottom = '8px'
531
555
  typeLabel.style.fontWeight = '500'
@@ -539,12 +563,22 @@
539
563
  typeSelect.style.color = getComputedStyle(nameInput).color
540
564
  typeSelect.style.border = getComputedStyle(nameInput).border
541
565
 
542
- DEVICE_TYPES.forEach(t => {
543
- const opt = document.createElement('option')
544
- opt.value = t
545
- opt.text = t
546
- opt.selected = (device.type || 'unknown') === t
547
- typeSelect.appendChild(opt)
566
+ // Add option groups with all API device types
567
+ Object.keys(DEVICE_TYPES).forEach(categoryName => {
568
+ const optgroup = document.createElement('optgroup')
569
+ optgroup.label = categoryName
570
+
571
+ DEVICE_TYPES[categoryName].forEach(deviceType => {
572
+ const opt = document.createElement('option')
573
+ opt.value = deviceType
574
+ opt.text = deviceType
575
+ // Select current configDeviceType if set, otherwise match API deviceType
576
+ const currentType = device.configDeviceType || device.deviceType || device.type || ''
577
+ opt.selected = currentType === deviceType
578
+ optgroup.appendChild(opt)
579
+ })
580
+
581
+ typeSelect.appendChild(optgroup)
548
582
  })
549
583
 
550
584
  const buttons = document.createElement('div')
@@ -595,6 +629,8 @@
595
629
  modal.appendChild(title)
596
630
  modal.appendChild(nameLabel)
597
631
  modal.appendChild(nameInput)
632
+ modal.appendChild(apiTypeLabel)
633
+ modal.appendChild(apiTypeInput)
598
634
  modal.appendChild(typeLabel)
599
635
  modal.appendChild(typeSelect)
600
636
  modal.appendChild(buttons)