@switchbot/homebridge-switchbot 5.0.1 → 5.0.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.
@@ -128,9 +128,9 @@ jobs:
128
128
  release_type: ${{ needs.determine-release-type.outputs.release_type }}
129
129
  version: ${{ needs.update-version.outputs.version }}
130
130
  is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
131
- #version_override: ${{ inputs.version_override }}
132
- #version_bump: ${{ inputs.version_bump }}
133
- #max_attempts: ${{ inputs.max_attempts }}
131
+ version_override: ${{ inputs.version_override || '' }}
132
+ version_bump: ${{ inputs.version_bump || 'patch' }}
133
+ max_attempts: ${{ inputs.max_attempts || 5 }}
134
134
  secrets:
135
135
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
136
136
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [5.0.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.14...v5.0.1) (2026-04-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * preserve LockTargetState during in-flight lock/unlock commands ([#1345](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/1345)) ([cf6d7ae](https://github.com/OpenWonderLabs/homebridge-switchbot/commit/cf6d7aeb7d9d6a3ea4c26fb6abaa0ea39fb08d8e))
7
+
8
+
9
+
1
10
  # Changelog
2
11
 
3
12
  All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
@@ -81,10 +81,6 @@
81
81
  <button id="discoverBtn" onclick="discoverDevices()" style="margin-bottom: 8px">
82
82
  🔍 Discover
83
83
  </button>
84
- <button id="cancelDiscoverBtn"
85
- style="margin-left: 6px; margin-bottom: 8px; display: none; padding: 6px 10px; font-size: 11px" class="secondary">
86
- Cancel
87
- </button>
88
84
  <div id="discoverStatus" style="margin-bottom: 6px; font-size: 11px"></div>
89
85
  <div id="discoverDevicesFound" style="margin-bottom: 6px; font-size: 11px; display: none"></div>
90
86
  <div id="discoverPhaseProgress" class="discover-phase-progress" style="display: none">
@@ -958,7 +958,6 @@ function setDiscoveryGroupExpanded(groupKey, expanded) {
958
958
  }
959
959
  async function discoverDevices2() {
960
960
  const btn = document.getElementById("discoverBtn");
961
- const cancelBtn = document.getElementById("cancelDiscoverBtn");
962
961
  const status = document.getElementById("discoverStatus");
963
962
  const phaseProgress = document.getElementById("discoverPhaseProgress");
964
963
  const phaseFill = document.getElementById("discoverPhaseFill");
@@ -986,7 +985,6 @@ async function discoverDevices2() {
986
985
  const startedAt = Date.now();
987
986
  let phaseStartedAt = startedAt;
988
987
  let phase = "Preparing discovery...";
989
- let cancelled = false;
990
988
  const setPhase = (nextPhase) => {
991
989
  phase = nextPhase;
992
990
  phaseStartedAt = Date.now();
@@ -1423,31 +1421,8 @@ async function discoverDevices2() {
1423
1421
  devicesFoundDisplay.style.display = "none";
1424
1422
  devicesFoundDisplay.classList.remove("discovery-scanning-pulse");
1425
1423
  }
1426
- if (cancelBtn) {
1427
- cancelBtn.style.display = "inline-block";
1428
- cancelBtn.disabled = false;
1429
- cancelBtn.onclick = () => {
1430
- cancelled = true;
1431
- const totalSeconds = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));
1432
- status.textContent = `Discovery cancelled (${totalSeconds}s total)`;
1433
- if (phaseProgress) {
1434
- phaseProgress.style.display = "none";
1435
- }
1436
- if (devicesFoundDisplay) {
1437
- devicesFoundDisplay.style.display = "none";
1438
- devicesFoundDisplay.classList.remove("discovery-scanning-pulse");
1439
- }
1440
- cancelBtn.style.display = "none";
1441
- btn.disabled = false;
1442
- btn.textContent = "\u{1F50D} Discover Devices";
1443
- hideBusyUi();
1444
- };
1445
- }
1446
1424
  if (bleSettings.bleEnabled) {
1447
1425
  const bleDevicesRaw = await discoverDevices("ble", bleSettings);
1448
- if (cancelled) {
1449
- return;
1450
- }
1451
1426
  discoveredDevices = dedupeById(bleDevicesRaw);
1452
1427
  uiLog.info("BLE discover response:", bleDevicesRaw);
1453
1428
  if (devicesFoundDisplay && bleDevicesRaw.length > 0) {
@@ -1468,9 +1443,6 @@ async function discoverDevices2() {
1468
1443
  renderProgress();
1469
1444
  try {
1470
1445
  const openApiDevicesRaw = await discoverDevices("openapi");
1471
- if (cancelled) {
1472
- return;
1473
- }
1474
1446
  uiLog.info("OpenAPI discover response:", openApiDevicesRaw);
1475
1447
  discoveredDevices = mergeDiscoveredDevices(discoveredDevices, openApiDevicesRaw);
1476
1448
  if (devicesFoundDisplay && discoveredDevices.length > 0) {
@@ -1550,9 +1522,6 @@ async function discoverDevices2() {
1550
1522
  setDiscoveryCache(discoveredDevices);
1551
1523
  updateLastScannedStatus();
1552
1524
  } catch (e) {
1553
- if (cancelled) {
1554
- return;
1555
- }
1556
1525
  uiLog.error("Discovery error:", e);
1557
1526
  status.textContent = `Error: ${e instanceof Error ? e.message : "Discovery failed"}`;
1558
1527
  status.classList.add("error");
@@ -1577,11 +1546,6 @@ async function discoverDevices2() {
1577
1546
  }
1578
1547
  btn.disabled = false;
1579
1548
  btn.textContent = "\u{1F50D} Discover Devices";
1580
- if (cancelBtn) {
1581
- cancelBtn.disabled = false;
1582
- cancelBtn.style.display = "none";
1583
- cancelBtn.onclick = null;
1584
- }
1585
1549
  }
1586
1550
  }
1587
1551
  async function updateDiscoveryView(allDevices, preferences, groupBy, hideAdded, selectedIds) {
@@ -2658,6 +2622,21 @@ __export(render_exports, {
2658
2622
  setDiscoveryPreferences: () => setDiscoveryPreferences,
2659
2623
  sortDevices: () => sortDevices
2660
2624
  });
2625
+ async function copyTextWithFallback(text) {
2626
+ try {
2627
+ await navigator.clipboard.writeText(text);
2628
+ } catch {
2629
+ const textarea = document.createElement("textarea");
2630
+ textarea.value = text;
2631
+ textarea.setAttribute("readonly", "");
2632
+ textarea.style.cssText = "position:fixed;left:-9999px;opacity:0;pointer-events:none";
2633
+ document.body.appendChild(textarea);
2634
+ textarea.select();
2635
+ textarea.setSelectionRange(0, textarea.value.length);
2636
+ document.execCommand("copy");
2637
+ textarea.remove();
2638
+ }
2639
+ }
2661
2640
  function getRssiSignalQuality(rssi) {
2662
2641
  if (!rssi || rssi === 0) {
2663
2642
  return {
@@ -3437,7 +3416,8 @@ function renderDeviceList(list) {
3437
3416
  meta.style.opacity = "0.7";
3438
3417
  meta.style.fontSize = "10px";
3439
3418
  meta.style.fontFamily = "monospace";
3440
- const id = `ID: ${d.deviceId || d.id}`;
3419
+ const deviceIdentifier = d.deviceId || d.id;
3420
+ const id = `ID: ${deviceIdentifier}`;
3441
3421
  const typeText = d.configDeviceType || d.type ? `Type: ${d.configDeviceType || d.type}` : "";
3442
3422
  const connText = d.connectionPreference ? `Conn: ${d.connectionPreference}` : "";
3443
3423
  const roomText = d.room ? `Room: ${d.room}` : "";
@@ -3468,7 +3448,9 @@ function renderDeviceList(list) {
3468
3448
  copyBtn.style.fontSize = "11px";
3469
3449
  copyBtn.addEventListener("click", async () => {
3470
3450
  try {
3471
- await navigator.clipboard.writeText(d.id);
3451
+ if (deviceIdentifier) {
3452
+ await copyTextWithFallback(deviceIdentifier);
3453
+ }
3472
3454
  copyBtn.textContent = "Copied";
3473
3455
  copyBtn.classList.add("success");
3474
3456
  setTimeout(() => {
@@ -3495,8 +3477,8 @@ function renderDeviceList(list) {
3495
3477
  };
3496
3478
  buttons.appendChild(editBtn);
3497
3479
  buttons.appendChild(copyBtn);
3498
- buttons.appendChild(createConnectionTestControls(d));
3499
3480
  buttons.appendChild(deleteBtn);
3481
+ buttons.appendChild(createConnectionTestControls(d));
3500
3482
  li.appendChild(info);
3501
3483
  li.appendChild(buttons);
3502
3484
  ul.appendChild(li);