@switchbot/homebridge-switchbot 1.9.0 → 1.9.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +3 -1
- package/.github/ISSUE_TEMPLATE/bug-report.yml +3 -3
- package/.github/ISSUE_TEMPLATE/feature-request.yml +2 -2
- package/.github/ISSUE_TEMPLATE/support-request.yml +3 -3
- package/.github/labeler.yml +1 -1
- package/.github/workflows/codeql-analysis.yml +29 -29
- package/.github/workflows/nodejs-beta.yml +1 -1
- package/.github/workflows/prerelease-beta.js +1 -1
- package/.github/workflows/stale.yml +1 -1
- package/.prettierrc +9 -0
- package/.vscode/settings.json +13 -1
- package/README.md +100 -99
- package/SECURITY.md +2 -2
- package/dist/devices/bots.d.ts +2 -2
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +91 -86
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +15 -15
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +60 -71
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +2 -2
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +33 -31
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +2 -2
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +71 -71
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +2 -2
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +74 -76
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +2 -2
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +29 -27
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +2 -2
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +34 -32
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +7 -7
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +18 -23
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +2 -2
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +36 -45
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +2 -2
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +12 -17
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +2 -2
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +10 -13
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +2 -2
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +15 -17
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +2 -2
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +10 -13
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +2 -2
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +10 -13
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +2 -2
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +22 -30
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +2 -2
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +11 -13
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +2 -2
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +10 -13
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +3 -3
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +13 -14
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/homebridge-ui/public/index.html +231 -245
- package/homebridge-ui/server.js +2 -4
- package/nodemon.json +2 -4
- package/package.json +75 -71
- package/src/devices/bots.ts +217 -186
- package/src/devices/colorbulb.ts +90 -84
- package/src/devices/contact.ts +85 -78
- package/src/devices/curtains.ts +152 -135
- package/src/devices/humidifiers.ts +162 -137
- package/src/devices/meters.ts +76 -73
- package/src/devices/motion.ts +87 -78
- package/src/devices/plugs.ts +27 -31
- package/src/irdevices/airconditioners.ts +72 -55
- package/src/irdevices/airpurifiers.ts +22 -23
- package/src/irdevices/cameras.ts +18 -19
- package/src/irdevices/fans.ts +27 -25
- package/src/irdevices/lights.ts +18 -20
- package/src/irdevices/others.ts +18 -19
- package/src/irdevices/tvs.ts +33 -41
- package/src/irdevices/vacuumcleaners.ts +19 -19
- package/src/irdevices/waterheaters.ts +21 -31
- package/src/platform.ts +32 -33
- package/src/settings.ts +8 -19
- package/.github/PULL_REQUEST_TEMPLATE/pull_requests.md +0 -27
|
@@ -43,11 +43,7 @@ export class AirConditioner {
|
|
|
43
43
|
deviceLogging!: string;
|
|
44
44
|
hide_automode?: boolean;
|
|
45
45
|
|
|
46
|
-
constructor(
|
|
47
|
-
private readonly platform: SwitchBotPlatform,
|
|
48
|
-
private accessory: PlatformAccessory,
|
|
49
|
-
public device: irdevice & irDevicesConfig,
|
|
50
|
-
) {
|
|
46
|
+
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
51
47
|
// default placeholders
|
|
52
48
|
this.logs(device);
|
|
53
49
|
this.config(device);
|
|
@@ -78,9 +74,8 @@ export class AirConditioner {
|
|
|
78
74
|
|
|
79
75
|
// get the Television service if it exists, otherwise create a new Television service
|
|
80
76
|
// you can create multiple services for each accessory
|
|
81
|
-
(this.service =
|
|
82
|
-
|
|
83
|
-
accessory.addService(this.platform.Service.HeaterCooler)), `${accessory.displayName} Air Conditioner`;
|
|
77
|
+
(this.service = accessory.getService(this.platform.Service.HeaterCooler) || accessory.addService(this.platform.Service.HeaterCooler)),
|
|
78
|
+
`${accessory.displayName} Air Conditioner`;
|
|
84
79
|
|
|
85
80
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
86
81
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -107,13 +102,17 @@ export class AirConditioner {
|
|
|
107
102
|
if (this.hide_automode) {
|
|
108
103
|
this.TargetHeaterCoolerState = 1 || 2;
|
|
109
104
|
this.ValidValues = [1, 2];
|
|
110
|
-
this.debugLog(
|
|
111
|
-
|
|
105
|
+
this.debugLog(
|
|
106
|
+
`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},` +
|
|
107
|
+
` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
|
|
108
|
+
);
|
|
112
109
|
} else {
|
|
113
110
|
this.TargetHeaterCoolerState = 0 || 1 || 2;
|
|
114
111
|
this.ValidValues = [0, 1, 2];
|
|
115
|
-
this.debugLog(
|
|
116
|
-
|
|
112
|
+
this.debugLog(
|
|
113
|
+
`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},` +
|
|
114
|
+
` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
|
|
115
|
+
);
|
|
117
116
|
}
|
|
118
117
|
this.service
|
|
119
118
|
.getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
|
|
@@ -125,10 +124,9 @@ export class AirConditioner {
|
|
|
125
124
|
})
|
|
126
125
|
.onSet(this.TargetHeaterCoolerStateSet.bind(this));
|
|
127
126
|
|
|
128
|
-
this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
});
|
|
127
|
+
this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState).onGet(async () => {
|
|
128
|
+
return this.CurrentHeaterCoolerStateGet();
|
|
129
|
+
});
|
|
132
130
|
|
|
133
131
|
this.service
|
|
134
132
|
.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
|
|
@@ -227,12 +225,12 @@ export class AirConditioner {
|
|
|
227
225
|
}
|
|
228
226
|
if (this.CurrentMode === 1) {
|
|
229
227
|
this.CurrentTemperature = 25;
|
|
230
|
-
this.debugLog(
|
|
231
|
-
+ ` CurrentTemperature: ${this.CurrentTemperature}
|
|
228
|
+
this.debugLog(
|
|
229
|
+
`Air Conditioner: ${this.accessory.displayName} CurrentMode: ${this.CurrentMode},` + ` CurrentTemperature: ${this.CurrentTemperature}`,
|
|
230
|
+
);
|
|
232
231
|
}
|
|
233
232
|
payload.parameter = `${this.CurrentTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
234
233
|
|
|
235
|
-
|
|
236
234
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
237
235
|
this.CurrentTemperatureUndefined();
|
|
238
236
|
if (this.CurrentTemperature < this.CurrentTemperatureCached) {
|
|
@@ -249,8 +247,10 @@ export class AirConditioner {
|
|
|
249
247
|
|
|
250
248
|
public async pushChanges(payload: payload) {
|
|
251
249
|
try {
|
|
252
|
-
this.infoLog(
|
|
253
|
-
|
|
250
|
+
this.infoLog(
|
|
251
|
+
`Air Conditioner: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
252
|
+
` parameter: [${payload.parameter}], commandType: ${payload.commandType}`,
|
|
253
|
+
);
|
|
254
254
|
|
|
255
255
|
// Make the API request
|
|
256
256
|
const push: any = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
@@ -268,18 +268,16 @@ export class AirConditioner {
|
|
|
268
268
|
} catch (e: any) {
|
|
269
269
|
this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges`);
|
|
270
270
|
if (this.deviceLogging === 'debug') {
|
|
271
|
-
this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,`
|
|
272
|
-
+ ` Error Message: ${JSON.stringify(e.message)}`);
|
|
271
|
+
this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
|
|
273
272
|
}
|
|
274
273
|
if (this.platform.debugMode) {
|
|
275
|
-
this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,`
|
|
276
|
-
+ ` Error: ${JSON.stringify(e)}`);
|
|
274
|
+
this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
|
|
277
275
|
}
|
|
278
276
|
this.apiError(e);
|
|
279
277
|
}
|
|
280
278
|
}
|
|
281
279
|
|
|
282
|
-
statusCode(push: AxiosResponse<{ statusCode: number
|
|
280
|
+
statusCode(push: AxiosResponse<{ statusCode: number }>) {
|
|
283
281
|
switch (push.data.statusCode) {
|
|
284
282
|
case 151:
|
|
285
283
|
this.errorLog(`Air Conditioner: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -297,8 +295,10 @@ export class AirConditioner {
|
|
|
297
295
|
this.errorLog(`Air Conditioner: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
298
296
|
break;
|
|
299
297
|
case 190:
|
|
300
|
-
this.errorLog(
|
|
301
|
-
|
|
298
|
+
this.errorLog(
|
|
299
|
+
`Air Conditioner: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
300
|
+
` with server, Or command: ${JSON.stringify(push.data)} format is invalid`,
|
|
301
|
+
);
|
|
302
302
|
break;
|
|
303
303
|
case 100:
|
|
304
304
|
this.debugLog(`Air Conditioner: ${this.accessory.displayName} Command successfully sent.`);
|
|
@@ -331,29 +331,33 @@ export class AirConditioner {
|
|
|
331
331
|
this.debugLog(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
332
332
|
} else {
|
|
333
333
|
this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
|
|
334
|
-
this.debugLog(
|
|
335
|
-
+ ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}
|
|
334
|
+
this.debugLog(
|
|
335
|
+
`Air Conditioner: ${this.accessory.displayName}` + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
|
|
336
|
+
);
|
|
336
337
|
}
|
|
337
338
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
338
339
|
this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
339
340
|
} else {
|
|
340
341
|
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
341
|
-
this.debugLog(
|
|
342
|
-
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}
|
|
342
|
+
this.debugLog(
|
|
343
|
+
`Air Conditioner: ${this.accessory.displayName}` + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
344
|
+
);
|
|
343
345
|
}
|
|
344
346
|
if (this.HeatingThresholdTemperature === undefined) {
|
|
345
347
|
this.debugLog(`Air Conditioner: ${this.accessory.displayName} HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
|
|
346
348
|
} else {
|
|
347
349
|
this.service?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
|
|
348
|
-
this.debugLog(
|
|
349
|
-
+ ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}
|
|
350
|
+
this.debugLog(
|
|
351
|
+
`Air Conditioner: ${this.accessory.displayName}` + ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`,
|
|
352
|
+
);
|
|
350
353
|
}
|
|
351
354
|
if (this.CoolingThresholdTemperature === undefined) {
|
|
352
355
|
this.debugLog(`Air Conditioner: ${this.accessory.displayName} CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
|
|
353
356
|
} else {
|
|
354
357
|
this.service?.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, this.CoolingThresholdTemperature);
|
|
355
|
-
this.debugLog(
|
|
356
|
-
+ ` updateCharacteristic CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}
|
|
358
|
+
this.debugLog(
|
|
359
|
+
`Air Conditioner: ${this.accessory.displayName}` + ` updateCharacteristic CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`,
|
|
360
|
+
);
|
|
357
361
|
}
|
|
358
362
|
}
|
|
359
363
|
|
|
@@ -425,16 +429,22 @@ export class AirConditioner {
|
|
|
425
429
|
TargetHeaterCoolerStateGet() {
|
|
426
430
|
if (this.ValidValues === [0, 1, 2]) {
|
|
427
431
|
this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
|
|
428
|
-
this.debugLog(
|
|
429
|
-
|
|
432
|
+
this.debugLog(
|
|
433
|
+
`Air Conditioner: ${this.accessory.displayName} Get (AUTO) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},` +
|
|
434
|
+
` ValidValues: ${this.ValidValues}`,
|
|
435
|
+
);
|
|
430
436
|
} else if (this.ValidValues === [1, 2]) {
|
|
431
|
-
this.TargetHeaterCoolerState =
|
|
432
|
-
|| this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
433
|
-
this.debugLog(
|
|
434
|
-
|
|
437
|
+
this.TargetHeaterCoolerState =
|
|
438
|
+
this.platform.Characteristic.TargetHeaterCoolerState.COOL || this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
439
|
+
this.debugLog(
|
|
440
|
+
`Air Conditioner: ${this.accessory.displayName} Get (COOL/HEAT) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},` +
|
|
441
|
+
` ValidValues: ${this.ValidValues}`,
|
|
442
|
+
);
|
|
435
443
|
} else {
|
|
436
|
-
this.debugLog(
|
|
437
|
-
|
|
444
|
+
this.debugLog(
|
|
445
|
+
`Air Conditioner: ${this.accessory.displayName} Get TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},` +
|
|
446
|
+
` ValidValues: ${this.ValidValues}`,
|
|
447
|
+
);
|
|
438
448
|
}
|
|
439
449
|
this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
|
|
440
450
|
this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerStateCached;
|
|
@@ -448,8 +458,10 @@ export class AirConditioner {
|
|
|
448
458
|
} else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
|
|
449
459
|
this.TargetHeaterCoolerStateCOOL();
|
|
450
460
|
} else {
|
|
451
|
-
this.errorLog(
|
|
452
|
-
|
|
461
|
+
this.errorLog(
|
|
462
|
+
`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
463
|
+
` hide_automode: ${this.hide_automode} `,
|
|
464
|
+
);
|
|
453
465
|
}
|
|
454
466
|
} else {
|
|
455
467
|
if (value === this.platform.Characteristic.TargetHeaterCoolerState.AUTO) {
|
|
@@ -459,8 +471,10 @@ export class AirConditioner {
|
|
|
459
471
|
} else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
|
|
460
472
|
this.TargetHeaterCoolerStateCOOL();
|
|
461
473
|
} else {
|
|
462
|
-
this.errorLog(
|
|
463
|
-
|
|
474
|
+
this.errorLog(
|
|
475
|
+
`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
476
|
+
` hide_automode: ${this.hide_automode} `,
|
|
477
|
+
);
|
|
464
478
|
}
|
|
465
479
|
}
|
|
466
480
|
this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
|
|
@@ -523,12 +537,13 @@ export class AirConditioner {
|
|
|
523
537
|
this.CurrentTemperature = value;
|
|
524
538
|
this.HeatingThresholdTemperatureCached = this.HeatingThresholdTemperature;
|
|
525
539
|
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
|
|
526
|
-
this.debugLog(
|
|
527
|
-
|
|
540
|
+
this.debugLog(
|
|
541
|
+
`Air Conditioner: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},` +
|
|
542
|
+
` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`,
|
|
543
|
+
);
|
|
528
544
|
this.pushAirConditionerStatusChanges();
|
|
529
545
|
}
|
|
530
546
|
|
|
531
|
-
|
|
532
547
|
private CoolingThresholdTemperatureGet() {
|
|
533
548
|
this.CurrentTemperatureUndefined;
|
|
534
549
|
this.CurrentTemperature = this.CurrentTemperatureCached;
|
|
@@ -544,8 +559,10 @@ export class AirConditioner {
|
|
|
544
559
|
this.CurrentTemperature = value;
|
|
545
560
|
this.CoolingThresholdTemperatureCached = this.CoolingThresholdTemperature;
|
|
546
561
|
this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
|
|
547
|
-
this.debugLog(
|
|
548
|
-
|
|
562
|
+
this.debugLog(
|
|
563
|
+
`Air Conditioner: ${this.accessory.displayName} Set CoolingThresholdTemperature: ${this.CoolingThresholdTemperature},` +
|
|
564
|
+
` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`,
|
|
565
|
+
);
|
|
549
566
|
this.pushAirConditionerStatusChanges();
|
|
550
567
|
}
|
|
551
568
|
|
|
@@ -588,8 +605,8 @@ export class AirConditioner {
|
|
|
588
605
|
}
|
|
589
606
|
|
|
590
607
|
/**
|
|
591
|
-
|
|
592
|
-
|
|
608
|
+
* Logging for Device
|
|
609
|
+
*/
|
|
593
610
|
infoLog(...log: any[]) {
|
|
594
611
|
if (this.enablingDeviceLogging()) {
|
|
595
612
|
this.platform.log.info(String(...log));
|
|
@@ -38,11 +38,7 @@ export class AirPurifier {
|
|
|
38
38
|
// Config
|
|
39
39
|
deviceLogging!: string;
|
|
40
40
|
|
|
41
|
-
constructor(
|
|
42
|
-
private readonly platform: SwitchBotPlatform,
|
|
43
|
-
private accessory: PlatformAccessory,
|
|
44
|
-
public device: irdevice & irDevicesConfig,
|
|
45
|
-
) {
|
|
41
|
+
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
46
42
|
// default placeholders
|
|
47
43
|
this.logs(device);
|
|
48
44
|
this.config(device);
|
|
@@ -66,9 +62,8 @@ export class AirPurifier {
|
|
|
66
62
|
|
|
67
63
|
// get the Television service if it exists, otherwise create a new Television service
|
|
68
64
|
// you can create multiple services for each accessory
|
|
69
|
-
(this.service =
|
|
70
|
-
|
|
71
|
-
accessory.addService(this.platform.Service.AirPurifier)), `${accessory.displayName} Air Purifier`;
|
|
65
|
+
(this.service = accessory.getService(this.platform.Service.AirPurifier) || accessory.addService(this.platform.Service.AirPurifier)),
|
|
66
|
+
`${accessory.displayName} Air Purifier`;
|
|
72
67
|
|
|
73
68
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
74
69
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -111,15 +106,15 @@ export class AirPurifier {
|
|
|
111
106
|
this.debugLog(`Air Purifier: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
112
107
|
} else {
|
|
113
108
|
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentAirPurifierState, this.CurrentAirPurifierState);
|
|
114
|
-
this.debugLog(`Air Purifier: ${this.accessory.displayName}`
|
|
115
|
-
+ ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
109
|
+
this.debugLog(`Air Purifier: ${this.accessory.displayName}` + ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
116
110
|
}
|
|
117
111
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
118
112
|
this.debugLog(`Air Purifier: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
119
113
|
} else {
|
|
120
114
|
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
121
|
-
this.debugLog(
|
|
122
|
-
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}
|
|
115
|
+
this.debugLog(
|
|
116
|
+
`Air Purifier: ${this.accessory.displayName}` + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
117
|
+
);
|
|
123
118
|
}
|
|
124
119
|
}
|
|
125
120
|
|
|
@@ -219,8 +214,10 @@ export class AirPurifier {
|
|
|
219
214
|
|
|
220
215
|
public async pushChanges(payload: payload) {
|
|
221
216
|
try {
|
|
222
|
-
this.infoLog(
|
|
223
|
-
|
|
217
|
+
this.infoLog(
|
|
218
|
+
`Air Purifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
219
|
+
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`,
|
|
220
|
+
);
|
|
224
221
|
|
|
225
222
|
// Make the API request
|
|
226
223
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
@@ -232,18 +229,18 @@ export class AirPurifier {
|
|
|
232
229
|
} catch (e: any) {
|
|
233
230
|
this.errorLog(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
234
231
|
if (this.deviceLogging === 'debug') {
|
|
235
|
-
this.errorLog(
|
|
236
|
-
+ ` Error Message: ${JSON.stringify(e.message)}
|
|
232
|
+
this.errorLog(
|
|
233
|
+
`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
|
|
234
|
+
);
|
|
237
235
|
}
|
|
238
236
|
if (this.platform.debugMode) {
|
|
239
|
-
this.errorLog(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
240
|
-
+ ` Error: ${JSON.stringify(e)}`);
|
|
237
|
+
this.errorLog(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
241
238
|
}
|
|
242
239
|
this.apiError(e);
|
|
243
240
|
}
|
|
244
241
|
}
|
|
245
242
|
|
|
246
|
-
private statusCode(push: AxiosResponse<{ statusCode: number
|
|
243
|
+
private statusCode(push: AxiosResponse<{ statusCode: number }>) {
|
|
247
244
|
switch (push.data.statusCode) {
|
|
248
245
|
case 151:
|
|
249
246
|
this.errorLog(`Air Purifier: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -261,8 +258,10 @@ export class AirPurifier {
|
|
|
261
258
|
this.errorLog(`Air Purifier: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
262
259
|
break;
|
|
263
260
|
case 190:
|
|
264
|
-
this.errorLog(
|
|
265
|
-
|
|
261
|
+
this.errorLog(
|
|
262
|
+
`Air Purifier: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
263
|
+
` with server, Or command: ${JSON.stringify(push.data)} format is invalid`,
|
|
264
|
+
);
|
|
266
265
|
break;
|
|
267
266
|
case 100:
|
|
268
267
|
this.debugLog(`Air Purifier: ${this.accessory.displayName} Command successfully sent.`);
|
|
@@ -310,8 +309,8 @@ export class AirPurifier {
|
|
|
310
309
|
}
|
|
311
310
|
|
|
312
311
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
* Logging for Device
|
|
313
|
+
*/
|
|
315
314
|
infoLog(...log: any[]) {
|
|
316
315
|
if (this.enablingDeviceLogging()) {
|
|
317
316
|
this.platform.log.info(String(...log));
|
package/src/irdevices/cameras.ts
CHANGED
|
@@ -19,11 +19,7 @@ export class Camera {
|
|
|
19
19
|
// Config
|
|
20
20
|
deviceLogging!: string;
|
|
21
21
|
|
|
22
|
-
constructor(
|
|
23
|
-
private readonly platform: SwitchBotPlatform,
|
|
24
|
-
private accessory: PlatformAccessory,
|
|
25
|
-
public device: irdevice & irDevicesConfig,
|
|
26
|
-
) {
|
|
22
|
+
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
27
23
|
// default placeholders
|
|
28
24
|
this.logs(device);
|
|
29
25
|
this.config(device);
|
|
@@ -42,9 +38,8 @@ export class Camera {
|
|
|
42
38
|
|
|
43
39
|
// get the Television service if it exists, otherwise create a new Television service
|
|
44
40
|
// you can create multiple services for each accessory
|
|
45
|
-
(this.service =
|
|
46
|
-
|
|
47
|
-
accessory.addService(this.platform.Service.Switch)), `${accessory.displayName} Camera`;
|
|
41
|
+
(this.service = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
|
|
42
|
+
`${accessory.displayName} Camera`;
|
|
48
43
|
|
|
49
44
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
50
45
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -111,8 +106,10 @@ export class Camera {
|
|
|
111
106
|
|
|
112
107
|
public async pushChanges(payload: payload) {
|
|
113
108
|
try {
|
|
114
|
-
this.infoLog(
|
|
115
|
-
|
|
109
|
+
this.infoLog(
|
|
110
|
+
`Camera: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
111
|
+
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`,
|
|
112
|
+
);
|
|
116
113
|
|
|
117
114
|
// Make the API request
|
|
118
115
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
@@ -124,18 +121,18 @@ export class Camera {
|
|
|
124
121
|
} catch (e: any) {
|
|
125
122
|
this.errorLog(`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
126
123
|
if (this.deviceLogging === 'debug') {
|
|
127
|
-
this.errorLog(
|
|
128
|
-
+ ` Error Message: ${JSON.stringify(e.message)}
|
|
124
|
+
this.errorLog(
|
|
125
|
+
`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
|
|
126
|
+
);
|
|
129
127
|
}
|
|
130
128
|
if (this.platform.debugMode) {
|
|
131
|
-
this.errorLog(`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
132
|
-
+ ` Error: ${JSON.stringify(e)}`);
|
|
129
|
+
this.errorLog(`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
133
130
|
}
|
|
134
131
|
this.apiError(e);
|
|
135
132
|
}
|
|
136
133
|
}
|
|
137
134
|
|
|
138
|
-
private statusCode(push: AxiosResponse<{ statusCode: number
|
|
135
|
+
private statusCode(push: AxiosResponse<{ statusCode: number }>) {
|
|
139
136
|
switch (push.data.statusCode) {
|
|
140
137
|
case 151:
|
|
141
138
|
this.errorLog(`Camera: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -153,8 +150,10 @@ export class Camera {
|
|
|
153
150
|
this.errorLog(`Camera: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
154
151
|
break;
|
|
155
152
|
case 190:
|
|
156
|
-
this.errorLog(
|
|
157
|
-
|
|
153
|
+
this.errorLog(
|
|
154
|
+
`Camera: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
155
|
+
` with server, Or command: ${JSON.stringify(push.data)} format is invalid`,
|
|
156
|
+
);
|
|
158
157
|
break;
|
|
159
158
|
case 100:
|
|
160
159
|
this.debugLog(`Camera: ${this.accessory.displayName} Command successfully sent.`);
|
|
@@ -199,8 +198,8 @@ export class Camera {
|
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
* Logging for Device
|
|
202
|
+
*/
|
|
204
203
|
infoLog(...log: any[]) {
|
|
205
204
|
if (this.enablingDeviceLogging()) {
|
|
206
205
|
this.platform.log.info(String(...log));
|
package/src/irdevices/fans.ts
CHANGED
|
@@ -29,11 +29,7 @@ export class Fan {
|
|
|
29
29
|
maxValue?: number;
|
|
30
30
|
deviceLogging!: string;
|
|
31
31
|
|
|
32
|
-
constructor(
|
|
33
|
-
private readonly platform: SwitchBotPlatform,
|
|
34
|
-
private accessory: PlatformAccessory,
|
|
35
|
-
public device: irdevice & irDevicesConfig,
|
|
36
|
-
) {
|
|
32
|
+
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
37
33
|
// default placeholders
|
|
38
34
|
this.logs(device);
|
|
39
35
|
this.config(device);
|
|
@@ -52,9 +48,8 @@ export class Fan {
|
|
|
52
48
|
|
|
53
49
|
// get the Television service if it exists, otherwise create a new Television service
|
|
54
50
|
// you can create multiple services for each accessory
|
|
55
|
-
(this.service =
|
|
56
|
-
|
|
57
|
-
accessory.addService(this.platform.Service.Fanv2)), `${accessory.displayName} Fan`;
|
|
51
|
+
(this.service = accessory.getService(this.platform.Service.Fanv2) || accessory.addService(this.platform.Service.Fanv2)),
|
|
52
|
+
`${accessory.displayName} Fan`;
|
|
58
53
|
|
|
59
54
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
60
55
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -92,15 +87,16 @@ export class Fan {
|
|
|
92
87
|
maxValue: this.maxValue,
|
|
93
88
|
})
|
|
94
89
|
.onSet(this.RotationSpeedSet.bind(this));
|
|
95
|
-
} else if (
|
|
96
|
-
this.service.testCharacteristic(this.platform.Characteristic.RotationSpeed) &&
|
|
97
|
-
!device.irfan?.swing_mode) {
|
|
90
|
+
} else if (this.service.testCharacteristic(this.platform.Characteristic.RotationSpeed) && !device.irfan?.swing_mode) {
|
|
98
91
|
const characteristic = this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed);
|
|
99
92
|
this.service.removeCharacteristic(characteristic);
|
|
100
93
|
this.debugLog(`Fan: ${this.accessory.displayName} Rotation Speed Characteristic was removed.`);
|
|
101
94
|
} else {
|
|
102
95
|
// eslint-disable-next-line max-len
|
|
103
|
-
this.debugLog(
|
|
96
|
+
this.debugLog(
|
|
97
|
+
`Fan: ${this.accessory.displayName} RotationSpeed Characteristic was not removed/added, ` +
|
|
98
|
+
`Clear Cache on ${this.accessory.displayName} to remove Chracteristic`,
|
|
99
|
+
);
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
if (device.irfan?.swing_mode) {
|
|
@@ -112,8 +108,10 @@ export class Fan {
|
|
|
112
108
|
this.debugLog(`Fan: ${this.accessory.displayName} Swing Mode Characteristic was removed.`);
|
|
113
109
|
} else {
|
|
114
110
|
// eslint-disable-next-line max-len
|
|
115
|
-
this.debugLog(
|
|
116
|
-
|
|
111
|
+
this.debugLog(
|
|
112
|
+
`Fan: ${this.accessory.displayName} Swing Mode Characteristic was not removed/added, ` +
|
|
113
|
+
`Clear Cache on ${this.accessory.displayName} To Remove Chracteristic`,
|
|
114
|
+
);
|
|
117
115
|
}
|
|
118
116
|
}
|
|
119
117
|
|
|
@@ -235,8 +233,10 @@ export class Fan {
|
|
|
235
233
|
|
|
236
234
|
public async pushTVChanges(payload: payload) {
|
|
237
235
|
try {
|
|
238
|
-
this.infoLog(
|
|
239
|
-
|
|
236
|
+
this.infoLog(
|
|
237
|
+
`Fan: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
238
|
+
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`,
|
|
239
|
+
);
|
|
240
240
|
|
|
241
241
|
// Make the API request
|
|
242
242
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
@@ -246,18 +246,18 @@ export class Fan {
|
|
|
246
246
|
} catch (e: any) {
|
|
247
247
|
this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
248
248
|
if (this.deviceLogging === 'debug') {
|
|
249
|
-
this.errorLog(
|
|
250
|
-
+ ` Error Message: ${JSON.stringify(e.message)}
|
|
249
|
+
this.errorLog(
|
|
250
|
+
`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
|
|
251
|
+
);
|
|
251
252
|
}
|
|
252
253
|
if (this.platform.debugMode) {
|
|
253
|
-
this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
254
|
-
+ ` Error: ${JSON.stringify(e)}`);
|
|
254
|
+
this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
255
255
|
}
|
|
256
256
|
this.apiError(e);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
private statusCode(push: AxiosResponse<{ statusCode: number
|
|
260
|
+
private statusCode(push: AxiosResponse<{ statusCode: number }>) {
|
|
261
261
|
switch (push.data.statusCode) {
|
|
262
262
|
case 151:
|
|
263
263
|
this.errorLog(`Fan: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -275,8 +275,10 @@ export class Fan {
|
|
|
275
275
|
this.errorLog(`Fan: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
276
276
|
break;
|
|
277
277
|
case 190:
|
|
278
|
-
this.errorLog(
|
|
279
|
-
|
|
278
|
+
this.errorLog(
|
|
279
|
+
`Fan: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
280
|
+
` with server, Or command: ${JSON.stringify(push.data)} format is invalid`,
|
|
281
|
+
);
|
|
280
282
|
break;
|
|
281
283
|
case 100:
|
|
282
284
|
this.debugLog(`Fan: ${this.accessory.displayName} Command successfully sent.`);
|
|
@@ -323,8 +325,8 @@ export class Fan {
|
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
/**
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
* Logging for Device
|
|
329
|
+
*/
|
|
328
330
|
infoLog(...log: any[]) {
|
|
329
331
|
if (this.enablingDeviceLogging()) {
|
|
330
332
|
this.platform.log.info(String(...log));
|
package/src/irdevices/lights.ts
CHANGED
|
@@ -19,11 +19,7 @@ export class Light {
|
|
|
19
19
|
// Config
|
|
20
20
|
deviceLogging!: string;
|
|
21
21
|
|
|
22
|
-
constructor(
|
|
23
|
-
private readonly platform: SwitchBotPlatform,
|
|
24
|
-
private accessory: PlatformAccessory,
|
|
25
|
-
public device: irdevice & irDevicesConfig,
|
|
26
|
-
) {
|
|
22
|
+
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
27
23
|
// default placeholders
|
|
28
24
|
this.logs(device);
|
|
29
25
|
this.config(device);
|
|
@@ -42,9 +38,8 @@ export class Light {
|
|
|
42
38
|
|
|
43
39
|
// get the Television service if it exists, otherwise create a new Television service
|
|
44
40
|
// you can create multiple services for each accessory
|
|
45
|
-
(this.service =
|
|
46
|
-
|
|
47
|
-
accessory.addService(this.platform.Service.Lightbulb)), `${accessory.displayName} Light Bulb`;
|
|
41
|
+
(this.service = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
|
|
42
|
+
`${accessory.displayName} Light Bulb`;
|
|
48
43
|
|
|
49
44
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
50
45
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -144,8 +139,10 @@ export class Light {
|
|
|
144
139
|
|
|
145
140
|
public async pushChanges(payload: payload) {
|
|
146
141
|
try {
|
|
147
|
-
this.infoLog(
|
|
148
|
-
|
|
142
|
+
this.infoLog(
|
|
143
|
+
`Light: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
144
|
+
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`,
|
|
145
|
+
);
|
|
149
146
|
|
|
150
147
|
// Make the API request
|
|
151
148
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
@@ -157,19 +154,18 @@ export class Light {
|
|
|
157
154
|
} catch (e: any) {
|
|
158
155
|
this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
159
156
|
if (this.deviceLogging === 'debug') {
|
|
160
|
-
this.errorLog(
|
|
161
|
-
+ ` Error Message: ${JSON.stringify(e.message)}
|
|
157
|
+
this.errorLog(
|
|
158
|
+
`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
|
|
159
|
+
);
|
|
162
160
|
}
|
|
163
161
|
if (this.platform.debugMode) {
|
|
164
|
-
this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
165
|
-
+ ` Error: ${JSON.stringify(e)}`);
|
|
162
|
+
this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
166
163
|
}
|
|
167
164
|
this.apiError(e);
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
|
|
171
|
-
|
|
172
|
-
private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
|
|
168
|
+
private statusCode(push: AxiosResponse<{ statusCode: number }>) {
|
|
173
169
|
switch (push.data.statusCode) {
|
|
174
170
|
case 151:
|
|
175
171
|
this.errorLog(`Light: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -187,8 +183,10 @@ export class Light {
|
|
|
187
183
|
this.errorLog(`Light: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
188
184
|
break;
|
|
189
185
|
case 190:
|
|
190
|
-
this.errorLog(
|
|
191
|
-
|
|
186
|
+
this.errorLog(
|
|
187
|
+
`Light: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
188
|
+
` with server, Or command: ${JSON.stringify(push.data)} format is invalid`,
|
|
189
|
+
);
|
|
192
190
|
break;
|
|
193
191
|
case 100:
|
|
194
192
|
this.debugLog(`Light: ${this.accessory.displayName} Command successfully sent.`);
|
|
@@ -233,8 +231,8 @@ export class Light {
|
|
|
233
231
|
}
|
|
234
232
|
|
|
235
233
|
/**
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
* Logging for Device
|
|
235
|
+
*/
|
|
238
236
|
infoLog(...log: any[]) {
|
|
239
237
|
if (this.enablingDeviceLogging()) {
|
|
240
238
|
this.platform.log.info(String(...log));
|