@switchbot/homebridge-switchbot 3.0.1-beta.2 → 3.0.1-beta.4
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 +14 -0
- package/README.md +13 -12
- package/config.schema.json +22 -16
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +9 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +50 -35
- package/dist/platform.js.map +1 -1
- package/package.json +6 -6
- package/src/device/curtain.ts +9 -1
- package/src/platform.ts +50 -34
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "SwitchBot",
|
|
3
3
|
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
-
"version": "3.0.1-beta.
|
|
4
|
+
"version": "3.0.1-beta.4",
|
|
5
5
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SwitchBot",
|
|
@@ -75,21 +75,21 @@
|
|
|
75
75
|
"fakegato-history": "^0.6.4",
|
|
76
76
|
"homebridge-lib": "^6.7.3",
|
|
77
77
|
"rxjs": "^7.8.1",
|
|
78
|
-
"undici": "^6.
|
|
78
|
+
"undici": "^6.6.0"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
81
|
"node-switchbot": "^2.0.0-beta.0",
|
|
82
82
|
"@abandonware/noble": "^1.9.2-23"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@types/node": "^20.11.
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
87
|
-
"@typescript-eslint/parser": "^6.
|
|
85
|
+
"@types/node": "^20.11.16",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
87
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
88
88
|
"eslint": "^8.56.0",
|
|
89
89
|
"homebridge": "^1.7.0",
|
|
90
90
|
"homebridge-config-ui-x": "4.55.1",
|
|
91
91
|
"nodemon": "^3.0.3",
|
|
92
|
-
"npm-check-updates": "^16.14.
|
|
92
|
+
"npm-check-updates": "^16.14.14",
|
|
93
93
|
"rimraf": "^5.0.5",
|
|
94
94
|
"ts-node": "^10.9.2",
|
|
95
95
|
"typescript": "^5.3.3"
|
package/src/device/curtain.ts
CHANGED
|
@@ -544,10 +544,18 @@ export class Curtain {
|
|
|
544
544
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
545
545
|
this.getCustomBLEAddress(switchbot);
|
|
546
546
|
// Start to monitor advertisement packets
|
|
547
|
+
let model: string;
|
|
548
|
+
switch (this.device.configDeviceType) {
|
|
549
|
+
case 'Curtain3':
|
|
550
|
+
model = '{';
|
|
551
|
+
break;
|
|
552
|
+
default:
|
|
553
|
+
model = 'c';
|
|
554
|
+
}
|
|
547
555
|
if (switchbot !== false) {
|
|
548
556
|
switchbot
|
|
549
557
|
.startScan({
|
|
550
|
-
model:
|
|
558
|
+
model: model,
|
|
551
559
|
id: this.device.bleMac,
|
|
552
560
|
})
|
|
553
561
|
.then(async () => {
|
package/src/platform.ts
CHANGED
|
@@ -663,6 +663,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
663
663
|
this.createContact(device);
|
|
664
664
|
break;
|
|
665
665
|
case 'Curtain':
|
|
666
|
+
case 'Curtain3':
|
|
666
667
|
this.debugLog(`Discovered ${device.deviceType} ${device.deviceName}: ${device.deviceId}`);
|
|
667
668
|
this.createCurtain(device);
|
|
668
669
|
break;
|
|
@@ -2306,16 +2307,15 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2306
2307
|
}
|
|
2307
2308
|
|
|
2308
2309
|
async registerCurtains(device: device & devicesConfig) {
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master
|
|
2317
|
-
|
|
2318
|
-
);
|
|
2310
|
+
switch (device.deviceType) {
|
|
2311
|
+
case 'Curtain':
|
|
2312
|
+
case 'Curtain3':
|
|
2313
|
+
this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds}, master: ` +
|
|
2314
|
+
`${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group}, connectionType: ${device.connectionType}`);
|
|
2315
|
+
break;
|
|
2316
|
+
default:
|
|
2317
|
+
this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master:`
|
|
2318
|
+
+ ` ${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group}, connectionType: ${device.connectionType}`);
|
|
2319
2319
|
}
|
|
2320
2320
|
|
|
2321
2321
|
let registerCurtain: boolean;
|
|
@@ -2376,12 +2376,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2376
2376
|
device.connectionType = await this.connectionType(device);
|
|
2377
2377
|
let registerDevice: boolean;
|
|
2378
2378
|
if (!device.hide_device && device.connectionType === 'BLE/OpenAPI') {
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2379
|
+
switch (device.deviceType) {
|
|
2380
|
+
case 'Curtain':
|
|
2381
|
+
case 'Curtain3':
|
|
2382
|
+
case 'Blind Tilt':
|
|
2383
|
+
registerDevice = await this.registerCurtains(device);
|
|
2384
|
+
this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
|
|
2385
|
+
break;
|
|
2386
|
+
default:
|
|
2387
|
+
registerDevice = true;
|
|
2388
|
+
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2385
2389
|
}
|
|
2386
2390
|
if (registerDevice === true) {
|
|
2387
2391
|
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
@@ -2389,12 +2393,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2389
2393
|
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2390
2394
|
}
|
|
2391
2395
|
} else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && device.connectionType === 'BLE') {
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2396
|
+
switch (device.deviceType) {
|
|
2397
|
+
case 'Curtain':
|
|
2398
|
+
case 'Curtain3':
|
|
2399
|
+
case 'Blind Tilt':
|
|
2400
|
+
registerDevice = await this.registerCurtains(device);
|
|
2401
|
+
this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
|
|
2402
|
+
break;
|
|
2403
|
+
default:
|
|
2404
|
+
registerDevice = true;
|
|
2405
|
+
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2398
2406
|
}
|
|
2399
2407
|
if (registerDevice === true) {
|
|
2400
2408
|
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
@@ -2402,12 +2410,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2402
2410
|
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2403
2411
|
}
|
|
2404
2412
|
} else if (!device.hide_device && device.connectionType === 'OpenAPI') {
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2413
|
+
switch (device.deviceType) {
|
|
2414
|
+
case 'Curtain':
|
|
2415
|
+
case 'Curtain3':
|
|
2416
|
+
case 'Blind Tilt':
|
|
2417
|
+
registerDevice = await this.registerCurtains(device);
|
|
2418
|
+
this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
|
|
2419
|
+
break;
|
|
2420
|
+
default:
|
|
2421
|
+
registerDevice = true;
|
|
2422
|
+
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2411
2423
|
}
|
|
2412
2424
|
if (registerDevice === true) {
|
|
2413
2425
|
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
@@ -2415,12 +2427,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2415
2427
|
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2416
2428
|
}
|
|
2417
2429
|
} else if (!device.hide_device && device.connectionType === 'Disabled') {
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2430
|
+
switch (device.deviceType) {
|
|
2431
|
+
case 'Curtain':
|
|
2432
|
+
case 'Curtain3':
|
|
2433
|
+
case 'Blind Tilt':
|
|
2434
|
+
registerDevice = await this.registerCurtains(device);
|
|
2435
|
+
this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
|
|
2436
|
+
break;
|
|
2437
|
+
default:
|
|
2438
|
+
registerDevice = true;
|
|
2439
|
+
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2424
2440
|
}
|
|
2425
2441
|
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will continue to display in HomeKit`);
|
|
2426
2442
|
} else if (!device.connectionType && !device.hide_device) {
|