@switchbot/homebridge-switchbot 2.8.0 → 2.8.1-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/.github/npm-version-script.js +81 -0
- package/dist/device/blindtilt.d.ts +21 -23
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +71 -73
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +11 -15
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +38 -34
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +10 -14
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +33 -23
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +16 -24
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +49 -43
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +16 -24
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +49 -51
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +21 -26
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +49 -47
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +9 -8
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +42 -30
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +8 -10
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +27 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +16 -21
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +35 -26
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -5
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +2 -4
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +15 -21
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +64 -26
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +4 -9
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +8 -16
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +5 -10
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +8 -16
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +4 -8
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +10 -23
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -5
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +2 -4
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +4 -8
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +7 -16
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/fan.d.ts +0 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/tv.d.ts +0 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/settings.d.ts +3 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +2 -2
- package/src/device/blindtilt.ts +96 -95
- package/src/device/bot.ts +54 -54
- package/src/device/ceilinglight.ts +46 -39
- package/src/device/colorbulb.ts +68 -69
- package/src/device/contact.ts +69 -77
- package/src/device/curtain.ts +75 -74
- package/src/device/hub.ts +53 -38
- package/src/device/humidifier.ts +33 -26
- package/src/device/iosensor.ts +53 -48
- package/src/device/lightstrip.ts +4 -10
- package/src/device/lock.ts +84 -49
- package/src/device/meter.ts +13 -25
- package/src/device/meterplus.ts +14 -27
- package/src/device/motion.ts +16 -32
- package/src/device/plug.ts +4 -10
- package/src/device/robotvacuumcleaner.ts +13 -25
- package/src/irdevice/fan.ts +0 -3
- package/src/irdevice/tv.ts +0 -3
- package/src/settings.ts +5 -1
|
@@ -6,30 +6,26 @@ import { interval, Subject } from 'rxjs';
|
|
|
6
6
|
import { SwitchBotPlatform } from '../platform';
|
|
7
7
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
8
8
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
9
|
-
import { device, devicesConfig, deviceStatus, ad, serviceData,
|
|
9
|
+
import { device, devicesConfig, deviceStatus, ad, serviceData, Devices } from '../settings';
|
|
10
10
|
|
|
11
11
|
export class RobotVacuumCleaner {
|
|
12
12
|
// Services
|
|
13
13
|
robotVacuumCleanerService: Service;
|
|
14
|
-
batteryService
|
|
14
|
+
batteryService: Service;
|
|
15
15
|
|
|
16
16
|
// Characteristic Values
|
|
17
17
|
On!: CharacteristicValue;
|
|
18
18
|
Brightness!: CharacteristicValue;
|
|
19
|
-
BatteryLevel
|
|
20
|
-
StatusLowBattery
|
|
19
|
+
BatteryLevel!: CharacteristicValue;
|
|
20
|
+
StatusLowBattery!: CharacteristicValue;
|
|
21
21
|
|
|
22
22
|
// OpenAPI Others
|
|
23
23
|
Version: deviceStatus['version'];
|
|
24
24
|
Battery: deviceStatus['battery'];
|
|
25
25
|
power: deviceStatus['power'];
|
|
26
|
-
deviceStatus!: any; //deviceStatusResponse;
|
|
27
26
|
|
|
28
27
|
// BLE Others
|
|
29
28
|
connected?: boolean;
|
|
30
|
-
switchbot!: switchbot;
|
|
31
|
-
address!: ad['address'];
|
|
32
|
-
serviceData!: serviceData;
|
|
33
29
|
state: serviceData['state'];
|
|
34
30
|
|
|
35
31
|
// Config
|
|
@@ -111,18 +107,12 @@ export class RobotVacuumCleaner {
|
|
|
111
107
|
.onSet(this.BrightnessSet.bind(this));
|
|
112
108
|
|
|
113
109
|
// Battery Service
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.batteryService.
|
|
120
|
-
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
121
|
-
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
122
|
-
}
|
|
123
|
-
this.batteryService.setCharacteristic(this.platform.Characteristic.ChargingState, this.platform.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
124
|
-
} else {
|
|
125
|
-
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Battery Service Not Added`);
|
|
110
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)),
|
|
111
|
+
`${accessory.displayName} Battery`;
|
|
112
|
+
|
|
113
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
114
|
+
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
115
|
+
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
126
116
|
}
|
|
127
117
|
|
|
128
118
|
// Update Homekit
|
|
@@ -253,13 +243,11 @@ export class RobotVacuumCleaner {
|
|
|
253
243
|
})
|
|
254
244
|
.then(async () => {
|
|
255
245
|
// Set an event hander
|
|
256
|
-
switchbot.onadvertisement = async (ad:
|
|
257
|
-
this.address = ad.address;
|
|
246
|
+
switchbot.onadvertisement = async (ad: ad) => {
|
|
258
247
|
this.debugLog(
|
|
259
248
|
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
260
|
-
` BLE Address Found: ${
|
|
249
|
+
` BLE Address Found: ${ad.address}`,
|
|
261
250
|
);
|
|
262
|
-
this.serviceData = ad.serviceData;
|
|
263
251
|
this.state = ad.serviceData.state;
|
|
264
252
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
265
253
|
this.debugLog(
|
|
@@ -268,7 +256,7 @@ export class RobotVacuumCleaner {
|
|
|
268
256
|
`wifiRssi: ${ad.serviceData.wifiRssi}, overload: ${ad.serviceData.overload}, currentPower: ${ad.serviceData.currentPower}`,
|
|
269
257
|
);
|
|
270
258
|
|
|
271
|
-
if (
|
|
259
|
+
if (ad.serviceData) {
|
|
272
260
|
this.connected = true;
|
|
273
261
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.connected}`);
|
|
274
262
|
await this.stopScanning(switchbot);
|
package/src/irdevice/fan.ts
CHANGED
package/src/irdevice/tv.ts
CHANGED
package/src/settings.ts
CHANGED
|
@@ -312,6 +312,10 @@ export type serviceData = {
|
|
|
312
312
|
mode?: boolean;
|
|
313
313
|
//Bot/ColorBulb State
|
|
314
314
|
state?: string | boolean;
|
|
315
|
+
//Lock door open
|
|
316
|
+
door_open?: string;
|
|
317
|
+
//Lock Status
|
|
318
|
+
status?: string;
|
|
315
319
|
//ColorBulb Power
|
|
316
320
|
power?: boolean;
|
|
317
321
|
//ColorBulb R
|
|
@@ -342,7 +346,7 @@ export type serviceData = {
|
|
|
342
346
|
//Contact ((lightLevel == 0) ? 'dark' : 'bright')
|
|
343
347
|
//Curtain (light sensor level (1-10))
|
|
344
348
|
//Light Level
|
|
345
|
-
lightLevel?: number | string;
|
|
349
|
+
lightLevel?: number | string | boolean;
|
|
346
350
|
//Contact DoorState
|
|
347
351
|
doorState?: number | string;
|
|
348
352
|
//Is Curtain Calibrated
|