@switchbot/homebridge-switchbot 3.6.1-beta.0 → 3.6.1-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 +11 -0
- package/config.schema.json +11 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +36 -18
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -2
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +186 -396
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +36 -19
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +36 -19
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +36 -19
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +37 -18
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.js +2 -2
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +36 -19
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +36 -17
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +36 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +36 -17
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +36 -17
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +37 -18
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +36 -17
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +36 -17
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +36 -17
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +37 -18
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +36 -17
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +36 -17
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +186 -228
- package/dist/irdevice/other.js.map +1 -1
- package/dist/platform.d.ts +4 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +32 -0
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +33 -18
- package/src/device/bot.ts +179 -406
- package/src/device/ceilinglight.ts +33 -20
- package/src/device/colorbulb.ts +33 -20
- package/src/device/contact.ts +33 -20
- package/src/device/curtain.ts +34 -18
- package/src/device/device.ts +2 -2
- package/src/device/fan.ts +33 -20
- package/src/device/hub.ts +33 -17
- package/src/device/humidifier.ts +33 -17
- package/src/device/iosensor.ts +33 -17
- package/src/device/lightstrip.ts +33 -17
- package/src/device/lock.ts +34 -18
- package/src/device/meter.ts +33 -17
- package/src/device/meterplus.ts +33 -17
- package/src/device/motion.ts +33 -17
- package/src/device/plug.ts +34 -18
- package/src/device/robotvacuumcleaner.ts +33 -17
- package/src/device/waterdetector.ts +33 -17
- package/src/irdevice/other.ts +214 -283
- package/src/platform.ts +30 -0
- package/src/settings.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "SwitchBot",
|
|
3
3
|
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
-
"version": "3.6.1-beta.
|
|
4
|
+
"version": "3.6.1-beta.2",
|
|
5
5
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SwitchBot",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"engineStrict": true,
|
|
28
28
|
"engines": {
|
|
29
|
-
"homebridge": "^1.8.
|
|
29
|
+
"homebridge": "^1.8.4-beta.21",
|
|
30
30
|
"node": "^18 || ^20 || ^22"
|
|
31
31
|
},
|
|
32
32
|
"main": "dist/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@types/node": "^20.14.10",
|
|
95
95
|
"eslint": "^9.6.0",
|
|
96
96
|
"globals": "^15.8.0",
|
|
97
|
-
"homebridge": "^1.8.
|
|
97
|
+
"homebridge": "^1.8.4-beta.21",
|
|
98
98
|
"homebridge-config-ui-x": "4.56.4",
|
|
99
99
|
"nodemon": "^3.1.4",
|
|
100
100
|
"npm-check-updates": "^16.14.20",
|
package/src/device/blindtilt.ts
CHANGED
|
@@ -381,7 +381,7 @@ export class BlindTilt extends deviceBase {
|
|
|
381
381
|
async refreshStatus(): Promise<void> {
|
|
382
382
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
383
383
|
await this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`);
|
|
384
|
-
} else if (this.BLE) {
|
|
384
|
+
} else if (this.BLE || this.config.options?.BLE) {
|
|
385
385
|
await this.BLERefreshStatus();
|
|
386
386
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
387
387
|
await this.openAPIRefreshStatus();
|
|
@@ -392,26 +392,41 @@ export class BlindTilt extends deviceBase {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
async BLERefreshStatus(): Promise<void> {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
// Start to monitor advertisement packets
|
|
404
|
-
const serviceData = await this.monitorAdvertisementPackets(switchbot) as blindTiltServiceData;
|
|
405
|
-
// Update HomeKit
|
|
406
|
-
if (serviceData.model === SwitchBotBLEModel.BlindTilt && serviceData.modelName === SwitchBotBLEModelName.BlindTilt) {
|
|
407
|
-
this.serviceData = serviceData;
|
|
395
|
+
if (this.config.options?.BLE) {
|
|
396
|
+
await this.debugLog('is listening to Platform BLE.');
|
|
397
|
+
this.device.bleMac = this.device.deviceId!.match(/.{1,2}/g)!.join(':').toLowerCase();
|
|
398
|
+
await this.debugLog(`bleMac: ${this.device.bleMac}`);
|
|
399
|
+
this.platform.bleEventHandler[this.device.bleMac] = async (context: blindTiltServiceData) => {
|
|
400
|
+
try {
|
|
401
|
+
await this.debugLog(`received BLE: ${JSON.stringify(context)}`);
|
|
402
|
+
this.serviceData = context;
|
|
408
403
|
await this.BLEparseStatus();
|
|
409
404
|
await this.updateHomeKitCharacteristics();
|
|
410
|
-
}
|
|
411
|
-
await this.errorLog(`failed to
|
|
412
|
-
await this.BLERefreshConnection(switchbot);
|
|
405
|
+
} catch (e: any) {
|
|
406
|
+
await this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e}`);
|
|
413
407
|
}
|
|
414
|
-
}
|
|
408
|
+
};
|
|
409
|
+
} else {
|
|
410
|
+
await this.debugLog('is using Device BLE Scanning.');
|
|
411
|
+
const switchbot = await this.switchbotBLE();
|
|
412
|
+
if (switchbot === undefined) {
|
|
413
|
+
await this.BLERefreshConnection(switchbot);
|
|
414
|
+
} else {
|
|
415
|
+
// Start to monitor advertisement packets
|
|
416
|
+
(async () => {
|
|
417
|
+
// Start to monitor advertisement packets
|
|
418
|
+
const serviceData = await this.monitorAdvertisementPackets(switchbot) as blindTiltServiceData;
|
|
419
|
+
// Update HomeKit
|
|
420
|
+
if (serviceData.model === SwitchBotBLEModel.BlindTilt && serviceData.modelName === SwitchBotBLEModelName.BlindTilt) {
|
|
421
|
+
this.serviceData = serviceData;
|
|
422
|
+
await this.BLEparseStatus();
|
|
423
|
+
await this.updateHomeKitCharacteristics();
|
|
424
|
+
} else {
|
|
425
|
+
await this.errorLog(`failed to get serviceData, serviceData: ${serviceData}`);
|
|
426
|
+
await this.BLERefreshConnection(switchbot);
|
|
427
|
+
}
|
|
428
|
+
})();
|
|
429
|
+
}
|
|
415
430
|
}
|
|
416
431
|
}
|
|
417
432
|
|