@switchbot/homebridge-switchbot 1.12.9-beta.12 → 1.12.9-beta.13
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/config.schema.json +1 -1
- package/dist/device/bot.d.ts +3 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +18 -4
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +3 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +18 -5
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +3 -0
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +18 -4
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +18 -4
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +3 -0
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +18 -4
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +3 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -0
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +18 -4
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -0
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +18 -4
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +3 -0
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +18 -4
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +3 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +18 -4
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +3 -0
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +18 -4
- package/dist/device/striplight.js.map +1 -1
- package/package.json +1 -1
- package/src/device/bot.ts +18 -4
- package/src/device/colorbulb.ts +18 -6
- package/src/device/contact.ts +18 -4
- package/src/device/curtain.ts +18 -4
- package/src/device/humidifier.ts +18 -4
- package/src/device/lock.ts +18 -4
- package/src/device/meter.ts +18 -4
- package/src/device/meterplus.ts +18 -4
- package/src/device/motion.ts +18 -4
- package/src/device/plug.ts +18 -4
- package/src/device/striplight.ts +18 -4
package/src/device/motion.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { skipWhile } from 'rxjs/operators';
|
|
|
3
3
|
import { SwitchBotPlatform } from '../platform';
|
|
4
4
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
5
5
|
import { DeviceURL, device, devicesConfig, serviceData, switchbot, deviceStatusResponse, deviceStatus, ad } from '../settings';
|
|
6
|
+
import { Context } from 'vm';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Platform Accessory
|
|
@@ -68,10 +69,8 @@ export class Motion {
|
|
|
68
69
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
69
70
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1101500')
|
|
70
71
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
71
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory
|
|
72
|
-
|
|
73
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(accessory.context.firmwareRevision
|
|
74
|
-
|| device.firmware || this.platform.version);
|
|
72
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
|
|
73
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(this.FirmwareRevision(accessory, device));
|
|
75
74
|
|
|
76
75
|
// get the Battery service if it exists, otherwise create a new Motion service
|
|
77
76
|
// you can create multiple services for each accessory
|
|
@@ -457,6 +456,21 @@ export class Motion {
|
|
|
457
456
|
}
|
|
458
457
|
}
|
|
459
458
|
|
|
459
|
+
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
460
|
+
let FirmwareRevision: string;
|
|
461
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
462
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
463
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
464
|
+
if (accessory.context.FirmwareRevision) {
|
|
465
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
466
|
+
} else if (device.firmware) {
|
|
467
|
+
FirmwareRevision = device.firmware;
|
|
468
|
+
} else {
|
|
469
|
+
FirmwareRevision = this.platform.version;
|
|
470
|
+
}
|
|
471
|
+
return FirmwareRevision;
|
|
472
|
+
}
|
|
473
|
+
|
|
460
474
|
minLux(): number {
|
|
461
475
|
if (this.device.motion?.set_minLux) {
|
|
462
476
|
this.set_minLux = this.device.motion!.set_minLux!;
|
package/src/device/plug.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SwitchBotPlatform } from '../platform';
|
|
|
4
4
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
5
5
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
6
6
|
import { DeviceURL, device, devicesConfig, deviceStatusResponse, payload, deviceStatus } from '../settings';
|
|
7
|
+
import { Context } from 'vm';
|
|
7
8
|
|
|
8
9
|
export class Plug {
|
|
9
10
|
// Services
|
|
@@ -51,10 +52,8 @@ export class Plug {
|
|
|
51
52
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
52
53
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
53
54
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
54
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory
|
|
55
|
-
|
|
56
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(accessory.context.firmwareRevision
|
|
57
|
-
|| device.firmware || this.platform.version);
|
|
55
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
|
|
56
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(this.FirmwareRevision(accessory, device));
|
|
58
57
|
|
|
59
58
|
// get the Outlet service if it exists, otherwise create a new Outlet service
|
|
60
59
|
// you can create multiple services for each accessory
|
|
@@ -319,6 +318,21 @@ export class Plug {
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
|
|
321
|
+
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
322
|
+
let FirmwareRevision: string;
|
|
323
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
324
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
325
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
326
|
+
if (accessory.context.FirmwareRevision) {
|
|
327
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
328
|
+
} else if (device.firmware) {
|
|
329
|
+
FirmwareRevision = device.firmware;
|
|
330
|
+
} else {
|
|
331
|
+
FirmwareRevision = this.platform.version;
|
|
332
|
+
}
|
|
333
|
+
return FirmwareRevision;
|
|
334
|
+
}
|
|
335
|
+
|
|
322
336
|
/**
|
|
323
337
|
* Logging for Device
|
|
324
338
|
*/
|
package/src/device/striplight.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SwitchBotPlatform } from '../platform';
|
|
|
4
4
|
import { debounceTime, skipWhile, tap } from 'rxjs/operators';
|
|
5
5
|
import { Service, PlatformAccessory, CharacteristicValue, ControllerConstructor, Controller, ControllerServiceMap } from 'homebridge';
|
|
6
6
|
import { DeviceURL, device, devicesConfig, switchbot, deviceStatusResponse, payload, hs2rgb, rgb2hs, deviceStatus } from '../settings';
|
|
7
|
+
import { Context } from 'vm';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Platform Accessory
|
|
@@ -79,10 +80,8 @@ export class StripLight {
|
|
|
79
80
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
80
81
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1701100')
|
|
81
82
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
82
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory
|
|
83
|
-
|
|
84
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(accessory.context.firmwareRevision
|
|
85
|
-
|| device.firmware || this.platform.version);
|
|
83
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
|
|
84
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision).updateValue(this.FirmwareRevision(accessory, device));
|
|
86
85
|
|
|
87
86
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
88
87
|
// you can create multiple services for each accessory
|
|
@@ -541,6 +540,21 @@ export class StripLight {
|
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
542
|
|
|
543
|
+
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
544
|
+
let FirmwareRevision: string;
|
|
545
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
546
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
547
|
+
this.debugLog(`Color Bulb: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
548
|
+
if (accessory.context.FirmwareRevision) {
|
|
549
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
550
|
+
} else if (device.firmware) {
|
|
551
|
+
FirmwareRevision = device.firmware;
|
|
552
|
+
} else {
|
|
553
|
+
FirmwareRevision = this.platform.version;
|
|
554
|
+
}
|
|
555
|
+
return FirmwareRevision;
|
|
556
|
+
}
|
|
557
|
+
|
|
544
558
|
minStep(device: device & devicesConfig): number {
|
|
545
559
|
if (device.colorbulb?.set_minStep) {
|
|
546
560
|
this.set_minStep = device.colorbulb?.set_minStep;
|