@switchbot/homebridge-switchbot 2.8.1-beta.2 → 2.8.1-beta.21
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/config.schema.json +3 -3
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +37 -23
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +26 -10
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +78 -29
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +78 -29
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +22 -19
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +36 -20
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +3 -3
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +205 -172
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +66 -28
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +21 -11
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +63 -25
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +35 -19
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +2 -2
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +41 -31
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +23 -13
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +21 -16
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +32 -16
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +48 -21
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +15 -9
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +15 -9
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +15 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +15 -9
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +16 -10
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +15 -4
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +15 -9
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +15 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +15 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +48 -20
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +35 -25
- package/src/device/bot.ts +25 -10
- package/src/device/ceilinglight.ts +73 -30
- package/src/device/colorbulb.ts +73 -30
- package/src/device/contact.ts +21 -20
- package/src/device/curtain.ts +34 -21
- package/src/device/hub.ts +211 -188
- package/src/device/humidifier.ts +62 -29
- package/src/device/iosensor.ts +20 -11
- package/src/device/lightstrip.ts +59 -26
- package/src/device/lock.ts +33 -20
- package/src/device/meter.ts +42 -34
- package/src/device/meterplus.ts +22 -13
- package/src/device/motion.ts +20 -17
- package/src/device/plug.ts +30 -17
- package/src/device/robotvacuumcleaner.ts +45 -22
- package/src/irdevice/airconditioner.ts +14 -10
- package/src/irdevice/airpurifier.ts +14 -10
- package/src/irdevice/camera.ts +14 -10
- package/src/irdevice/fan.ts +14 -10
- package/src/irdevice/light.ts +15 -11
- package/src/irdevice/other.ts +14 -4
- package/src/irdevice/tv.ts +14 -10
- package/src/irdevice/vacuumcleaner.ts +14 -10
- package/src/irdevice/waterheater.ts +14 -10
- package/src/platform.ts +50 -26
|
@@ -77,12 +77,6 @@ export class RobotVacuumCleaner {
|
|
|
77
77
|
(this.robotVacuumCleanerService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
|
|
78
78
|
`${device.deviceName} ${device.deviceType}`;
|
|
79
79
|
|
|
80
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
81
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
82
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
83
|
-
|
|
84
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
85
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
86
80
|
this.robotVacuumCleanerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
87
81
|
if (!this.robotVacuumCleanerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
88
82
|
this.robotVacuumCleanerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -293,16 +287,25 @@ export class RobotVacuumCleaner {
|
|
|
293
287
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
294
288
|
headers: this.platform.generateHeaders(),
|
|
295
289
|
});
|
|
290
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
291
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
292
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
296
293
|
const deviceStatus: any = await body.json();
|
|
297
|
-
this.
|
|
298
|
-
this.
|
|
299
|
-
this.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
294
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
295
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
296
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
297
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
298
|
+
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
299
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
300
|
+
this.OpenAPI_On = deviceStatus.body.power;
|
|
301
|
+
this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
|
|
302
|
+
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
303
|
+
this.openAPIparseStatus();
|
|
304
|
+
this.updateHomeKitCharacteristics();
|
|
305
|
+
} else {
|
|
306
|
+
this.statusCode(statusCode);
|
|
307
|
+
this.statusCode(deviceStatus.statusCode);
|
|
308
|
+
}
|
|
306
309
|
} catch (e: any) {
|
|
307
310
|
this.apiError(e);
|
|
308
311
|
this.errorLog(
|
|
@@ -412,10 +415,20 @@ export class RobotVacuumCleaner {
|
|
|
412
415
|
method: 'POST',
|
|
413
416
|
headers: this.platform.generateHeaders(),
|
|
414
417
|
});
|
|
418
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
419
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
420
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
415
421
|
const deviceStatus: any = await body.json();
|
|
416
|
-
this.
|
|
417
|
-
this.
|
|
418
|
-
this.
|
|
422
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
423
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
424
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
425
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
426
|
+
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
427
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
428
|
+
} else {
|
|
429
|
+
this.statusCode(statusCode);
|
|
430
|
+
this.statusCode(deviceStatus.statusCode);
|
|
431
|
+
}
|
|
419
432
|
} catch (e: any) {
|
|
420
433
|
this.apiError(e);
|
|
421
434
|
this.errorLog(
|
|
@@ -441,10 +454,20 @@ export class RobotVacuumCleaner {
|
|
|
441
454
|
method: 'POST',
|
|
442
455
|
headers: this.platform.generateHeaders(),
|
|
443
456
|
});
|
|
457
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
458
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
459
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
444
460
|
const deviceStatus: any = await body.json();
|
|
445
|
-
this.
|
|
446
|
-
this.
|
|
447
|
-
this.
|
|
461
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
462
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
463
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
464
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
465
|
+
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
466
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
467
|
+
} else {
|
|
468
|
+
this.statusCode(statusCode);
|
|
469
|
+
this.statusCode(deviceStatus.statusCode);
|
|
470
|
+
}
|
|
448
471
|
} catch (e: any) {
|
|
449
472
|
this.apiError(e);
|
|
450
473
|
this.errorLog(
|
|
@@ -566,7 +589,7 @@ export class RobotVacuumCleaner {
|
|
|
566
589
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
567
590
|
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
568
591
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
569
|
-
+ `updateCharacteristic
|
|
592
|
+
+ `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
570
593
|
}
|
|
571
594
|
}
|
|
572
595
|
|
|
@@ -71,12 +71,6 @@ export class AirConditioner {
|
|
|
71
71
|
(this.coolerService = accessory.getService(this.platform.Service.HeaterCooler) || accessory.addService(this.platform.Service.HeaterCooler)),
|
|
72
72
|
`${accessory.displayName} ${device.remoteType}`;
|
|
73
73
|
|
|
74
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
75
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
76
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
77
|
-
|
|
78
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
79
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
80
74
|
this.coolerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
81
75
|
if (!this.coolerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
82
76
|
this.coolerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -262,11 +256,21 @@ export class AirConditioner {
|
|
|
262
256
|
method: 'POST',
|
|
263
257
|
headers: this.platform.generateHeaders(),
|
|
264
258
|
});
|
|
259
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
260
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
261
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
265
262
|
const deviceStatus: any = await body.json();
|
|
266
|
-
this.
|
|
267
|
-
this.
|
|
268
|
-
this.
|
|
269
|
-
|
|
263
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
264
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
265
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
266
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
267
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
268
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
269
|
+
this.updateHomeKitCharacteristics();
|
|
270
|
+
} else {
|
|
271
|
+
this.statusCode(statusCode);
|
|
272
|
+
this.statusCode(deviceStatus.statusCode);
|
|
273
|
+
}
|
|
270
274
|
} catch (e: any) {
|
|
271
275
|
this.apiError(e);
|
|
272
276
|
this.errorLog(
|
|
@@ -65,12 +65,6 @@ export class AirPurifier {
|
|
|
65
65
|
(this.airPurifierService = accessory.getService(this.platform.Service.AirPurifier) || accessory.addService(this.platform.Service.AirPurifier)),
|
|
66
66
|
`${accessory.displayName} Air Purifier`;
|
|
67
67
|
|
|
68
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
69
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
70
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
71
|
-
|
|
72
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
73
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
74
68
|
this.airPurifierService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
75
69
|
if (!this.airPurifierService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
76
70
|
this.airPurifierService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -218,11 +212,21 @@ export class AirPurifier {
|
|
|
218
212
|
method: 'POST',
|
|
219
213
|
headers: this.platform.generateHeaders(),
|
|
220
214
|
});
|
|
215
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
216
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
217
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
221
218
|
const deviceStatus: any = await body.json();
|
|
222
|
-
this.
|
|
223
|
-
this.
|
|
224
|
-
this.
|
|
225
|
-
|
|
219
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
220
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
221
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
222
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
223
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
224
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
225
|
+
this.updateHomeKitCharacteristics();
|
|
226
|
+
} else {
|
|
227
|
+
this.statusCode(statusCode);
|
|
228
|
+
this.statusCode(deviceStatus.statusCode);
|
|
229
|
+
}
|
|
226
230
|
} catch (e: any) {
|
|
227
231
|
this.apiError(e);
|
|
228
232
|
this.errorLog(
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -47,12 +47,6 @@ export class Camera {
|
|
|
47
47
|
(this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
|
|
48
48
|
`${accessory.displayName} Camera`;
|
|
49
49
|
|
|
50
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
51
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
52
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
53
|
-
|
|
54
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
55
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
56
50
|
this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
57
51
|
if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
58
52
|
this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -123,11 +117,21 @@ export class Camera {
|
|
|
123
117
|
method: 'POST',
|
|
124
118
|
headers: this.platform.generateHeaders(),
|
|
125
119
|
});
|
|
120
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
121
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
122
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
126
123
|
const deviceStatus: any = await body.json();
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
129
|
-
this.
|
|
130
|
-
|
|
124
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
125
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
126
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
127
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
128
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
129
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
130
|
+
this.updateHomeKitCharacteristics();
|
|
131
|
+
} else {
|
|
132
|
+
this.statusCode(statusCode);
|
|
133
|
+
this.statusCode(deviceStatus.statusCode);
|
|
134
|
+
}
|
|
131
135
|
} catch (e: any) {
|
|
132
136
|
this.apiError(e);
|
|
133
137
|
this.errorLog(
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -54,12 +54,6 @@ export class Fan {
|
|
|
54
54
|
(this.fanService = accessory.getService(this.platform.Service.Fanv2) || accessory.addService(this.platform.Service.Fanv2)),
|
|
55
55
|
`${accessory.displayName} Fan`;
|
|
56
56
|
|
|
57
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
58
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
59
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
60
|
-
|
|
61
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
62
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
63
57
|
this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
64
58
|
if (!this.fanService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
65
59
|
this.fanService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -240,11 +234,21 @@ export class Fan {
|
|
|
240
234
|
method: 'POST',
|
|
241
235
|
headers: this.platform.generateHeaders(),
|
|
242
236
|
});
|
|
237
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
238
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
239
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
243
240
|
const deviceStatus: any = await body.json();
|
|
244
|
-
this.
|
|
245
|
-
this.
|
|
246
|
-
this.
|
|
247
|
-
|
|
241
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
242
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
243
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
244
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
245
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
246
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
247
|
+
this.updateHomeKitCharacteristics();
|
|
248
|
+
} else {
|
|
249
|
+
this.statusCode(statusCode);
|
|
250
|
+
this.statusCode(deviceStatus.statusCode);
|
|
251
|
+
}
|
|
248
252
|
} catch (e: any) {
|
|
249
253
|
this.apiError(e);
|
|
250
254
|
this.errorLog(
|
package/src/irdevice/light.ts
CHANGED
|
@@ -47,12 +47,6 @@ export class Light {
|
|
|
47
47
|
(this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
|
|
48
48
|
`${accessory.displayName} ${device.remoteType}`;
|
|
49
49
|
|
|
50
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
51
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
52
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
53
|
-
|
|
54
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
55
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
56
50
|
this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
57
51
|
if (!this.lightBulbService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
58
52
|
this.lightBulbService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -147,12 +141,22 @@ export class Light {
|
|
|
147
141
|
method: 'POST',
|
|
148
142
|
headers: this.platform.generateHeaders(),
|
|
149
143
|
});
|
|
144
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
145
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
146
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
150
147
|
const deviceStatus: any = await body.json();
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
149
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
150
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
151
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
152
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
153
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
154
|
+
this.accessory.context.On = this.On;
|
|
155
|
+
this.updateHomeKitCharacteristics();
|
|
156
|
+
} else {
|
|
157
|
+
this.statusCode(statusCode);
|
|
158
|
+
this.statusCode(deviceStatus.statusCode);
|
|
159
|
+
}
|
|
156
160
|
} catch (e: any) {
|
|
157
161
|
this.apiError(e);
|
|
158
162
|
this.errorLog(
|
package/src/irdevice/other.ts
CHANGED
|
@@ -142,11 +142,21 @@ export class Others {
|
|
|
142
142
|
method: 'POST',
|
|
143
143
|
headers: this.platform.generateHeaders(),
|
|
144
144
|
});
|
|
145
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
146
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
147
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
145
148
|
const deviceStatus: any = await body.json();
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
149
|
-
|
|
149
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
150
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
151
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
152
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
153
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
154
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
155
|
+
this.updateHomeKitCharacteristics();
|
|
156
|
+
} else {
|
|
157
|
+
this.statusCode(statusCode);
|
|
158
|
+
this.statusCode(deviceStatus.statusCode);
|
|
159
|
+
}
|
|
150
160
|
} catch (e: any) {
|
|
151
161
|
this.apiError(e);
|
|
152
162
|
this.errorLog(
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -78,12 +78,6 @@ export class TV {
|
|
|
78
78
|
`${accessory.displayName} ${device.remoteType}`;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
82
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
83
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
84
|
-
|
|
85
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
86
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
87
81
|
this.tvService.getCharacteristic(this.platform.Characteristic.ConfiguredName);
|
|
88
82
|
|
|
89
83
|
// set sleep discovery characteristic
|
|
@@ -372,11 +366,21 @@ export class TV {
|
|
|
372
366
|
method: 'POST',
|
|
373
367
|
headers: this.platform.generateHeaders(),
|
|
374
368
|
});
|
|
369
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
370
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
371
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
375
372
|
const deviceStatus: any = await body.json();
|
|
376
|
-
this.
|
|
377
|
-
this.
|
|
378
|
-
this.
|
|
379
|
-
|
|
373
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
374
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
375
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
376
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
377
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
378
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
379
|
+
this.updateHomeKitCharacteristics();
|
|
380
|
+
} else {
|
|
381
|
+
this.statusCode(statusCode);
|
|
382
|
+
this.statusCode(deviceStatus.statusCode);
|
|
383
|
+
}
|
|
380
384
|
} catch (e: any) {
|
|
381
385
|
this.apiError(e);
|
|
382
386
|
this.errorLog(
|
|
@@ -47,12 +47,6 @@ export class VacuumCleaner {
|
|
|
47
47
|
(this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
|
|
48
48
|
`${accessory.displayName} ${device.remoteType}`;
|
|
49
49
|
|
|
50
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
51
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
52
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
53
|
-
|
|
54
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
55
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
56
50
|
this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
57
51
|
if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
58
52
|
this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -119,11 +113,21 @@ export class VacuumCleaner {
|
|
|
119
113
|
method: 'POST',
|
|
120
114
|
headers: this.platform.generateHeaders(),
|
|
121
115
|
});
|
|
116
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
117
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
118
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
122
119
|
const deviceStatus: any = await body.json();
|
|
123
|
-
this.
|
|
124
|
-
this.
|
|
125
|
-
this.
|
|
126
|
-
|
|
120
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
121
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
122
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
123
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
124
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
125
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
126
|
+
this.updateHomeKitCharacteristics();
|
|
127
|
+
} else {
|
|
128
|
+
this.statusCode(statusCode);
|
|
129
|
+
this.statusCode(deviceStatus.statusCode);
|
|
130
|
+
}
|
|
127
131
|
} catch (e: any) {
|
|
128
132
|
this.apiError(e);
|
|
129
133
|
this.errorLog(
|
|
@@ -47,12 +47,6 @@ export class WaterHeater {
|
|
|
47
47
|
(this.valveService = accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)),
|
|
48
48
|
`${accessory.displayName} ${device.remoteType}`;
|
|
49
49
|
|
|
50
|
-
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
51
|
-
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
52
|
-
// accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
|
|
53
|
-
|
|
54
|
-
// set the service name, this is what is displayed as the default name on the Home app
|
|
55
|
-
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
56
50
|
this.valveService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
57
51
|
if (!this.valveService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
58
52
|
this.valveService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -128,11 +122,21 @@ export class WaterHeater {
|
|
|
128
122
|
method: 'POST',
|
|
129
123
|
headers: this.platform.generateHeaders(),
|
|
130
124
|
});
|
|
125
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
|
|
126
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
127
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
131
128
|
const deviceStatus: any = await body.json();
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
134
|
-
this.
|
|
135
|
-
|
|
129
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
130
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
131
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
132
|
+
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
133
|
+
this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
134
|
+
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
135
|
+
this.updateHomeKitCharacteristics();
|
|
136
|
+
} else {
|
|
137
|
+
this.statusCode(statusCode);
|
|
138
|
+
this.statusCode(deviceStatus.statusCode);
|
|
139
|
+
}
|
|
136
140
|
} catch (e: any) {
|
|
137
141
|
this.apiError(e);
|
|
138
142
|
this.errorLog(
|
package/src/platform.ts
CHANGED
|
@@ -300,12 +300,19 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
300
300
|
const { body, statusCode, headers } = await request(Devices, {
|
|
301
301
|
headers: this.generateHeaders(),
|
|
302
302
|
});
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
this.debugWarnLog(`body: ${JSON.stringify(body)}`);
|
|
304
|
+
this.debugWarnLog(`statusCode: ${statusCode}`);
|
|
305
|
+
this.debugWarnLog(`headers: ${JSON.stringify(headers)}`);
|
|
306
|
+
const devicesAPI: any = await body.json();
|
|
307
|
+
this.debugWarnLog(`devicesAPI: ${JSON.stringify(devicesAPI)}`);
|
|
308
|
+
this.debugWarnLog(`devicesAPI Body: ${JSON.stringify(devicesAPI.body)}`);
|
|
309
|
+
this.debugWarnLog(`devicesAPI StatusCode: ${devicesAPI.statusCode}`);
|
|
310
|
+
if ((statusCode === 200 || statusCode === 100) && (devicesAPI.statusCode === 200 || devicesAPI.statusCode === 100)) {
|
|
311
|
+
this.debugErrorLog(`statusCode: ${statusCode} & devicesAPI StatusCode: ${devicesAPI.statusCode}`);
|
|
307
312
|
// SwitchBot Devices
|
|
308
313
|
const deviceLists = devicesAPI.body.deviceList;
|
|
314
|
+
this.debugWarnLog(`DeviceLists: ${JSON.stringify(deviceLists)}`);
|
|
315
|
+
this.debugWarnLog(`DeviceLists Length: ${deviceLists.length}`);
|
|
309
316
|
if (!this.config.options?.devices) {
|
|
310
317
|
this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
311
318
|
if (deviceLists.length === 0) {
|
|
@@ -323,25 +330,29 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
323
330
|
}
|
|
324
331
|
} else if (this.config.credentials?.token && this.config.options.devices) {
|
|
325
332
|
this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
333
|
+
if (deviceLists.length === 0) {
|
|
334
|
+
this.debugLog(`SwitchBot API Currently Doesn't Have Any Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
|
|
335
|
+
} else {
|
|
336
|
+
const deviceConfigs = this.config.options?.devices;
|
|
337
|
+
|
|
338
|
+
const mergeBydeviceId = (a1: { deviceId: string }[], a2: any[]) =>
|
|
339
|
+
a1.map((itm: { deviceId: string }) => ({
|
|
340
|
+
...a2.find(
|
|
341
|
+
(item: { deviceId: string }) =>
|
|
342
|
+
item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item,
|
|
343
|
+
),
|
|
344
|
+
...itm,
|
|
345
|
+
}));
|
|
346
|
+
|
|
347
|
+
const devices = mergeBydeviceId(deviceLists, deviceConfigs);
|
|
348
|
+
this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
|
|
349
|
+
for (const device of devices) {
|
|
350
|
+
if (device.deviceType) {
|
|
351
|
+
if (device.configDeviceName) {
|
|
352
|
+
device.deviceName = device.configDeviceName;
|
|
353
|
+
}
|
|
354
|
+
this.createDevice(device);
|
|
343
355
|
}
|
|
344
|
-
this.createDevice(device);
|
|
345
356
|
}
|
|
346
357
|
}
|
|
347
358
|
} else {
|
|
@@ -389,6 +400,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
389
400
|
}
|
|
390
401
|
} else {
|
|
391
402
|
this.statusCode(statusCode);
|
|
403
|
+
this.statusCode(devicesAPI.statusCode);
|
|
392
404
|
}
|
|
393
405
|
} catch (e: any) {
|
|
394
406
|
this.debugErrorLog(
|
|
@@ -2075,7 +2087,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2075
2087
|
registerDevice = true;
|
|
2076
2088
|
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2077
2089
|
}
|
|
2078
|
-
|
|
2090
|
+
if (registerDevice === true) {
|
|
2091
|
+
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
2092
|
+
} else {
|
|
2093
|
+
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2094
|
+
}
|
|
2079
2095
|
} else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && device.connectionType === 'BLE') {
|
|
2080
2096
|
if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
|
|
2081
2097
|
registerDevice = await this.registerCurtains(device);
|
|
@@ -2084,7 +2100,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2084
2100
|
registerDevice = true;
|
|
2085
2101
|
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2086
2102
|
}
|
|
2087
|
-
|
|
2103
|
+
if (registerDevice === true) {
|
|
2104
|
+
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
2105
|
+
} else {
|
|
2106
|
+
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2107
|
+
}
|
|
2088
2108
|
} else if (!device.hide_device && device.connectionType === 'OpenAPI') {
|
|
2089
2109
|
if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
|
|
2090
2110
|
registerDevice = await this.registerCurtains(device);
|
|
@@ -2093,7 +2113,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2093
2113
|
registerDevice = true;
|
|
2094
2114
|
this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
|
|
2095
2115
|
}
|
|
2096
|
-
|
|
2116
|
+
if (registerDevice === true) {
|
|
2117
|
+
this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
|
|
2118
|
+
} else {
|
|
2119
|
+
this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
|
|
2120
|
+
}
|
|
2097
2121
|
} else if (!device.hide_device && device.connectionType === 'Disabled') {
|
|
2098
2122
|
if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
|
|
2099
2123
|
registerDevice = await this.registerCurtains(device);
|
|
@@ -2184,7 +2208,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2184
2208
|
this.debugLog(`Request successful, statusCode: ${statusCode}`);
|
|
2185
2209
|
break;
|
|
2186
2210
|
default:
|
|
2187
|
-
this.
|
|
2211
|
+
this.errorLog(`Unknown statusCode, statusCode: ${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
2188
2212
|
}
|
|
2189
2213
|
}
|
|
2190
2214
|
|