@switchbot/homebridge-switchbot 5.2.9-beta.1 → 5.2.9
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/dist/devices/genericDevice.d.ts.map +1 -1
- package/dist/devices/genericDevice.js +528 -118
- package/dist/devices/genericDevice.js.map +1 -1
- package/dist/homebridge-ui/public/js/advanced-settings.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/advanced-settings.js +3 -1
- package/dist/homebridge-ui/public/js/advanced-settings.js.map +1 -1
- package/dist/homebridge-ui/public/js/advanced-settings.ts +3 -1
- package/dist/homebridge-ui/public/js/api.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/api.js +21 -7
- package/dist/homebridge-ui/public/js/api.js.map +1 -1
- package/dist/homebridge-ui/public/js/api.ts +21 -7
- package/dist/homebridge-ui/public/js/app.js +74 -16
- package/dist/homebridge-ui/public/js/app.js.map +2 -2
- package/dist/homebridge-ui/public/js/credentials.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/credentials.js +9 -3
- package/dist/homebridge-ui/public/js/credentials.js.map +1 -1
- package/dist/homebridge-ui/public/js/credentials.ts +9 -3
- package/dist/homebridge-ui/public/js/devices-delete.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/devices-delete.js +6 -2
- package/dist/homebridge-ui/public/js/devices-delete.js.map +1 -1
- package/dist/homebridge-ui/public/js/devices-delete.ts +6 -2
- package/dist/homebridge-ui/public/js/devices.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/devices.js +3 -1
- package/dist/homebridge-ui/public/js/devices.js.map +1 -1
- package/dist/homebridge-ui/public/js/devices.ts +3 -1
- package/dist/homebridge-ui/public/js/discovery.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/discovery.js +89 -25
- package/dist/homebridge-ui/public/js/discovery.js.map +1 -1
- package/dist/homebridge-ui/public/js/discovery.ts +89 -25
- package/dist/homebridge-ui/public/js/modals.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/modals.js +13 -3
- package/dist/homebridge-ui/public/js/modals.js.map +1 -1
- package/dist/homebridge-ui/public/js/modals.ts +13 -3
- package/dist/homebridge-ui/public/js/render.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/render.js +67 -17
- package/dist/homebridge-ui/public/js/render.js.map +1 -1
- package/dist/homebridge-ui/public/js/render.ts +67 -17
- package/dist/homebridge-ui/public/js/toast.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/toast.js +6 -2
- package/dist/homebridge-ui/public/js/toast.js.map +1 -1
- package/dist/homebridge-ui/public/js/toast.ts +6 -2
- package/docs/variables/default.html +1 -1
- package/package.json +9 -9
- package/src/devices/genericDevice.ts +529 -129
- package/src/homebridge-ui/public/js/advanced-settings.ts +3 -1
- package/src/homebridge-ui/public/js/api.ts +21 -7
- package/src/homebridge-ui/public/js/credentials.ts +9 -3
- package/src/homebridge-ui/public/js/devices-delete.ts +6 -2
- package/src/homebridge-ui/public/js/devices.ts +3 -1
- package/src/homebridge-ui/public/js/discovery.ts +89 -25
- package/src/homebridge-ui/public/js/modals.ts +13 -3
- package/src/homebridge-ui/public/js/render.ts +67 -17
- package/src/homebridge-ui/public/js/toast.ts +6 -2
- package/test/client/node-switchbot-commands.spec.ts +44 -8
- package/test/client/switchbot-client-debounce.spec.ts +24 -3
- package/test/client/switchbot-client-discovery.spec.ts +26 -5
- package/test/client/switchbot-client-keys.spec.ts +30 -7
- package/test/client/switchbot-client-openapi.spec.ts +6 -1
- package/test/client/switchbotClient.spec.ts +30 -6
- package/test/device/bot-hap.spec.ts +131 -22
- package/test/device/curtain-ble-position.spec.ts +15 -3
- package/test/device/deviceBase.spec.ts +6 -1
- package/test/device/deviceFactory-edge.spec.ts +12 -2
- package/test/device/deviceFactory.spec.ts +6 -1
- package/test/device/fan-swing.spec.ts +9 -2
- package/test/device/genericDevice-blepoll.spec.ts +17 -3
- package/test/device/getstate-cache.spec.ts +37 -6
- package/test/device/getstate-returns-status.spec.ts +65 -13
- package/test/device/lock-users.spec.ts +24 -7
- package/test/device/matter-descriptors.spec.ts +6 -1
- package/test/device/matter-device-state.spec.ts +6 -1
- package/test/device/meter-battery.spec.ts +86 -14
- package/test/device/meter-co2.spec.ts +65 -10
- package/test/device/model-identities.spec.ts +6 -1
- package/test/device/water-detector-battery.spec.ts +19 -3
- package/test/device/water-detector-leak.spec.ts +6 -1
- package/test/helpers/matter-harness.ts +21 -4
- package/test/platform/accessory-restore.spec.ts +18 -3
- package/test/platform/hap-cache-restart.spec.ts +66 -13
- package/test/platform/matter-childbridge.spec.ts +16 -3
- package/test/platform/matter-integration.spec.ts +6 -1
- package/test/platform/matter-registration.spec.ts +47 -10
- package/test/platform/platform-edge.spec.ts +13 -3
- package/test/platform/platform.integration.spec.ts +16 -3
- package/test/utils/utils.spec.ts +42 -8
- package/.github/npm-version-script-esm.js +0 -103
|
@@ -710,7 +710,9 @@ function mergeDiscoveredDevices(existingDevices, incomingDevices) {
|
|
|
710
710
|
deviceMap.set(d.id, { ...d });
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
const merged = [
|
|
713
|
+
const merged = [
|
|
714
|
+
...deviceMap.values()
|
|
715
|
+
];
|
|
714
716
|
if (merged.length > 0) {
|
|
715
717
|
console.warn("[SwitchBot][Discovery][mergeDiscoveredDevices] Merged device sample:", merged[0]);
|
|
716
718
|
console.warn("[SwitchBot][Discovery][mergeDiscoveredDevices] Total merged devices:", merged.length);
|
|
@@ -719,7 +721,10 @@ function mergeDiscoveredDevices(existingDevices, incomingDevices) {
|
|
|
719
721
|
}
|
|
720
722
|
function setDiscoveryCache(devices) {
|
|
721
723
|
try {
|
|
722
|
-
const payload = {
|
|
724
|
+
const payload = {
|
|
725
|
+
timestamp: Date.now(),
|
|
726
|
+
devices
|
|
727
|
+
};
|
|
723
728
|
localStorage.setItem(DISCOVERY_CACHE_KEY, JSON.stringify(payload));
|
|
724
729
|
} catch (_e) {
|
|
725
730
|
}
|
|
@@ -995,7 +1000,18 @@ async function discoverDevices2() {
|
|
|
995
1000
|
toastError("Discovery UI error: device list container missing. Please reload the page.");
|
|
996
1001
|
return;
|
|
997
1002
|
}
|
|
998
|
-
const spinnerFrames = [
|
|
1003
|
+
const spinnerFrames = [
|
|
1004
|
+
"\u280B",
|
|
1005
|
+
"\u2819",
|
|
1006
|
+
"\u2839",
|
|
1007
|
+
"\u2838",
|
|
1008
|
+
"\u283C",
|
|
1009
|
+
"\u2834",
|
|
1010
|
+
"\u2826",
|
|
1011
|
+
"\u2827",
|
|
1012
|
+
"\u2807",
|
|
1013
|
+
"\u280F"
|
|
1014
|
+
];
|
|
999
1015
|
let spinnerIndex = 0;
|
|
1000
1016
|
const startedAt = Date.now();
|
|
1001
1017
|
let phaseStartedAt = startedAt;
|
|
@@ -1614,13 +1630,23 @@ async function updateDiscoveryView(allDevices, preferences, groupBy, hideAdded,
|
|
|
1614
1630
|
console.warn("[SwitchBot][Discovery] groupedDevices:", groupedDevices);
|
|
1615
1631
|
let orderedGroups = [];
|
|
1616
1632
|
if (groupBy === "hub") {
|
|
1617
|
-
const hubGroups = [
|
|
1633
|
+
const hubGroups = [
|
|
1634
|
+
...groupedDevices.keys()
|
|
1635
|
+
].filter((group) => group !== "No Hub").sort((a, b) => a.localeCompare(b));
|
|
1618
1636
|
orderedGroups = groupedDevices.has("No Hub") ? [...hubGroups, "No Hub"] : hubGroups;
|
|
1619
1637
|
} else if (groupBy === "type") {
|
|
1620
|
-
const typeGroups = [
|
|
1638
|
+
const typeGroups = [
|
|
1639
|
+
...groupedDevices.keys()
|
|
1640
|
+
].filter((group) => group !== "Unknown Type").sort((a, b) => a.localeCompare(b));
|
|
1621
1641
|
orderedGroups = groupedDevices.has("Unknown Type") ? [...typeGroups, "Unknown Type"] : typeGroups;
|
|
1622
1642
|
} else {
|
|
1623
|
-
const groupOrder = [
|
|
1643
|
+
const groupOrder = [
|
|
1644
|
+
"Both",
|
|
1645
|
+
"BLE",
|
|
1646
|
+
"OpenAPI",
|
|
1647
|
+
"IR",
|
|
1648
|
+
"Unknown"
|
|
1649
|
+
];
|
|
1624
1650
|
orderedGroups = groupOrder.filter((group) => groupedDevices.has(group));
|
|
1625
1651
|
}
|
|
1626
1652
|
const container = document.createElement("div");
|
|
@@ -2874,16 +2900,48 @@ function renderDeviceDetailsPanel(device) {
|
|
|
2874
2900
|
}
|
|
2875
2901
|
}
|
|
2876
2902
|
const rows = [
|
|
2877
|
-
{
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
{
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
{
|
|
2903
|
+
{
|
|
2904
|
+
label: "Name",
|
|
2905
|
+
value: String(device?.name || device?.configDeviceName || "N/A")
|
|
2906
|
+
},
|
|
2907
|
+
{
|
|
2908
|
+
label: "Device ID",
|
|
2909
|
+
value: String(device?.id || device?.deviceId || "N/A"),
|
|
2910
|
+
copyable: !!(device?.id || device?.deviceId)
|
|
2911
|
+
},
|
|
2912
|
+
{
|
|
2913
|
+
label: "MAC Address",
|
|
2914
|
+
value: String(device?.address || "N/A"),
|
|
2915
|
+
copyable: !!device?.address
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
label: "Device Type",
|
|
2919
|
+
value: String(device?.type || device?.configDeviceType || "N/A")
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
label: "Model",
|
|
2923
|
+
value: String(device?.model || "N/A")
|
|
2924
|
+
},
|
|
2925
|
+
{
|
|
2926
|
+
label: "Hub ID",
|
|
2927
|
+
value: String(device?.hubDeviceId || "N/A")
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
label: "Battery",
|
|
2931
|
+
value: device?.battery !== void 0 && device?.battery !== null ? `${device.battery}%` : "N/A"
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
label: "Firmware",
|
|
2935
|
+
value: String(device?.version || device?.firmware || "N/A")
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
label: "Cloud Service",
|
|
2939
|
+
value: device?.enabled === false ? "Disabled" : "Enabled"
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
label: "Last Seen",
|
|
2943
|
+
value: formatLastSeen(device?.lastSeen || device?.lastseen || device?.updatedAt)
|
|
2944
|
+
}
|
|
2887
2945
|
];
|
|
2888
2946
|
for (const row of rows) {
|
|
2889
2947
|
const line = document.createElement("div");
|