@switchbot/homebridge-switchbot 1.10.2-beta.0 → 1.10.2-beta.4
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 +8 -0
- package/dist/{devices/bots.d.ts → device/bot.d.ts} +1 -1
- package/dist/device/bot.d.ts.map +1 -0
- package/dist/{devices/bots.js → device/bot.js} +1 -1
- package/dist/device/bot.js.map +1 -0
- package/dist/{devices → device}/colorbulb.d.ts +6 -0
- package/dist/device/colorbulb.d.ts.map +1 -0
- package/dist/{devices → device}/colorbulb.js +6 -0
- package/dist/device/colorbulb.js.map +1 -0
- package/dist/{devices → device}/contact.d.ts +0 -0
- package/dist/device/contact.d.ts.map +1 -0
- package/dist/{devices → device}/contact.js +0 -0
- package/dist/device/contact.js.map +1 -0
- package/dist/{devices/curtains.d.ts → device/curtain.d.ts} +1 -1
- package/dist/device/curtain.d.ts.map +1 -0
- package/dist/{devices/curtains.js → device/curtain.js} +7 -10
- package/dist/device/curtain.js.map +1 -0
- package/dist/{devices/humidifiers.d.ts → device/humidifier.d.ts} +1 -1
- package/dist/device/humidifier.d.ts.map +1 -0
- package/dist/{devices/humidifiers.js → device/humidifier.js} +1 -1
- package/dist/device/humidifier.js.map +1 -0
- package/dist/{devices/plugs.d.ts → device/lock.d.ts} +12 -11
- package/dist/device/lock.d.ts.map +1 -0
- package/dist/device/lock.js +299 -0
- package/dist/device/lock.js.map +1 -0
- package/dist/{devices/meters.d.ts → device/meter.d.ts} +2 -1
- package/dist/device/meter.d.ts.map +1 -0
- package/dist/{devices/meters.js → device/meter.js} +15 -2
- package/dist/device/meter.js.map +1 -0
- package/dist/{devices → device}/motion.d.ts +0 -0
- package/dist/device/motion.d.ts.map +1 -0
- package/dist/{devices → device}/motion.js +0 -0
- package/dist/device/motion.js.map +1 -0
- package/dist/device/plug.d.ts +54 -0
- package/dist/device/plug.d.ts.map +1 -0
- package/dist/{devices/plugs.js → device/plug.js} +26 -10
- package/dist/device/plug.js.map +1 -0
- package/dist/{irdevices/airconditioners.d.ts → irdevice/airconditioner.d.ts} +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -0
- package/dist/{irdevices/airconditioners.js → irdevice/airconditioner.js} +1 -1
- package/dist/irdevice/airconditioner.js.map +1 -0
- package/dist/{irdevices/airpurifiers.d.ts → irdevice/airpurifier.d.ts} +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -0
- package/dist/{irdevices/airpurifiers.js → irdevice/airpurifier.js} +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -0
- package/dist/{irdevices/cameras.d.ts → irdevice/camera.d.ts} +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -0
- package/dist/{irdevices/cameras.js → irdevice/camera.js} +1 -1
- package/dist/irdevice/camera.js.map +1 -0
- package/dist/{irdevices/fans.d.ts → irdevice/fan.d.ts} +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -0
- package/dist/{irdevices/fans.js → irdevice/fan.js} +1 -1
- package/dist/irdevice/fan.js.map +1 -0
- package/dist/{irdevices/lights.d.ts → irdevice/light.d.ts} +1 -1
- package/dist/irdevice/light.d.ts.map +1 -0
- package/dist/{irdevices/lights.js → irdevice/light.js} +1 -1
- package/dist/irdevice/light.js.map +1 -0
- package/dist/{irdevices/others.d.ts → irdevice/other.d.ts} +1 -1
- package/dist/irdevice/other.d.ts.map +1 -0
- package/dist/{irdevices/others.js → irdevice/other.js} +1 -1
- package/dist/irdevice/other.js.map +1 -0
- package/dist/{irdevices/tvs.d.ts → irdevice/tv.d.ts} +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -0
- package/dist/{irdevices/tvs.js → irdevice/tv.js} +1 -1
- package/dist/irdevice/tv.js.map +1 -0
- package/dist/{irdevices/vacuumcleaners.d.ts → irdevice/vacuumcleaner.d.ts} +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -0
- package/dist/{irdevices/vacuumcleaners.js → irdevice/vacuumcleaner.js} +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -0
- package/dist/{irdevices/waterheaters.d.ts → irdevice/waterheater.d.ts} +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -0
- package/dist/{irdevices/waterheaters.js → irdevice/waterheater.js} +1 -1
- package/dist/irdevice/waterheater.js.map +1 -0
- package/dist/platform.d.ts +1 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +106 -45
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +7 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/{devices/bots.ts → device/bot.ts} +0 -0
- package/src/{devices → device}/colorbulb.ts +6 -0
- package/src/{devices → device}/contact.ts +0 -0
- package/src/{devices/curtains.ts → device/curtain.ts} +6 -9
- package/src/{devices/humidifiers.ts → device/humidifier.ts} +0 -0
- package/src/device/lock.ts +346 -0
- package/src/{devices/meters.ts → device/meter.ts} +13 -1
- package/src/{devices → device}/motion.ts +0 -0
- package/src/{devices/plugs.ts → device/plug.ts} +28 -13
- package/src/{irdevices/airconditioners.ts → irdevice/airconditioner.ts} +0 -0
- package/src/{irdevices/airpurifiers.ts → irdevice/airpurifier.ts} +0 -0
- package/src/{irdevices/cameras.ts → irdevice/camera.ts} +0 -0
- package/src/{irdevices/fans.ts → irdevice/fan.ts} +0 -0
- package/src/{irdevices/lights.ts → irdevice/light.ts} +0 -0
- package/src/{irdevices/others.ts → irdevice/other.ts} +0 -0
- package/src/{irdevices/tvs.ts → irdevice/tv.ts} +0 -0
- package/src/{irdevices/vacuumcleaners.ts → irdevice/vacuumcleaner.ts} +0 -0
- package/src/{irdevices/waterheaters.ts → irdevice/waterheater.ts} +0 -0
- package/src/platform.ts +82 -17
- package/src/settings.ts +24 -11
- package/dist/devices/bots.d.ts.map +0 -1
- package/dist/devices/bots.js.map +0 -1
- package/dist/devices/colorbulb.d.ts.map +0 -1
- package/dist/devices/colorbulb.js.map +0 -1
- package/dist/devices/contact.d.ts.map +0 -1
- package/dist/devices/contact.js.map +0 -1
- package/dist/devices/curtains.d.ts.map +0 -1
- package/dist/devices/curtains.js.map +0 -1
- package/dist/devices/humidifiers.d.ts.map +0 -1
- package/dist/devices/humidifiers.js.map +0 -1
- package/dist/devices/meters.d.ts.map +0 -1
- package/dist/devices/meters.js.map +0 -1
- package/dist/devices/motion.d.ts.map +0 -1
- package/dist/devices/motion.js.map +0 -1
- package/dist/devices/plugs.d.ts.map +0 -1
- package/dist/devices/plugs.js.map +0 -1
- package/dist/irdevices/airconditioners.d.ts.map +0 -1
- package/dist/irdevices/airconditioners.js.map +0 -1
- package/dist/irdevices/airpurifiers.d.ts.map +0 -1
- package/dist/irdevices/airpurifiers.js.map +0 -1
- package/dist/irdevices/cameras.d.ts.map +0 -1
- package/dist/irdevices/cameras.js.map +0 -1
- package/dist/irdevices/fans.d.ts.map +0 -1
- package/dist/irdevices/fans.js.map +0 -1
- package/dist/irdevices/lights.d.ts.map +0 -1
- package/dist/irdevices/lights.js.map +0 -1
- package/dist/irdevices/others.d.ts.map +0 -1
- package/dist/irdevices/others.js.map +0 -1
- package/dist/irdevices/tvs.d.ts.map +0 -1
- package/dist/irdevices/tvs.js.map +0 -1
- package/dist/irdevices/vacuumcleaners.d.ts.map +0 -1
- package/dist/irdevices/vacuumcleaners.js.map +0 -1
- package/dist/irdevices/waterheaters.d.ts.map +0 -1
- package/dist/irdevices/waterheaters.js.map +0 -1
package/dist/platform.js
CHANGED
|
@@ -4,23 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SwitchBotPlatform = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
7
|
+
const bot_1 = require("./device/bot");
|
|
8
|
+
const plug_1 = require("./device/plug");
|
|
9
|
+
const lock_1 = require("./device/lock");
|
|
10
|
+
const meter_1 = require("./device/meter");
|
|
11
|
+
const motion_1 = require("./device/motion");
|
|
12
|
+
const contact_1 = require("./device/contact");
|
|
13
|
+
const curtain_1 = require("./device/curtain");
|
|
14
|
+
const colorbulb_1 = require("./device/colorbulb");
|
|
15
|
+
const humidifier_1 = require("./device/humidifier");
|
|
16
|
+
const tv_1 = require("./irdevice/tv");
|
|
17
|
+
const fan_1 = require("./irdevice/fan");
|
|
18
|
+
const light_1 = require("./irdevice/light");
|
|
19
|
+
const other_1 = require("./irdevice/other");
|
|
20
|
+
const camera_1 = require("./irdevice/camera");
|
|
21
|
+
const airpurifier_1 = require("./irdevice/airpurifier");
|
|
22
|
+
const waterheater_1 = require("./irdevice/waterheater");
|
|
23
|
+
const vacuumcleaner_1 = require("./irdevice/vacuumcleaner");
|
|
24
|
+
const airconditioner_1 = require("./irdevice/airconditioner");
|
|
24
25
|
const axios_1 = __importDefault(require("axios"));
|
|
25
26
|
const settings_1 = require("./settings");
|
|
26
27
|
/**
|
|
@@ -350,6 +351,8 @@ class SwitchBotPlatform {
|
|
|
350
351
|
this.createBot(device);
|
|
351
352
|
break;
|
|
352
353
|
case 'Meter':
|
|
354
|
+
case 'Meter Plus (US)':
|
|
355
|
+
case 'Meter Plus (JP)':
|
|
353
356
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
354
357
|
this.createMeter(device);
|
|
355
358
|
break;
|
|
@@ -366,10 +369,17 @@ class SwitchBotPlatform {
|
|
|
366
369
|
this.createCurtain(device);
|
|
367
370
|
break;
|
|
368
371
|
case 'Plug':
|
|
372
|
+
case 'Plug Mini (US)':
|
|
373
|
+
case 'Plug Mini (JP)':
|
|
369
374
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
370
375
|
this.createPlug(device);
|
|
371
376
|
break;
|
|
377
|
+
case 'Lock':
|
|
378
|
+
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
379
|
+
this.createLock(device);
|
|
380
|
+
break;
|
|
372
381
|
case 'Color Bulb':
|
|
382
|
+
case 'Strip Light':
|
|
373
383
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
374
384
|
this.createColorBulb(device);
|
|
375
385
|
break;
|
|
@@ -488,7 +498,7 @@ class SwitchBotPlatform {
|
|
|
488
498
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
489
499
|
// create the accessory handler for the restored accessory
|
|
490
500
|
// this is imported from `platformAccessory.ts`
|
|
491
|
-
new
|
|
501
|
+
new humidifier_1.Humidifier(this, existingAccessory, device);
|
|
492
502
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
493
503
|
}
|
|
494
504
|
else {
|
|
@@ -510,7 +520,7 @@ class SwitchBotPlatform {
|
|
|
510
520
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
511
521
|
// create the accessory handler for the newly create accessory
|
|
512
522
|
// this is imported from `platformAccessory.ts`
|
|
513
|
-
new
|
|
523
|
+
new humidifier_1.Humidifier(this, accessory, device);
|
|
514
524
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
515
525
|
// link the accessory to your platform
|
|
516
526
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -540,7 +550,7 @@ class SwitchBotPlatform {
|
|
|
540
550
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
541
551
|
// create the accessory handler for the restored accessory
|
|
542
552
|
// this is imported from `platformAccessory.ts`
|
|
543
|
-
new
|
|
553
|
+
new bot_1.Bot(this, existingAccessory, device);
|
|
544
554
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
545
555
|
}
|
|
546
556
|
else {
|
|
@@ -564,7 +574,7 @@ class SwitchBotPlatform {
|
|
|
564
574
|
// accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
565
575
|
// create the accessory handler for the newly create accessory
|
|
566
576
|
// this is imported from `platformAccessory.ts`
|
|
567
|
-
new
|
|
577
|
+
new bot_1.Bot(this, accessory, device);
|
|
568
578
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
569
579
|
// link the accessory to your platform
|
|
570
580
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -593,7 +603,7 @@ class SwitchBotPlatform {
|
|
|
593
603
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
594
604
|
// create the accessory handler for the restored accessory
|
|
595
605
|
// this is imported from `platformAccessory.ts`
|
|
596
|
-
new
|
|
606
|
+
new meter_1.Meter(this, existingAccessory, device);
|
|
597
607
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
598
608
|
}
|
|
599
609
|
else {
|
|
@@ -615,7 +625,7 @@ class SwitchBotPlatform {
|
|
|
615
625
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
616
626
|
// create the accessory handler for the newly create accessory
|
|
617
627
|
// this is imported from `platformAccessory.ts`
|
|
618
|
-
new
|
|
628
|
+
new meter_1.Meter(this, accessory, device);
|
|
619
629
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
620
630
|
// link the accessory to your platform
|
|
621
631
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -746,7 +756,7 @@ class SwitchBotPlatform {
|
|
|
746
756
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
747
757
|
// create the accessory handler for the restored accessory
|
|
748
758
|
// this is imported from `platformAccessory.ts`
|
|
749
|
-
new
|
|
759
|
+
new curtain_1.Curtain(this, existingAccessory, device);
|
|
750
760
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
751
761
|
}
|
|
752
762
|
else {
|
|
@@ -780,7 +790,7 @@ class SwitchBotPlatform {
|
|
|
780
790
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
781
791
|
// create the accessory handler for the newly create accessory
|
|
782
792
|
// this is imported from `platformAccessory.ts`
|
|
783
|
-
new
|
|
793
|
+
new curtain_1.Curtain(this, accessory, device);
|
|
784
794
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
785
795
|
// link the accessory to your platform
|
|
786
796
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -821,7 +831,58 @@ class SwitchBotPlatform {
|
|
|
821
831
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
822
832
|
// create the accessory handler for the restored accessory
|
|
823
833
|
// this is imported from `platformAccessory.ts`
|
|
824
|
-
new
|
|
834
|
+
new plug_1.Plug(this, existingAccessory, device);
|
|
835
|
+
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
this.unregisterPlatformAccessories(existingAccessory);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
else if (!device.hide_device && device.enableCloudService) {
|
|
842
|
+
// the accessory does not yet exist, so we need to create it
|
|
843
|
+
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
844
|
+
// create a new accessory
|
|
845
|
+
const accessory = new this.api.platformAccessory(device.deviceName, uuid);
|
|
846
|
+
// store a copy of the device object in the `accessory.context`
|
|
847
|
+
// the `context` property can be used to store any data about the accessory you may need
|
|
848
|
+
accessory.context.device = device;
|
|
849
|
+
accessory.context.model = device.deviceType;
|
|
850
|
+
accessory.context.deviceID = device.deviceId;
|
|
851
|
+
accessory.context.firmwareRevision = this.version;
|
|
852
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
853
|
+
await this.connectionTypeNewAccessory(device, accessory);
|
|
854
|
+
// create the accessory handler for the newly create accessory
|
|
855
|
+
// this is imported from `platformAccessory.ts`
|
|
856
|
+
new plug_1.Plug(this, accessory, device);
|
|
857
|
+
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
858
|
+
// link the accessory to your platform
|
|
859
|
+
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
860
|
+
this.accessories.push(accessory);
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
this.debugLog(`Unable to Register new device: ${device.deviceName} ${device.deviceType} - ${device.deviceId}`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
async createLock(device) {
|
|
867
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
868
|
+
// see if an accessory with the same uuid has already been registered and restored from
|
|
869
|
+
// the cached devices we stored in the `configureAccessory` method above
|
|
870
|
+
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
871
|
+
if (existingAccessory) {
|
|
872
|
+
// the accessory already exists
|
|
873
|
+
if (!device.hide_device && device.enableCloudService) {
|
|
874
|
+
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
875
|
+
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
876
|
+
existingAccessory.context.model = device.deviceType;
|
|
877
|
+
existingAccessory.context.deviceID = device.deviceId;
|
|
878
|
+
existingAccessory.displayName = device.deviceName;
|
|
879
|
+
existingAccessory.context.firmwareRevision = this.version;
|
|
880
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
881
|
+
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
882
|
+
this.api.updatePlatformAccessories([existingAccessory]);
|
|
883
|
+
// create the accessory handler for the restored accessory
|
|
884
|
+
// this is imported from `platformAccessory.ts`
|
|
885
|
+
new lock_1.Lock(this, existingAccessory, device);
|
|
825
886
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
|
|
826
887
|
}
|
|
827
888
|
else {
|
|
@@ -843,7 +904,7 @@ class SwitchBotPlatform {
|
|
|
843
904
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
844
905
|
// create the accessory handler for the newly create accessory
|
|
845
906
|
// this is imported from `platformAccessory.ts`
|
|
846
|
-
new
|
|
907
|
+
new lock_1.Lock(this, accessory, device);
|
|
847
908
|
this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
|
|
848
909
|
// link the accessory to your platform
|
|
849
910
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -921,7 +982,7 @@ class SwitchBotPlatform {
|
|
|
921
982
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
922
983
|
// create the accessory handler for the restored accessory
|
|
923
984
|
// this is imported from `platformAccessory.ts`
|
|
924
|
-
new
|
|
985
|
+
new tv_1.TV(this, existingAccessory, device);
|
|
925
986
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
926
987
|
}
|
|
927
988
|
else if (!device.hide_device && device.hubDeviceId) {
|
|
@@ -939,7 +1000,7 @@ class SwitchBotPlatform {
|
|
|
939
1000
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
940
1001
|
// create the accessory handler for the newly create accessory
|
|
941
1002
|
// this is imported from `platformAccessory.ts`
|
|
942
|
-
new
|
|
1003
|
+
new tv_1.TV(this, accessory, device);
|
|
943
1004
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
944
1005
|
/**
|
|
945
1006
|
* Publish as external accessory
|
|
@@ -972,7 +1033,7 @@ class SwitchBotPlatform {
|
|
|
972
1033
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
973
1034
|
// create the accessory handler for the restored accessory
|
|
974
1035
|
// this is imported from `platformAccessory.ts`
|
|
975
|
-
new
|
|
1036
|
+
new fan_1.Fan(this, existingAccessory, device);
|
|
976
1037
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
977
1038
|
}
|
|
978
1039
|
else {
|
|
@@ -994,7 +1055,7 @@ class SwitchBotPlatform {
|
|
|
994
1055
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
995
1056
|
// create the accessory handler for the newly create accessory
|
|
996
1057
|
// this is imported from `platformAccessory.ts`
|
|
997
|
-
new
|
|
1058
|
+
new fan_1.Fan(this, accessory, device);
|
|
998
1059
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
999
1060
|
// link the accessory to your platform
|
|
1000
1061
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1023,7 +1084,7 @@ class SwitchBotPlatform {
|
|
|
1023
1084
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1024
1085
|
// create the accessory handler for the restored accessory
|
|
1025
1086
|
// this is imported from `platformAccessory.ts`
|
|
1026
|
-
new
|
|
1087
|
+
new light_1.Light(this, existingAccessory, device);
|
|
1027
1088
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1028
1089
|
}
|
|
1029
1090
|
else {
|
|
@@ -1045,7 +1106,7 @@ class SwitchBotPlatform {
|
|
|
1045
1106
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1046
1107
|
// create the accessory handler for the newly create accessory
|
|
1047
1108
|
// this is imported from `platformAccessory.ts`
|
|
1048
|
-
new
|
|
1109
|
+
new light_1.Light(this, accessory, device);
|
|
1049
1110
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1050
1111
|
// link the accessory to your platform
|
|
1051
1112
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1074,7 +1135,7 @@ class SwitchBotPlatform {
|
|
|
1074
1135
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1075
1136
|
// create the accessory handler for the restored accessory
|
|
1076
1137
|
// this is imported from `platformAccessory.ts`
|
|
1077
|
-
new
|
|
1138
|
+
new airconditioner_1.AirConditioner(this, existingAccessory, device);
|
|
1078
1139
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1079
1140
|
}
|
|
1080
1141
|
else {
|
|
@@ -1096,7 +1157,7 @@ class SwitchBotPlatform {
|
|
|
1096
1157
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1097
1158
|
// create the accessory handler for the newly create accessory
|
|
1098
1159
|
// this is imported from `platformAccessory.ts`
|
|
1099
|
-
new
|
|
1160
|
+
new airconditioner_1.AirConditioner(this, accessory, device);
|
|
1100
1161
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1101
1162
|
// link the accessory to your platform
|
|
1102
1163
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1125,7 +1186,7 @@ class SwitchBotPlatform {
|
|
|
1125
1186
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1126
1187
|
// create the accessory handler for the restored accessory
|
|
1127
1188
|
// this is imported from `platformAccessory.ts`
|
|
1128
|
-
new
|
|
1189
|
+
new airpurifier_1.AirPurifier(this, existingAccessory, device);
|
|
1129
1190
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1130
1191
|
}
|
|
1131
1192
|
else {
|
|
@@ -1147,7 +1208,7 @@ class SwitchBotPlatform {
|
|
|
1147
1208
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1148
1209
|
// create the accessory handler for the newly create accessory
|
|
1149
1210
|
// this is imported from `platformAccessory.ts`
|
|
1150
|
-
new
|
|
1211
|
+
new airpurifier_1.AirPurifier(this, accessory, device);
|
|
1151
1212
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1152
1213
|
// link the accessory to your platform
|
|
1153
1214
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1176,7 +1237,7 @@ class SwitchBotPlatform {
|
|
|
1176
1237
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1177
1238
|
// create the accessory handler for the restored accessory
|
|
1178
1239
|
// this is imported from `platformAccessory.ts`
|
|
1179
|
-
new
|
|
1240
|
+
new waterheater_1.WaterHeater(this, existingAccessory, device);
|
|
1180
1241
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1181
1242
|
}
|
|
1182
1243
|
else {
|
|
@@ -1198,7 +1259,7 @@ class SwitchBotPlatform {
|
|
|
1198
1259
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1199
1260
|
// create the accessory handler for the newly create accessory
|
|
1200
1261
|
// this is imported from `platformAccessory.ts`
|
|
1201
|
-
new
|
|
1262
|
+
new waterheater_1.WaterHeater(this, accessory, device);
|
|
1202
1263
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1203
1264
|
// link the accessory to your platform
|
|
1204
1265
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1227,7 +1288,7 @@ class SwitchBotPlatform {
|
|
|
1227
1288
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1228
1289
|
// create the accessory handler for the restored accessory
|
|
1229
1290
|
// this is imported from `platformAccessory.ts`
|
|
1230
|
-
new
|
|
1291
|
+
new vacuumcleaner_1.VacuumCleaner(this, existingAccessory, device);
|
|
1231
1292
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1232
1293
|
}
|
|
1233
1294
|
else {
|
|
@@ -1249,7 +1310,7 @@ class SwitchBotPlatform {
|
|
|
1249
1310
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1250
1311
|
// create the accessory handler for the newly create accessory
|
|
1251
1312
|
// this is imported from `platformAccessory.ts`
|
|
1252
|
-
new
|
|
1313
|
+
new vacuumcleaner_1.VacuumCleaner(this, accessory, device);
|
|
1253
1314
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1254
1315
|
// link the accessory to your platform
|
|
1255
1316
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1278,7 +1339,7 @@ class SwitchBotPlatform {
|
|
|
1278
1339
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1279
1340
|
// create the accessory handler for the restored accessory
|
|
1280
1341
|
// this is imported from `platformAccessory.ts`
|
|
1281
|
-
new
|
|
1342
|
+
new camera_1.Camera(this, existingAccessory, device);
|
|
1282
1343
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1283
1344
|
}
|
|
1284
1345
|
else {
|
|
@@ -1300,7 +1361,7 @@ class SwitchBotPlatform {
|
|
|
1300
1361
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1301
1362
|
// create the accessory handler for the newly create accessory
|
|
1302
1363
|
// this is imported from `platformAccessory.ts`
|
|
1303
|
-
new
|
|
1364
|
+
new camera_1.Camera(this, accessory, device);
|
|
1304
1365
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1305
1366
|
// link the accessory to your platform
|
|
1306
1367
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
@@ -1329,7 +1390,7 @@ class SwitchBotPlatform {
|
|
|
1329
1390
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1330
1391
|
// create the accessory handler for the restored accessory
|
|
1331
1392
|
// this is imported from `platformAccessory.ts`
|
|
1332
|
-
new
|
|
1393
|
+
new other_1.Others(this, existingAccessory, device);
|
|
1333
1394
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
|
|
1334
1395
|
}
|
|
1335
1396
|
else {
|
|
@@ -1351,7 +1412,7 @@ class SwitchBotPlatform {
|
|
|
1351
1412
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1352
1413
|
// create the accessory handler for the newly create accessory
|
|
1353
1414
|
// this is imported from `platformAccessory.ts`
|
|
1354
|
-
new
|
|
1415
|
+
new other_1.Others(this, accessory, device);
|
|
1355
1416
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1356
1417
|
// link the accessory to your platform
|
|
1357
1418
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|