@switchbot/homebridge-switchbot 2.1.2-beta.8 → 2.1.2-beta.9
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 +1 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +3 -7
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +3 -2
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +3 -2
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +3 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +3 -4
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +2 -4
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +6 -5
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +3 -14
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +3 -14
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +3 -2
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +3 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +3 -2
- package/dist/device/striplight.js.map +1 -1
- package/dist/platform.d.ts +3 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +50 -27
- package/dist/platform.js.map +1 -1
- package/package.json +2 -2
- package/src/device/bot.ts +3 -7
- package/src/device/ceilinglight.ts +3 -2
- package/src/device/colorbulb.ts +3 -2
- package/src/device/contact.ts +3 -2
- package/src/device/curtain.ts +3 -4
- package/src/device/humidifier.ts +2 -4
- package/src/device/lock.ts +6 -5
- package/src/device/meter.ts +3 -14
- package/src/device/meterplus.ts +3 -14
- package/src/device/motion.ts +3 -2
- package/src/device/plug.ts +3 -2
- package/src/device/striplight.ts +3 -2
- package/src/platform.ts +51 -28
package/src/platform.ts
CHANGED
|
@@ -27,7 +27,8 @@ import fakegato from 'fakegato-history';
|
|
|
27
27
|
import superStringify from 'super-stringify';
|
|
28
28
|
import { readFileSync, writeFileSync } from 'fs';
|
|
29
29
|
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, Service, Characteristic } from 'homebridge';
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
PLATFORM_NAME, PLUGIN_NAME, irdevice, device, SwitchBotPlatformConfig, devicesConfig, DevicePath, HostDomain, irDevicesConfig } from './settings';
|
|
31
32
|
import { IncomingMessage } from 'http';
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -1240,7 +1241,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1240
1241
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1241
1242
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1242
1243
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1243
|
-
existingAccessory.context.connectionType = await this.
|
|
1244
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1244
1245
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1245
1246
|
// create the accessory handler for the restored accessory
|
|
1246
1247
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1262,7 +1263,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1262
1263
|
accessory.context.deviceID = device.deviceId;
|
|
1263
1264
|
accessory.context.firmwareRevision = device.firmware;
|
|
1264
1265
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1265
|
-
accessory.context.connectionType = await this.
|
|
1266
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1266
1267
|
// create the accessory handler for the newly create accessory
|
|
1267
1268
|
// this is imported from `platformAccessory.ts`
|
|
1268
1269
|
new TV(this, accessory, device);
|
|
@@ -1273,7 +1274,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1273
1274
|
* Only one TV can exist per bridge, to bypass this limitation, you should
|
|
1274
1275
|
* publish your TV as an external accessory.
|
|
1275
1276
|
*/
|
|
1276
|
-
this.
|
|
1277
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1277
1278
|
this.accessories.push(accessory);
|
|
1278
1279
|
} else {
|
|
1279
1280
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1297,7 +1298,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1297
1298
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1298
1299
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1299
1300
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1300
|
-
existingAccessory.context.connectionType = await this.
|
|
1301
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1301
1302
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1302
1303
|
// create the accessory handler for the restored accessory
|
|
1303
1304
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1322,14 +1323,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1322
1323
|
accessory.context.deviceID = device.deviceId;
|
|
1323
1324
|
accessory.context.firmwareRevision = device.firmware;
|
|
1324
1325
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1325
|
-
accessory.context.connectionType = await this.
|
|
1326
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1326
1327
|
// create the accessory handler for the newly create accessory
|
|
1327
1328
|
// this is imported from `platformAccessory.ts`
|
|
1328
1329
|
new Fan(this, accessory, device);
|
|
1329
1330
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1330
1331
|
|
|
1331
1332
|
// publish device externally or link the accessory to your platform
|
|
1332
|
-
this.
|
|
1333
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1333
1334
|
this.accessories.push(accessory);
|
|
1334
1335
|
} else {
|
|
1335
1336
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1353,7 +1354,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1353
1354
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1354
1355
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1355
1356
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1356
|
-
existingAccessory.context.connectionType = await this.
|
|
1357
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1357
1358
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1358
1359
|
// create the accessory handler for the restored accessory
|
|
1359
1360
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1378,14 +1379,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1378
1379
|
accessory.context.deviceID = device.deviceId;
|
|
1379
1380
|
accessory.context.firmwareRevision = device.firmware;
|
|
1380
1381
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1381
|
-
accessory.context.connectionType = await this.
|
|
1382
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1382
1383
|
// create the accessory handler for the newly create accessory
|
|
1383
1384
|
// this is imported from `platformAccessory.ts`
|
|
1384
1385
|
new Light(this, accessory, device);
|
|
1385
1386
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1386
1387
|
|
|
1387
1388
|
// publish device externally or link the accessory to your platform
|
|
1388
|
-
this.
|
|
1389
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1389
1390
|
this.accessories.push(accessory);
|
|
1390
1391
|
} else {
|
|
1391
1392
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1409,7 +1410,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1409
1410
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1410
1411
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1411
1412
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1412
|
-
existingAccessory.context.connectionType = await this.
|
|
1413
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1413
1414
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1414
1415
|
// create the accessory handler for the restored accessory
|
|
1415
1416
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1434,14 +1435,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1434
1435
|
accessory.context.deviceID = device.deviceId;
|
|
1435
1436
|
accessory.context.firmwareRevision = device.firmware;
|
|
1436
1437
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1437
|
-
accessory.context.connectionType = await this.
|
|
1438
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1438
1439
|
// create the accessory handler for the newly create accessory
|
|
1439
1440
|
// this is imported from `platformAccessory.ts`
|
|
1440
1441
|
new AirConditioner(this, accessory, device);
|
|
1441
1442
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1442
1443
|
|
|
1443
1444
|
// publish device externally or link the accessory to your platform
|
|
1444
|
-
this.
|
|
1445
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1445
1446
|
this.accessories.push(accessory);
|
|
1446
1447
|
} else {
|
|
1447
1448
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1465,7 +1466,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1465
1466
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1466
1467
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1467
1468
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1468
|
-
existingAccessory.context.connectionType = await this.
|
|
1469
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1469
1470
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1470
1471
|
// create the accessory handler for the restored accessory
|
|
1471
1472
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1490,14 +1491,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1490
1491
|
accessory.context.deviceID = device.deviceId;
|
|
1491
1492
|
accessory.context.firmwareRevision = device.firmware;
|
|
1492
1493
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1493
|
-
accessory.context.connectionType = await this.
|
|
1494
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1494
1495
|
// create the accessory handler for the newly create accessory
|
|
1495
1496
|
// this is imported from `platformAccessory.ts`
|
|
1496
1497
|
new AirPurifier(this, accessory, device);
|
|
1497
1498
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1498
1499
|
|
|
1499
1500
|
// publish device externally or link the accessory to your platform
|
|
1500
|
-
this.
|
|
1501
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1501
1502
|
this.accessories.push(accessory);
|
|
1502
1503
|
} else {
|
|
1503
1504
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1521,7 +1522,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1521
1522
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1522
1523
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1523
1524
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1524
|
-
existingAccessory.context.connectionType = await this.
|
|
1525
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1525
1526
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1526
1527
|
// create the accessory handler for the restored accessory
|
|
1527
1528
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1546,14 +1547,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1546
1547
|
accessory.context.deviceID = device.deviceId;
|
|
1547
1548
|
accessory.context.firmwareRevision = device.firmware;
|
|
1548
1549
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1549
|
-
accessory.context.connectionType = await this.
|
|
1550
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1550
1551
|
// create the accessory handler for the newly create accessory
|
|
1551
1552
|
// this is imported from `platformAccessory.ts`
|
|
1552
1553
|
new WaterHeater(this, accessory, device);
|
|
1553
1554
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1554
1555
|
|
|
1555
1556
|
// publish device externally or link the accessory to your platform
|
|
1556
|
-
this.
|
|
1557
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1557
1558
|
this.accessories.push(accessory);
|
|
1558
1559
|
} else {
|
|
1559
1560
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1577,7 +1578,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1577
1578
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1578
1579
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1579
1580
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1580
|
-
existingAccessory.context.connectionType = await this.
|
|
1581
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1581
1582
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1582
1583
|
// create the accessory handler for the restored accessory
|
|
1583
1584
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1602,14 +1603,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1602
1603
|
accessory.context.deviceID = device.deviceId;
|
|
1603
1604
|
accessory.context.firmwareRevision = device.firmware;
|
|
1604
1605
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1605
|
-
accessory.context.connectionType = await this.
|
|
1606
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1606
1607
|
// create the accessory handler for the newly create accessory
|
|
1607
1608
|
// this is imported from `platformAccessory.ts`
|
|
1608
1609
|
new VacuumCleaner(this, accessory, device);
|
|
1609
1610
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1610
1611
|
|
|
1611
1612
|
// publish device externally or link the accessory to your platform
|
|
1612
|
-
this.
|
|
1613
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1613
1614
|
this.accessories.push(accessory);
|
|
1614
1615
|
} else {
|
|
1615
1616
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1633,7 +1634,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1633
1634
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1634
1635
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1635
1636
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1636
|
-
existingAccessory.context.connectionType = await this.
|
|
1637
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1637
1638
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1638
1639
|
// create the accessory handler for the restored accessory
|
|
1639
1640
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1658,14 +1659,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1658
1659
|
accessory.context.deviceID = device.deviceId;
|
|
1659
1660
|
accessory.context.firmwareRevision = device.firmware;
|
|
1660
1661
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1661
|
-
accessory.context.connectionType = await this.
|
|
1662
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1662
1663
|
// create the accessory handler for the newly create accessory
|
|
1663
1664
|
// this is imported from `platformAccessory.ts`
|
|
1664
1665
|
new Camera(this, accessory, device);
|
|
1665
1666
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1666
1667
|
|
|
1667
1668
|
// publish device externally or link the accessory to your platform
|
|
1668
|
-
this.
|
|
1669
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1669
1670
|
this.accessories.push(accessory);
|
|
1670
1671
|
} else {
|
|
1671
1672
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1689,7 +1690,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1689
1690
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1690
1691
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1691
1692
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1692
|
-
existingAccessory.context.connectionType = await this.
|
|
1693
|
+
existingAccessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1693
1694
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1694
1695
|
// create the accessory handler for the restored accessory
|
|
1695
1696
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1714,14 +1715,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1714
1715
|
accessory.context.deviceID = device.deviceId;
|
|
1715
1716
|
accessory.context.firmwareRevision = device.firmware;
|
|
1716
1717
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1717
|
-
accessory.context.connectionType = await this.
|
|
1718
|
+
accessory.context.connectionType = await this.connectionTypeIR(device);
|
|
1718
1719
|
// create the accessory handler for the newly create accessory
|
|
1719
1720
|
// this is imported from `platformAccessory.ts`
|
|
1720
1721
|
new Others(this, accessory, device);
|
|
1721
1722
|
this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
|
|
1722
1723
|
|
|
1723
1724
|
// publish device externally or link the accessory to your platform
|
|
1724
|
-
this.
|
|
1725
|
+
this.externalOrPlatformIR(device, accessory);
|
|
1725
1726
|
this.accessories.push(accessory);
|
|
1726
1727
|
} else {
|
|
1727
1728
|
this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -1765,6 +1766,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1765
1766
|
return registerCurtain;
|
|
1766
1767
|
}
|
|
1767
1768
|
|
|
1769
|
+
async connectionTypeIR(device: device & irDevicesConfig): Promise<any> {
|
|
1770
|
+
let connectionType: string;
|
|
1771
|
+
if (!device.connectionType && device.remoteType) {
|
|
1772
|
+
connectionType = 'OpenAPI';
|
|
1773
|
+
} else {
|
|
1774
|
+
connectionType = device.connectionType!;
|
|
1775
|
+
}
|
|
1776
|
+
return connectionType;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1768
1779
|
async connectionType(device: device & devicesConfig): Promise<any> {
|
|
1769
1780
|
let connectionType: string;
|
|
1770
1781
|
if (!device.connectionType && this.config.credentials?.token && this.config.credentials.secret) {
|
|
@@ -1829,6 +1840,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1829
1840
|
return registerDevice;
|
|
1830
1841
|
}
|
|
1831
1842
|
|
|
1843
|
+
public async externalOrPlatformIR(device: device & irDevicesConfig, accessory: PlatformAccessory) {
|
|
1844
|
+
if (device.external === undefined && device.remoteType === 'TV') {
|
|
1845
|
+
device.external = true;
|
|
1846
|
+
} else if (device.external) {
|
|
1847
|
+
this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
|
|
1848
|
+
this.externalAccessory(accessory);
|
|
1849
|
+
} else {
|
|
1850
|
+
this.debugLog(`${accessory.displayName} External Accessory Mode: ${device.external}`);
|
|
1851
|
+
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1832
1855
|
public async externalOrPlatform(device: device & devicesConfig, accessory: PlatformAccessory) {
|
|
1833
1856
|
if (device.external) {
|
|
1834
1857
|
this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
|