@switchbot/homebridge-switchbot 0.2.0-alpha.2 → 1.0.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/.github/workflows/nodejs-beta.yml +1 -1
- package/.github/workflows/nodejs.yml +1 -1
- package/.github/workflows/{prerelease.js → prerelease-beta.js} +0 -0
- package/CHANGELOG.md +1 -1
- package/README.md +9 -5
- package/config.schema.json +370 -142
- package/dist/devices/bots.d.ts +18 -34
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +166 -171
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/{bulb.d.ts → colorbulb.d.ts} +12 -19
- package/dist/devices/colorbulb.d.ts.map +1 -0
- package/dist/devices/{bulb.js → colorbulb.js} +34 -32
- package/dist/devices/colorbulb.js.map +1 -0
- package/dist/devices/contact.d.ts +18 -16
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +101 -44
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +17 -51
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +170 -248
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +13 -4
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +81 -8
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/indoorcam.d.ts +6 -13
- package/dist/devices/indoorcam.d.ts.map +1 -1
- package/dist/devices/indoorcam.js.map +1 -1
- package/dist/devices/meters.d.ts +12 -15
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +38 -44
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +17 -15
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +87 -40
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +6 -13
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +10 -10
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +29 -9
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +11 -11
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +3 -3
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +6 -6
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +10 -10
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +3 -3
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +3 -3
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +3 -3
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +7 -5
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +3 -3
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +3 -3
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +3 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +136 -46
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +51 -8
- package/dist/settings.d.ts.map +1 -1
- package/package.json +65 -65
- package/src/devices/bots.ts +188 -193
- package/src/devices/{bulb.ts → colorbulb.ts} +46 -51
- package/src/devices/contact.ts +124 -68
- package/src/devices/curtains.ts +192 -300
- package/src/devices/humidifiers.ts +97 -14
- package/src/devices/indoorcam.ts +10 -20
- package/src/devices/meters.ts +57 -69
- package/src/devices/motion.ts +108 -62
- package/src/devices/plugs.ts +8 -19
- package/src/irdevices/airconditioners.ts +43 -20
- package/src/irdevices/airpurifiers.ts +15 -11
- package/src/irdevices/cameras.ts +5 -3
- package/src/irdevices/fans.ts +22 -16
- package/src/irdevices/lights.ts +5 -3
- package/src/irdevices/others.ts +5 -3
- package/src/irdevices/tvs.ts +13 -7
- package/src/irdevices/vacuumcleaners.ts +5 -3
- package/src/irdevices/waterheaters.ts +5 -3
- package/src/platform.ts +148 -49
- package/src/settings.ts +80 -8
- package/dist/devices/bulb.d.ts.map +0 -1
- package/dist/devices/bulb.js.map +0 -1
package/src/platform.ts
CHANGED
|
@@ -16,17 +16,18 @@ import { Meter } from './devices/meters';
|
|
|
16
16
|
import { Motion } from './devices/motion';
|
|
17
17
|
import { Contact } from './devices/contact';
|
|
18
18
|
import { Curtain } from './devices/curtains';
|
|
19
|
+
import { ColorBulb } from './devices/colorbulb';
|
|
19
20
|
import { IndoorCam } from './devices/indoorcam';
|
|
20
21
|
import { Humidifier } from './devices/humidifiers';
|
|
21
22
|
import { TV } from './irdevices/tvs';
|
|
22
23
|
import { Fan } from './irdevices/fans';
|
|
23
24
|
import { Light } from './irdevices/lights';
|
|
24
|
-
import { Camera } from './irdevices/cameras';
|
|
25
25
|
import { Others } from './irdevices/others';
|
|
26
|
+
import { Camera } from './irdevices/cameras';
|
|
27
|
+
import { AirPurifier } from './irdevices/airpurifiers';
|
|
26
28
|
import { WaterHeater } from './irdevices/waterheaters';
|
|
27
29
|
import { VacuumCleaner } from './irdevices/vacuumcleaners';
|
|
28
30
|
import { AirConditioner } from './irdevices/airconditioners';
|
|
29
|
-
import { AirPurifier } from './irdevices/airpurifiers';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* HomebridgePlatform
|
|
@@ -121,8 +122,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
121
122
|
// Device Config
|
|
122
123
|
if (this.config.options.devices) {
|
|
123
124
|
for (const deviceConfig of this.config.options.devices!) {
|
|
124
|
-
if (!deviceConfig.
|
|
125
|
-
this.log.error('The devices config section is missing the "Type" in the config, Check Your Conifg.');
|
|
125
|
+
if (!deviceConfig.hide_device && !deviceConfig.deviceType) {
|
|
126
|
+
this.log.error('The devices config section is missing the "Device Type" in the config, Check Your Conifg.');
|
|
126
127
|
}
|
|
127
128
|
if (!deviceConfig.deviceId) {
|
|
128
129
|
this.log.error('The devices config section is missing the "Device ID" in the config, Check Your Conifg.');
|
|
@@ -130,6 +131,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
// IR Device Config
|
|
135
|
+
if (this.config.options.irdevices) {
|
|
136
|
+
for (const irDeviceConfig of this.config.options.irdevices!) {
|
|
137
|
+
if (!irDeviceConfig.hide_device && !irDeviceConfig.remoteType) {
|
|
138
|
+
this.log.error('The devices config section is missing the "Device Type" in the config, Check Your Conifg.');
|
|
139
|
+
}
|
|
140
|
+
if (!irDeviceConfig.deviceId) {
|
|
141
|
+
this.log.error('The devices config section is missing the "Device ID" in the config, Check Your Conifg.');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
133
146
|
if (this.config.options!.refreshRate! < 30) {
|
|
134
147
|
throw new Error('Refresh Rate must be above 30 (30 seconds).');
|
|
135
148
|
}
|
|
@@ -162,25 +175,22 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
162
175
|
async discoverDevices() {
|
|
163
176
|
try {
|
|
164
177
|
const devicesAPI: any = (await this.axios.get(DeviceURL)).data;
|
|
165
|
-
|
|
166
178
|
this.deviceListInfo(devicesAPI);
|
|
167
179
|
this.debug(JSON.stringify(devicesAPI));
|
|
168
|
-
this.log.info('Total SwitchBot Devices Found:', devicesAPI.body.deviceList.length);
|
|
169
|
-
this.log.info('Total IR Devices Found:', devicesAPI.body.infraredRemoteList.length);
|
|
170
180
|
|
|
181
|
+
// SwitchBot Devices
|
|
182
|
+
this.log.info('Total SwitchBot Devices Found:', devicesAPI.body.deviceList.length);
|
|
171
183
|
const deviceLists = devicesAPI.body.deviceList;
|
|
172
184
|
if (!this.config.options?.devices) {
|
|
173
|
-
this.debug(`Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
185
|
+
this.debug(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
174
186
|
const devices = deviceLists.map((v: any) => v);
|
|
175
187
|
for (const device of devices) {
|
|
176
188
|
if (device.deviceType) {
|
|
177
189
|
this.createDevice(device);
|
|
178
|
-
} else {
|
|
179
|
-
this.createIRDevice(device);
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
192
|
} else {
|
|
183
|
-
this.debug(`Config Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
193
|
+
this.debug(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
184
194
|
const deviceConfigs = this.config.options?.devices;
|
|
185
195
|
|
|
186
196
|
const mergeBydeviceId = (a1: { deviceId: string; }[], a2: any[]) =>
|
|
@@ -190,11 +200,38 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
190
200
|
}));
|
|
191
201
|
|
|
192
202
|
const devices = mergeBydeviceId(deviceLists, deviceConfigs);
|
|
193
|
-
this.debug(JSON.stringify(devices));
|
|
203
|
+
this.debug(`SwitchBot Devices: ${JSON.stringify(devices)}`);
|
|
194
204
|
for (const device of devices) {
|
|
195
205
|
if (device.deviceType) {
|
|
196
206
|
this.createDevice(device);
|
|
197
|
-
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// IR Devices
|
|
211
|
+
this.log.info('Total IR Devices Found:', devicesAPI.body.infraredRemoteList.length);
|
|
212
|
+
const irDeviceLists = devicesAPI.body.infraredRemoteList;
|
|
213
|
+
if (!this.config.options?.irdevices) {
|
|
214
|
+
this.debug(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
|
|
215
|
+
const devices = irDeviceLists.map((v: any) => v);
|
|
216
|
+
for (const device of devices) {
|
|
217
|
+
if (device.remoteType) {
|
|
218
|
+
this.createIRDevice(device);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
this.debug(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
|
|
223
|
+
const irDeviceConfig = this.config.options?.irdevices;
|
|
224
|
+
|
|
225
|
+
const mergeIRBydeviceId = (a1: { deviceId: string; }[], a2: any[]) =>
|
|
226
|
+
a1.map((itm: { deviceId: string; }) => ({
|
|
227
|
+
...a2.find((item: { deviceId: string; }) => (item.deviceId === itm.deviceId) && item),
|
|
228
|
+
...itm,
|
|
229
|
+
}));
|
|
230
|
+
|
|
231
|
+
const devices = mergeIRBydeviceId(irDeviceLists, irDeviceConfig);
|
|
232
|
+
this.debug(`IR Devices: ${JSON.stringify(devices)}`);
|
|
233
|
+
for (const device of devices) {
|
|
234
|
+
if (device.remoteType) {
|
|
198
235
|
this.createIRDevice(device);
|
|
199
236
|
}
|
|
200
237
|
}
|
|
@@ -241,6 +278,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
241
278
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
242
279
|
this.createPlug(device);
|
|
243
280
|
break;
|
|
281
|
+
case 'Color Bulb':
|
|
282
|
+
this.debug(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
283
|
+
this.createColorBulb(device);
|
|
284
|
+
break;
|
|
244
285
|
case 'IndoorCam':
|
|
245
286
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
246
287
|
this.createIndoorCam(device);
|
|
@@ -382,7 +423,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
382
423
|
if (!device.hide_device && device.enableCloudService) {
|
|
383
424
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
384
425
|
|
|
385
|
-
this.
|
|
426
|
+
this.debug(JSON.stringify(device.bot?.mode));
|
|
386
427
|
if (!device.bot?.mode) {
|
|
387
428
|
this.log.error('You must set your Bot to Press or Switch Mode');
|
|
388
429
|
}
|
|
@@ -405,7 +446,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
405
446
|
// the accessory does not yet exist, so we need to create it
|
|
406
447
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
407
448
|
|
|
408
|
-
this.
|
|
449
|
+
this.debug(JSON.stringify(device.bot?.mode));
|
|
409
450
|
if (!device.bot?.mode) {
|
|
410
451
|
this.log.error('You must set your Bot to Press or Switch Mode');
|
|
411
452
|
}
|
|
@@ -652,9 +693,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
652
693
|
}
|
|
653
694
|
|
|
654
695
|
private isCurtainGrouped(device: device & devicesConfig) {
|
|
696
|
+
this.debug(`deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},`
|
|
697
|
+
+ ` master: ${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group}`);
|
|
698
|
+
|
|
655
699
|
if (device.group && !device.curtain?.disable_group) {
|
|
700
|
+
this.debug(`[Curtain Config] disable_group: ${device.curtain?.disable_group}`);
|
|
656
701
|
return device.master && !device.hide_device && device.enableCloudService;
|
|
657
702
|
} else {
|
|
703
|
+
this.debug(`[Curtain Config] disable_group: ${device.curtain?.disable_group}, UnGrouping ${device.master}`);
|
|
658
704
|
return !device.hide_device && device.enableCloudService;
|
|
659
705
|
}
|
|
660
706
|
}
|
|
@@ -712,6 +758,59 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
712
758
|
}
|
|
713
759
|
}
|
|
714
760
|
|
|
761
|
+
private async createColorBulb(device: device & devicesConfig) {
|
|
762
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
763
|
+
|
|
764
|
+
// see if an accessory with the same uuid has already been registered and restored from
|
|
765
|
+
// the cached devices we stored in the `configureAccessory` method above
|
|
766
|
+
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
767
|
+
|
|
768
|
+
if (existingAccessory) {
|
|
769
|
+
// the accessory already exists
|
|
770
|
+
if (!device.hide_device && device.enableCloudService) {
|
|
771
|
+
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
772
|
+
|
|
773
|
+
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
774
|
+
existingAccessory.context.model = device.deviceType;
|
|
775
|
+
existingAccessory.context.deviceID = device.deviceId;
|
|
776
|
+
existingAccessory.displayName = device.deviceName;
|
|
777
|
+
existingAccessory.context.firmwareRevision = this.version;
|
|
778
|
+
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
779
|
+
this.api.updatePlatformAccessories([existingAccessory]);
|
|
780
|
+
// create the accessory handler for the restored accessory
|
|
781
|
+
// this is imported from `platformAccessory.ts`
|
|
782
|
+
new ColorBulb(this, existingAccessory, device);
|
|
783
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
784
|
+
} else {
|
|
785
|
+
this.unregisterPlatformAccessories(existingAccessory);
|
|
786
|
+
}
|
|
787
|
+
} else if (!device.hide_device && device.enableCloudService) {
|
|
788
|
+
// the accessory does not yet exist, so we need to create it
|
|
789
|
+
this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
790
|
+
|
|
791
|
+
// create a new accessory
|
|
792
|
+
const accessory = new this.api.platformAccessory(device.deviceName, uuid);
|
|
793
|
+
|
|
794
|
+
// store a copy of the device object in the `accessory.context`
|
|
795
|
+
// the `context` property can be used to store any data about the accessory you may need
|
|
796
|
+
accessory.context.device = device;
|
|
797
|
+
accessory.context.model = device.deviceType;
|
|
798
|
+
accessory.context.deviceID = device.deviceId;
|
|
799
|
+
accessory.context.firmwareRevision = this.version;
|
|
800
|
+
await this.connectionTypeExistingAccessory(device, accessory);
|
|
801
|
+
// create the accessory handler for the newly create accessory
|
|
802
|
+
// this is imported from `platformAccessory.ts`
|
|
803
|
+
new ColorBulb(this, accessory, device);
|
|
804
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
805
|
+
|
|
806
|
+
// link the accessory to your platform
|
|
807
|
+
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
808
|
+
this.accessories.push(accessory);
|
|
809
|
+
} else {
|
|
810
|
+
this.device(`Unable to Register new device: ${device.deviceName} ${device.deviceType} - ${device.deviceId}`);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
715
814
|
private async createIndoorCam(device: device & devicesConfig) {
|
|
716
815
|
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
717
816
|
|
|
@@ -780,7 +879,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
780
879
|
existingAccessory.context.deviceID = device.deviceId;
|
|
781
880
|
existingAccessory.displayName = device.deviceName;
|
|
782
881
|
existingAccessory.context.firmwareRevision = this.version;
|
|
783
|
-
|
|
882
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
784
883
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
785
884
|
// create the accessory handler for the restored accessory
|
|
786
885
|
// this is imported from `platformAccessory.ts`
|
|
@@ -799,7 +898,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
799
898
|
accessory.context.model = device.remoteType;
|
|
800
899
|
accessory.context.deviceID = device.deviceId;
|
|
801
900
|
accessory.context.firmwareRevision = this.version;
|
|
802
|
-
|
|
901
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
803
902
|
// create the accessory handler for the newly create accessory
|
|
804
903
|
// this is imported from `platformAccessory.ts`
|
|
805
904
|
new TV(this, accessory, device);
|
|
@@ -835,7 +934,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
835
934
|
existingAccessory.context.deviceID = device.deviceId;
|
|
836
935
|
existingAccessory.displayName = device.deviceName;
|
|
837
936
|
existingAccessory.context.firmwareRevision = this.version;
|
|
838
|
-
|
|
937
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
839
938
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
840
939
|
// create the accessory handler for the restored accessory
|
|
841
940
|
// this is imported from `platformAccessory.ts`
|
|
@@ -857,7 +956,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
857
956
|
accessory.context.model = device.remoteType;
|
|
858
957
|
accessory.context.deviceID = device.deviceId;
|
|
859
958
|
accessory.context.firmwareRevision = this.version;
|
|
860
|
-
|
|
959
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
861
960
|
// create the accessory handler for the newly create accessory
|
|
862
961
|
// this is imported from `platformAccessory.ts`
|
|
863
962
|
new Fan(this, accessory, device);
|
|
@@ -880,7 +979,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
880
979
|
|
|
881
980
|
if (existingAccessory) {
|
|
882
981
|
// the accessory already exists
|
|
883
|
-
if (device.hubDeviceId) {
|
|
982
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
884
983
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
885
984
|
|
|
886
985
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -888,7 +987,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
888
987
|
existingAccessory.context.deviceID = device.deviceId;
|
|
889
988
|
existingAccessory.displayName = device.deviceName;
|
|
890
989
|
existingAccessory.context.firmwareRevision = this.version;
|
|
891
|
-
|
|
990
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
892
991
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
893
992
|
// create the accessory handler for the restored accessory
|
|
894
993
|
// this is imported from `platformAccessory.ts`
|
|
@@ -897,7 +996,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
897
996
|
} else {
|
|
898
997
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
899
998
|
}
|
|
900
|
-
} else if (device.hubDeviceId) {
|
|
999
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
901
1000
|
// the accessory does not yet exist, so we need to create it
|
|
902
1001
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
903
1002
|
|
|
@@ -910,7 +1009,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
910
1009
|
accessory.context.model = device.remoteType;
|
|
911
1010
|
accessory.context.deviceID = device.deviceId;
|
|
912
1011
|
accessory.context.firmwareRevision = this.version;
|
|
913
|
-
|
|
1012
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
914
1013
|
// create the accessory handler for the newly create accessory
|
|
915
1014
|
// this is imported from `platformAccessory.ts`
|
|
916
1015
|
new Light(this, accessory, device);
|
|
@@ -933,7 +1032,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
933
1032
|
|
|
934
1033
|
if (existingAccessory) {
|
|
935
1034
|
// the accessory already exists
|
|
936
|
-
if (device.hubDeviceId) {
|
|
1035
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
937
1036
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
938
1037
|
|
|
939
1038
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -941,7 +1040,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
941
1040
|
existingAccessory.context.deviceID = device.deviceId;
|
|
942
1041
|
existingAccessory.displayName = device.deviceName;
|
|
943
1042
|
existingAccessory.context.firmwareRevision = this.version;
|
|
944
|
-
|
|
1043
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
945
1044
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
946
1045
|
// create the accessory handler for the restored accessory
|
|
947
1046
|
// this is imported from `platformAccessory.ts`
|
|
@@ -950,7 +1049,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
950
1049
|
} else {
|
|
951
1050
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
952
1051
|
}
|
|
953
|
-
} else if (device.hubDeviceId) {
|
|
1052
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
954
1053
|
// the accessory does not yet exist, so we need to create it
|
|
955
1054
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
956
1055
|
|
|
@@ -963,7 +1062,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
963
1062
|
accessory.context.model = device.remoteType;
|
|
964
1063
|
accessory.context.deviceID = device.deviceId;
|
|
965
1064
|
accessory.context.firmwareRevision = this.version;
|
|
966
|
-
|
|
1065
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
967
1066
|
// create the accessory handler for the newly create accessory
|
|
968
1067
|
// this is imported from `platformAccessory.ts`
|
|
969
1068
|
new AirConditioner(this, accessory, device);
|
|
@@ -986,7 +1085,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
986
1085
|
|
|
987
1086
|
if (existingAccessory) {
|
|
988
1087
|
// the accessory already exists
|
|
989
|
-
if (device.hubDeviceId) {
|
|
1088
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
990
1089
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
991
1090
|
|
|
992
1091
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -994,7 +1093,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
994
1093
|
existingAccessory.context.deviceID = device.deviceId;
|
|
995
1094
|
existingAccessory.displayName = device.deviceName;
|
|
996
1095
|
existingAccessory.context.firmwareRevision = this.version;
|
|
997
|
-
|
|
1096
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
998
1097
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
999
1098
|
// create the accessory handler for the restored accessory
|
|
1000
1099
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1003,7 +1102,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1003
1102
|
} else {
|
|
1004
1103
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1005
1104
|
}
|
|
1006
|
-
} else if (device.hubDeviceId) {
|
|
1105
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
1007
1106
|
// the accessory does not yet exist, so we need to create it
|
|
1008
1107
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
1009
1108
|
|
|
@@ -1016,7 +1115,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1016
1115
|
accessory.context.model = device.remoteType;
|
|
1017
1116
|
accessory.context.deviceID = device.deviceId;
|
|
1018
1117
|
accessory.context.firmwareRevision = this.version;
|
|
1019
|
-
|
|
1118
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
1020
1119
|
// create the accessory handler for the newly create accessory
|
|
1021
1120
|
// this is imported from `platformAccessory.ts`
|
|
1022
1121
|
new AirPurifier(this, accessory, device);
|
|
@@ -1039,7 +1138,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1039
1138
|
|
|
1040
1139
|
if (existingAccessory) {
|
|
1041
1140
|
// the accessory already exists
|
|
1042
|
-
if (device.hubDeviceId) {
|
|
1141
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
1043
1142
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1044
1143
|
|
|
1045
1144
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -1047,7 +1146,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1047
1146
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1048
1147
|
existingAccessory.displayName = device.deviceName;
|
|
1049
1148
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1050
|
-
|
|
1149
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
1051
1150
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1052
1151
|
// create the accessory handler for the restored accessory
|
|
1053
1152
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1056,7 +1155,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1056
1155
|
} else {
|
|
1057
1156
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1058
1157
|
}
|
|
1059
|
-
} else if (device.hubDeviceId) {
|
|
1158
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
1060
1159
|
// the accessory does not yet exist, so we need to create it
|
|
1061
1160
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
1062
1161
|
|
|
@@ -1069,7 +1168,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1069
1168
|
accessory.context.model = device.remoteType;
|
|
1070
1169
|
accessory.context.deviceID = device.deviceId;
|
|
1071
1170
|
accessory.context.firmwareRevision = this.version;
|
|
1072
|
-
|
|
1171
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
1073
1172
|
// create the accessory handler for the newly create accessory
|
|
1074
1173
|
// this is imported from `platformAccessory.ts`
|
|
1075
1174
|
new WaterHeater(this, accessory, device);
|
|
@@ -1092,7 +1191,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1092
1191
|
|
|
1093
1192
|
if (existingAccessory) {
|
|
1094
1193
|
// the accessory already exists
|
|
1095
|
-
if (device.hubDeviceId) {
|
|
1194
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
1096
1195
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1097
1196
|
|
|
1098
1197
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -1100,7 +1199,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1100
1199
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1101
1200
|
existingAccessory.displayName = device.deviceName;
|
|
1102
1201
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1103
|
-
|
|
1202
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
1104
1203
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1105
1204
|
// create the accessory handler for the restored accessory
|
|
1106
1205
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1109,7 +1208,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1109
1208
|
} else {
|
|
1110
1209
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1111
1210
|
}
|
|
1112
|
-
} else if (device.hubDeviceId) {
|
|
1211
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
1113
1212
|
// the accessory does not yet exist, so we need to create it
|
|
1114
1213
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
1115
1214
|
|
|
@@ -1122,7 +1221,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1122
1221
|
accessory.context.model = device.remoteType;
|
|
1123
1222
|
accessory.context.deviceID = device.deviceId;
|
|
1124
1223
|
accessory.context.firmwareRevision = this.version;
|
|
1125
|
-
|
|
1224
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
1126
1225
|
// create the accessory handler for the newly create accessory
|
|
1127
1226
|
// this is imported from `platformAccessory.ts`
|
|
1128
1227
|
new VacuumCleaner(this, accessory, device);
|
|
@@ -1145,7 +1244,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1145
1244
|
|
|
1146
1245
|
if (existingAccessory) {
|
|
1147
1246
|
// the accessory already exists
|
|
1148
|
-
if (device.hubDeviceId) {
|
|
1247
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
1149
1248
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1150
1249
|
|
|
1151
1250
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -1153,7 +1252,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1153
1252
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1154
1253
|
existingAccessory.displayName = device.deviceName;
|
|
1155
1254
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1156
|
-
|
|
1255
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
1157
1256
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1158
1257
|
// create the accessory handler for the restored accessory
|
|
1159
1258
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1162,7 +1261,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1162
1261
|
} else {
|
|
1163
1262
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1164
1263
|
}
|
|
1165
|
-
} else if (device.hubDeviceId) {
|
|
1264
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
1166
1265
|
// the accessory does not yet exist, so we need to create it
|
|
1167
1266
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
1168
1267
|
|
|
@@ -1175,7 +1274,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1175
1274
|
accessory.context.model = device.remoteType;
|
|
1176
1275
|
accessory.context.deviceID = device.deviceId;
|
|
1177
1276
|
accessory.context.firmwareRevision = this.version;
|
|
1178
|
-
|
|
1277
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
1179
1278
|
// create the accessory handler for the newly create accessory
|
|
1180
1279
|
// this is imported from `platformAccessory.ts`
|
|
1181
1280
|
new Camera(this, accessory, device);
|
|
@@ -1198,7 +1297,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1198
1297
|
|
|
1199
1298
|
if (existingAccessory) {
|
|
1200
1299
|
// the accessory already exists
|
|
1201
|
-
if (device.hubDeviceId) {
|
|
1300
|
+
if (!device.hide_device && device.hubDeviceId) {
|
|
1202
1301
|
this.log.info(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1203
1302
|
|
|
1204
1303
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -1206,7 +1305,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1206
1305
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1207
1306
|
existingAccessory.displayName = device.deviceName;
|
|
1208
1307
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1209
|
-
|
|
1308
|
+
existingAccessory.context.connectionType = 'OpenAPI';
|
|
1210
1309
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1211
1310
|
// create the accessory handler for the restored accessory
|
|
1212
1311
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1215,7 +1314,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1215
1314
|
} else {
|
|
1216
1315
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1217
1316
|
}
|
|
1218
|
-
} else if (device.hubDeviceId) {
|
|
1317
|
+
} else if (!device.hide_device && device.hubDeviceId) {
|
|
1219
1318
|
// the accessory does not yet exist, so we need to create it
|
|
1220
1319
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
1221
1320
|
|
|
@@ -1228,7 +1327,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1228
1327
|
accessory.context.model = device.remoteType;
|
|
1229
1328
|
accessory.context.deviceID = device.deviceId;
|
|
1230
1329
|
accessory.context.firmwareRevision = this.version;
|
|
1231
|
-
|
|
1330
|
+
accessory.context.connectionType = 'OpenAPI';
|
|
1232
1331
|
// create the accessory handler for the newly create accessory
|
|
1233
1332
|
// this is imported from `platformAccessory.ts`
|
|
1234
1333
|
new Others(this, accessory, device);
|
|
@@ -1243,7 +1342,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1243
1342
|
}
|
|
1244
1343
|
|
|
1245
1344
|
public async connectionTypeNewAccessory(
|
|
1246
|
-
device:
|
|
1345
|
+
device: device & devicesConfig,
|
|
1247
1346
|
accessory: PlatformAccessory) {
|
|
1248
1347
|
if (device.ble) {
|
|
1249
1348
|
accessory.context.connectionType = 'BLE';
|
|
@@ -1253,7 +1352,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1253
1352
|
}
|
|
1254
1353
|
|
|
1255
1354
|
public async connectionTypeExistingAccessory(
|
|
1256
|
-
device:
|
|
1355
|
+
device: device & devicesConfig,
|
|
1257
1356
|
existingAccessory: PlatformAccessory,
|
|
1258
1357
|
) {
|
|
1259
1358
|
if (device.ble) {
|
package/src/settings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformConfig } from 'homebridge';
|
|
1
|
+
import { MacAddress, PlatformConfig } from 'homebridge';
|
|
2
2
|
/**
|
|
3
3
|
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
4
4
|
*/
|
|
@@ -34,20 +34,17 @@ export type options = {
|
|
|
34
34
|
pushRate?: number;
|
|
35
35
|
debug?: string;
|
|
36
36
|
devices?: Array<devicesConfig>;
|
|
37
|
+
irdevices?: Array<irDevicesConfig>;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
export interface devicesConfig extends device
|
|
40
|
-
id: any;
|
|
40
|
+
export interface devicesConfig extends device {
|
|
41
41
|
type?: string;
|
|
42
42
|
deviceId: string;
|
|
43
43
|
bot?: bot;
|
|
44
44
|
meter?: meter;
|
|
45
45
|
humidifier?: humidifier;
|
|
46
46
|
curtain?: curtain;
|
|
47
|
-
|
|
48
|
-
fan?: irfan;
|
|
49
|
-
irair?: irair;
|
|
50
|
-
other?: other;
|
|
47
|
+
colorbulb?: colorbulb;
|
|
51
48
|
ble?: string;
|
|
52
49
|
hide_device?: boolean;
|
|
53
50
|
}
|
|
@@ -60,6 +57,7 @@ export type meter = {
|
|
|
60
57
|
|
|
61
58
|
export type bot = {
|
|
62
59
|
mode?: string;
|
|
60
|
+
deviceType?: string;
|
|
63
61
|
};
|
|
64
62
|
|
|
65
63
|
export type humidifier = {
|
|
@@ -75,10 +73,20 @@ export type curtain = {
|
|
|
75
73
|
set_minStep?: number;
|
|
76
74
|
};
|
|
77
75
|
|
|
78
|
-
export type
|
|
76
|
+
export type colorbulb = {
|
|
79
77
|
set_minStep?: number;
|
|
80
78
|
};
|
|
81
79
|
|
|
80
|
+
export interface irDevicesConfig extends irdevice {
|
|
81
|
+
type?: string;
|
|
82
|
+
deviceId: string;
|
|
83
|
+
irfan?: irfan;
|
|
84
|
+
irair?: irair;
|
|
85
|
+
irtv?: irtv;
|
|
86
|
+
other?: other;
|
|
87
|
+
hide_device?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
export type irfan = {
|
|
83
91
|
swing_mode?: boolean;
|
|
84
92
|
rotation_speed?: boolean;
|
|
@@ -109,6 +117,10 @@ export type irair = {
|
|
|
109
117
|
hide_automode?: boolean;
|
|
110
118
|
};
|
|
111
119
|
|
|
120
|
+
export type irtv = {
|
|
121
|
+
disable_power?: boolean;
|
|
122
|
+
};
|
|
123
|
+
|
|
112
124
|
export type other = {
|
|
113
125
|
deviceType?: string;
|
|
114
126
|
commandOn?: string;
|
|
@@ -228,3 +240,63 @@ export type deviceStatus = {
|
|
|
228
240
|
//only available for Humidifier devices. determines if the water tank empty or not
|
|
229
241
|
lackWater?: boolean;
|
|
230
242
|
};
|
|
243
|
+
|
|
244
|
+
export type ad = {
|
|
245
|
+
serviceData: serviceData;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export type serviceData = {
|
|
249
|
+
//Model of BLE SwitchBot Device
|
|
250
|
+
model: string,
|
|
251
|
+
//Model Name of BLE SwitchBot Device
|
|
252
|
+
modelName: string
|
|
253
|
+
//Mode for Bot either Press or Switch
|
|
254
|
+
mode?: boolean;
|
|
255
|
+
//Bot State
|
|
256
|
+
state?: string;
|
|
257
|
+
//Battery percentage left on Bot, Meter, Motion, Contact, and Curtain
|
|
258
|
+
battery?: number;
|
|
259
|
+
//Humidifier's humidity level percentage
|
|
260
|
+
percentage?: boolean | string;
|
|
261
|
+
//Humidifier's humidity level percentage
|
|
262
|
+
onState?: boolean;
|
|
263
|
+
//Humidifier's AutoMode
|
|
264
|
+
autoMode?: boolean;
|
|
265
|
+
//Meter Temperature Levels
|
|
266
|
+
temperature?: {
|
|
267
|
+
c: number,
|
|
268
|
+
f: number
|
|
269
|
+
};
|
|
270
|
+
// Fahrenheit enabled for Meter
|
|
271
|
+
fahrenheit: boolean;
|
|
272
|
+
// Humidity level for Meter
|
|
273
|
+
humidity?: number,
|
|
274
|
+
//Motion Detected for Contact or Motion Sensors
|
|
275
|
+
movement?: boolean,
|
|
276
|
+
//Motion ((lightLevel == 1) ? 'dark' : ((lightLevel == 2) ? 'bright' : 'unknown'))
|
|
277
|
+
//Contact ((lightLevel == 0) ? 'dark' : 'bright')
|
|
278
|
+
//Curtain (light sensor level (1-10))
|
|
279
|
+
//Light Level
|
|
280
|
+
lightLevel?: number | string;
|
|
281
|
+
//Contact DoorState
|
|
282
|
+
doorState?: number | string;
|
|
283
|
+
//Is Curtain Calibrated
|
|
284
|
+
calibration?: boolean;
|
|
285
|
+
//Current Curtain Positon %
|
|
286
|
+
position?: number;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export type switchbot = {
|
|
290
|
+
discover: (
|
|
291
|
+
arg0:
|
|
292
|
+
{
|
|
293
|
+
duration?: any;
|
|
294
|
+
model: string;
|
|
295
|
+
quick: boolean;
|
|
296
|
+
id?: MacAddress;
|
|
297
|
+
}
|
|
298
|
+
) => Promise<any>;
|
|
299
|
+
wait: (
|
|
300
|
+
arg0: number
|
|
301
|
+
) => any;
|
|
302
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bulb.d.ts","sourceRoot":"","sources":["../../src/devices/bulb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAa,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;GAIG;AACH,qBAAa,IAAI;IAgCb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,SAAS;IACV,MAAM,EAAE,MAAM,GAAG,aAAa;IAhCvC,OAAO,EAAG,OAAO,CAAC;IAGlB,EAAE,EAAG,mBAAmB,CAAC;IACzB,UAAU,EAAG,mBAAmB,CAAC;IACjC,gBAAgB,EAAG,mBAAmB,CAAC;IAGvC,YAAY,EAAE,GAAG,CAAC;IAClB,SAAS,EAAG;QACV,QAAQ,EAAE,CACR,IAAI,EACF;YACE,QAAQ,EAAE,GAAG,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,OAAO,CAAC;YACf,EAAE,EAAE,UAAU,CAAC;SAChB,KACA,OAAO,CAAC,GAAG,CAAC,CAAC;QAClB,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,KACT,GAAG,CAAC;KACV,CAAC;IAGF,oBAAoB,EAAG,OAAO,CAAC;IAC/B,YAAY,MAAC;IACb,WAAW,EAAE,GAAG,CAAC;gBAGE,QAAQ,EAAE,iBAAiB,EACpC,SAAS,EAAE,iBAAiB,EAC7B,MAAM,EAAE,MAAM,GAAG,aAAa;IAyGvC,OAAO,CAAC,OAAO;IASf,WAAW;IAaL,aAAa;IAcnB;;;;;KAKC;IACK,WAAW;IA8BjB,4BAA4B;IAqBrB,QAAQ,CAAC,CAAC,EAAE,GAAG;IAOtB,OAAO,CAAC,UAAU;IA8BlB;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,mBAAmB;IAOhC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAOxC;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,mBAAmB;CAM/C"}
|