@switchbot/homebridge-switchbot 1.6.1 → 1.6.2-beta.0
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/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +11 -8
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +11 -8
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +11 -8
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +11 -8
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +11 -8
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +11 -8
- package/dist/devices/motion.js.map +1 -1
- package/package.json +71 -71
- package/src/devices/bots.ts +10 -5
- package/src/devices/contact.ts +10 -5
- package/src/devices/curtains.ts +10 -5
- package/src/devices/humidifiers.ts +10 -5
- package/src/devices/meters.ts +11 -5
- package/src/devices/motion.ts +10 -5
package/src/devices/meters.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Switchbot from 'node-switchbot';
|
|
2
1
|
import { interval, Subject } from 'rxjs';
|
|
3
2
|
import { skipWhile } from 'rxjs/operators';
|
|
4
3
|
import { SwitchBotPlatform } from '../platform';
|
|
@@ -305,12 +304,19 @@ export class Meter {
|
|
|
305
304
|
}
|
|
306
305
|
|
|
307
306
|
private connectBLE() {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
let Switchbot: any;
|
|
308
|
+
try {
|
|
309
|
+
Switchbot = require('node-switchbot');
|
|
310
|
+
const switchbot = new Switchbot();
|
|
311
|
+
this.device.bleMac = ((this.device.deviceId!.match(/.{1,2}/g))!.join(':')).toLowerCase();
|
|
312
|
+
this.debugLog(`Bot: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
313
|
+
return switchbot;
|
|
314
|
+
} catch (e) {
|
|
315
|
+
Switchbot = false;
|
|
316
|
+
}
|
|
312
317
|
}
|
|
313
318
|
|
|
319
|
+
|
|
314
320
|
private BLErefreshStatus() {
|
|
315
321
|
this.debugLog(`Meter: ${this.accessory.displayName} BLE RefreshStatus`);
|
|
316
322
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
package/src/devices/motion.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Switchbot from 'node-switchbot';
|
|
2
1
|
import { interval, Subject } from 'rxjs';
|
|
3
2
|
import { skipWhile } from 'rxjs/operators';
|
|
4
3
|
import { SwitchBotPlatform } from '../platform';
|
|
@@ -228,10 +227,16 @@ export class Motion {
|
|
|
228
227
|
}
|
|
229
228
|
|
|
230
229
|
private connectBLE() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
let Switchbot: any;
|
|
231
|
+
try {
|
|
232
|
+
Switchbot = require('node-switchbot');
|
|
233
|
+
const switchbot = new Switchbot();
|
|
234
|
+
this.device.bleMac = ((this.device.deviceId!.match(/.{1,2}/g))!.join(':')).toLowerCase();
|
|
235
|
+
this.debugLog(`Bot: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
236
|
+
return switchbot;
|
|
237
|
+
} catch (e) {
|
|
238
|
+
Switchbot = false;
|
|
239
|
+
}
|
|
235
240
|
}
|
|
236
241
|
|
|
237
242
|
private async BLERefreshStatus() {
|