@switchbot/homebridge-switchbot 3.5.1-beta.10 → 3.5.1-beta.11

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.
Files changed (54) hide show
  1. package/dist/device/ceilinglight.d.ts.map +1 -1
  2. package/dist/device/ceilinglight.js +3 -4
  3. package/dist/device/ceilinglight.js.map +1 -1
  4. package/dist/device/colorbulb.js +1 -1
  5. package/dist/device/colorbulb.js.map +1 -1
  6. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  7. package/dist/irdevice/airconditioner.js +45 -51
  8. package/dist/irdevice/airconditioner.js.map +1 -1
  9. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  10. package/dist/irdevice/airpurifier.js +17 -17
  11. package/dist/irdevice/airpurifier.js.map +1 -1
  12. package/dist/irdevice/camera.d.ts.map +1 -1
  13. package/dist/irdevice/camera.js +9 -9
  14. package/dist/irdevice/camera.js.map +1 -1
  15. package/dist/irdevice/fan.d.ts.map +1 -1
  16. package/dist/irdevice/fan.js +19 -19
  17. package/dist/irdevice/fan.js.map +1 -1
  18. package/dist/irdevice/irdevice.d.ts +22 -10
  19. package/dist/irdevice/irdevice.d.ts.map +1 -1
  20. package/dist/irdevice/irdevice.js +89 -67
  21. package/dist/irdevice/irdevice.js.map +1 -1
  22. package/dist/irdevice/light.d.ts.map +1 -1
  23. package/dist/irdevice/light.js +15 -17
  24. package/dist/irdevice/light.js.map +1 -1
  25. package/dist/irdevice/other.d.ts.map +1 -1
  26. package/dist/irdevice/other.js +76 -76
  27. package/dist/irdevice/other.js.map +1 -1
  28. package/dist/irdevice/tv.d.ts.map +1 -1
  29. package/dist/irdevice/tv.js +35 -35
  30. package/dist/irdevice/tv.js.map +1 -1
  31. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  32. package/dist/irdevice/vacuumcleaner.js +9 -9
  33. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  34. package/dist/irdevice/waterheater.d.ts.map +1 -1
  35. package/dist/irdevice/waterheater.js +9 -9
  36. package/dist/irdevice/waterheater.js.map +1 -1
  37. package/dist/platform.d.ts +1 -1
  38. package/dist/platform.d.ts.map +1 -1
  39. package/dist/platform.js +202 -201
  40. package/dist/platform.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/device/ceilinglight.ts +3 -6
  43. package/src/device/colorbulb.ts +1 -1
  44. package/src/irdevice/airconditioner.ts +45 -51
  45. package/src/irdevice/airpurifier.ts +17 -17
  46. package/src/irdevice/camera.ts +9 -9
  47. package/src/irdevice/fan.ts +19 -19
  48. package/src/irdevice/irdevice.ts +92 -68
  49. package/src/irdevice/light.ts +15 -17
  50. package/src/irdevice/other.ts +76 -76
  51. package/src/irdevice/tv.ts +35 -35
  52. package/src/irdevice/vacuumcleaner.ts +9 -9
  53. package/src/irdevice/waterheater.ts +9 -9
  54. package/src/platform.ts +202 -201
@@ -6,7 +6,7 @@ import { request } from 'undici';
6
6
  import { Devices } from '../settings.js';
7
7
 
8
8
  import type { SwitchBotPlatform } from '../platform.js';
9
- import type { API, HAP, Logging, PlatformAccessory } from 'homebridge';
9
+ import type { API, HAP, Logging, PlatformAccessory, Service, CharacteristicValue } from 'homebridge';
10
10
  import type { SwitchBotPlatformConfig, irDevicesConfig } from '../settings.js';
11
11
  import type { irdevice } from '../types/irdevicelist.js';
12
12
 
@@ -53,16 +53,16 @@ export abstract class irdeviceBase {
53
53
  async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
54
54
  if (this.platform.debugMode) {
55
55
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
56
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
56
+ await this.debugWarnLog(`Using Debug Mode Logging: ${this.deviceLogging}`);
57
57
  } else if (device.logging) {
58
58
  this.deviceLogging = this.accessory.context.logging = device.logging;
59
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
59
+ await this.debugWarnLog(`Using Device Config Logging: ${this.deviceLogging}`);
60
60
  } else if (this.config.logging) {
61
61
  this.deviceLogging = this.accessory.context.logging = this.config.logging;
62
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
62
+ await this.debugWarnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
63
63
  } else {
64
64
  this.deviceLogging = this.accessory.context.logging = 'standard';
65
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
65
+ await this.debugWarnLog(`Logging Not Set, Using: ${this.deviceLogging}`);
66
66
  }
67
67
  }
68
68
 
@@ -137,7 +137,7 @@ export abstract class irdeviceBase {
137
137
  const config = Object.assign({}, deviceConfig, irairConfig, irpurConfig, ircamConfig, irfanConfig, irlightConfig, otherConfig,
138
138
  irtvConfig, irvcConfig, irwhConfig);
139
139
  if (Object.entries(config).length !== 0) {
140
- this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
140
+ this.debugSuccessLog(`Config: ${JSON.stringify(config)}`);
141
141
  }
142
142
  }
143
143
 
@@ -172,7 +172,7 @@ export abstract class irdeviceBase {
172
172
  }
173
173
  }
174
174
  const version = deviceFirmwareVersion.toString();
175
- this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Firmware Version: ${version?.replace(/^V|-.*$/g, '')}`);
175
+ await this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Firmware Version: ${version?.replace(/^V|-.*$/g, '')}`);
176
176
  let deviceVersion: string;
177
177
  if (version?.includes('.') === false) {
178
178
  const replace = version?.replace(/^V|-.*$/g, '');
@@ -201,21 +201,48 @@ export abstract class irdeviceBase {
201
201
  });
202
202
  }
203
203
 
204
+ async successfulStatusCodes(statusCode: any, deviceStatus: any) {
205
+ return (statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100);
206
+ }
207
+
208
+ /**
209
+ * Update the characteristic value and log the change.
210
+ *
211
+ * @param Service: Service
212
+ * @param Characteristic: Characteristic
213
+ * @param CharacteristicValue: CharacteristicValue | undefined
214
+ * @param CharacteristicName: string
215
+ * @return: void
216
+ *
217
+ */
218
+ async updateCharacteristic(Service: Service, Characteristic: any,
219
+ CharacteristicValue: CharacteristicValue | undefined, CharacteristicName: string): Promise<void> {
220
+ if (CharacteristicValue === undefined) {
221
+ await await this.debugLog(`${CharacteristicName}: ${CharacteristicValue}`);
222
+ } else {
223
+ Service.updateCharacteristic(Characteristic, CharacteristicValue);
224
+ await await this.debugLog(`updateCharacteristic ${CharacteristicName}: ${CharacteristicValue}`);
225
+ await await this.debugWarnLog(`context before: ${this.accessory.context[CharacteristicName]}`);
226
+ this.accessory.context[CharacteristicName] = CharacteristicValue;
227
+ await await this.debugWarnLog(`context after: ${this.accessory.context[CharacteristicName]}`);
228
+ }
229
+ }
230
+
204
231
  async pushStatusCodes(statusCode: any, deviceStatus: any) {
205
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
206
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
207
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
232
+ await this.debugWarnLog(`statusCode: ${statusCode}`);
233
+ await this.debugWarnLog(`deviceStatus: ${JSON.stringify(deviceStatus)}`);
234
+ await this.debugWarnLog(`deviceStatus statusCode: ${deviceStatus.statusCode}`);
208
235
  }
209
236
 
210
237
  async successfulPushChange(statusCode: any, deviceStatus: any, bodyChange: any) {
211
- this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode} & deviceStatus `
238
+ this.debugSuccessLog(`statusCode: ${statusCode} & deviceStatus `
212
239
  + `StatusCode: ${deviceStatus.statusCode}`);
213
- this.successLog(`${this.device.remoteType}: ${this.accessory.displayName} request to SwitchBot API,`
240
+ this.successLog('request to SwitchBot API,'
214
241
  + ` body: ${JSON.stringify(JSON.parse(bodyChange))} sent successfully`);
215
242
  }
216
243
 
217
244
  async pushChangeError(e: Error) {
218
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType}`
245
+ this.errorLog(`failed pushChanges with ${this.device.connectionType}`
219
246
  + ` Connection, Error Message: ${JSON.stringify(e.message)}`);
220
247
  }
221
248
 
@@ -278,69 +305,66 @@ export abstract class irdeviceBase {
278
305
  async statusCode(statusCode: number): Promise<void> {
279
306
  switch (statusCode) {
280
307
  case 151:
281
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
308
+ this.errorLog(`Command not supported by this deviceType, statusCode: ${statusCode}`);
282
309
  break;
283
310
  case 152:
284
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
311
+ this.errorLog(`Device not found, statusCode: ${statusCode}`);
285
312
  break;
286
313
  case 160:
287
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
314
+ this.errorLog(`Command is not supported, statusCode: ${statusCode}`);
288
315
  break;
289
316
  case 161:
290
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
317
+ this.errorLog(`Device is offline, statusCode: ${statusCode}`);
291
318
  break;
292
319
  case 171:
293
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. `
294
- + `Hub: ${this.device.hubDeviceId}`);
320
+ this.errorLog(`Hub Device is offline, statusCode: ${statusCode}. Hub: ${this.device.hubDeviceId}`);
295
321
  break;
296
322
  case 190:
297
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with`
298
- + ` server, Or command format is invalid, statusCode: ${statusCode}`);
323
+ this.errorLog('Device internal error due to device states not synchronized with server, Or command format is invalid,'
324
+ + ` statusCode: ${statusCode}`);
299
325
  break;
300
326
  case 100:
301
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
327
+ await this.debugLog(`Command successfully sent, statusCode: ${statusCode}`);
302
328
  break;
303
329
  case 200:
304
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
330
+ await this.debugLog(`Request successful, statusCode: ${statusCode}`);
305
331
  break;
306
332
  case 400:
307
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
308
- + `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
333
+ this.errorLog('Bad Request, The client has issued an invalid request. This is commonly used to specify validation errors in a request'
334
+ + ` payload, statusCode: ${statusCode}`);
309
335
  break;
310
336
  case 401:
311
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
312
- + `but the request has not been authenticated, statusCode: ${statusCode}`);
337
+ this.errorLog(`Unauthorized, Authorization for the API is required, but the request has not been authenticated, statusCode: ${statusCode}`);
313
338
  break;
314
339
  case 403:
315
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
316
- + `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
340
+ this.errorLog('Forbidden, The request has been authenticated but does not have appropriate permissions, or a requested resource is not'
341
+ + ` found, statusCode: ${statusCode}`);
317
342
  break;
318
343
  case 404:
319
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
320
- + `statusCode: ${statusCode}`);
344
+ this.errorLog(`Not Found, Specifies the requested path does not exist, statusCode: ${statusCode}`);
321
345
  break;
322
346
  case 406:
323
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
324
- + `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
347
+ this.errorLog('Not Acceptable, The client has requested a MIME type via the Accept header for a value not supported by the server,'
348
+ + ` statusCode: ${statusCode}`);
325
349
  break;
326
350
  case 415:
327
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
328
- + `header that is not supported by the server, statusCode: ${statusCode}`);
351
+ this.errorLog('Unsupported Media Type, The client has defined a contentType header that is not supported by the server,'
352
+ + ` statusCode: ${statusCode}`);
329
353
  break;
330
354
  case 422:
331
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, `
332
- + `but the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
355
+ this.errorLog('Unprocessable Entity, The client has made a valid request, but the server cannot process it. This is often used for APIs'
356
+ + ` for which certain limits have been exceeded, statusCode: ${statusCode}`);
333
357
  break;
334
358
  case 429:
335
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
336
- + `requests allowed for a given time window, statusCode: ${statusCode}`);
359
+ this.errorLog('Too Many Requests, The client has exceeded the number of requests allowed for a given time window,'
360
+ + ` statusCode: ${statusCode}`);
337
361
  break;
338
362
  case 500:
339
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
340
- + `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
363
+ this.errorLog('Internal Server Error, An unexpected error on the SmartThings servers has occurred. These errors should be rare,'
364
+ + ` statusCode: ${statusCode}`);
341
365
  break;
342
366
  default:
343
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: `
367
+ this.infoLog('Unknown statusCode: '
344
368
  + `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
345
369
  }
346
370
  }
@@ -348,65 +372,65 @@ export abstract class irdeviceBase {
348
372
  /**
349
373
  * Logging for Device
350
374
  */
351
- infoLog(...log: any[]): void {
352
- if (this.enablingDeviceLogging()) {
353
- this.log.info(String(...log));
375
+ async infoLog(...log: any[]): Promise<void> {
376
+ if (await this.enablingDeviceLogging()) {
377
+ this.log.info(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
354
378
  }
355
379
  }
356
380
 
357
- successLog(...log: any[]): void {
358
- if (this.enablingDeviceLogging()) {
359
- this.platform.log.success(String(...log));
381
+ async successLog(...log: any[]): Promise<void> {
382
+ if (await this.enablingDeviceLogging()) {
383
+ this.log.success(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
360
384
  }
361
385
  }
362
386
 
363
- debugSuccessLog(...log: any[]): void {
364
- if (this.enablingDeviceLogging()) {
387
+ async debugSuccessLog(...log: any[]): Promise<void> {
388
+ if (await this.enablingDeviceLogging()) {
365
389
  if (this.deviceLogging?.includes('debug')) {
366
- this.log.success('[DEBUG]', String(...log));
390
+ this.log.success(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
367
391
  }
368
392
  }
369
393
  }
370
394
 
371
- warnLog(...log: any[]): void {
372
- if (this.enablingDeviceLogging()) {
373
- this.log.warn(String(...log));
395
+ async warnLog(...log: any[]): Promise<void> {
396
+ if (await this.enablingDeviceLogging()) {
397
+ this.log.warn(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
374
398
  }
375
399
  }
376
400
 
377
- debugWarnLog(...log: any[]): void {
378
- if (this.enablingDeviceLogging()) {
401
+ async debugWarnLog(...log: any[]): Promise<void> {
402
+ if (await this.enablingDeviceLogging()) {
379
403
  if (this.deviceLogging?.includes('debug')) {
380
- this.log.warn('[DEBUG]', String(...log));
404
+ this.log.warn(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
381
405
  }
382
406
  }
383
407
  }
384
408
 
385
- errorLog(...log: any[]): void {
386
- if (this.enablingDeviceLogging()) {
387
- this.log.error(String(...log));
409
+ async errorLog(...log: any[]): Promise<void> {
410
+ if (await this.enablingDeviceLogging()) {
411
+ this.log.error(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
388
412
  }
389
413
  }
390
414
 
391
- debugErrorLog(...log: any[]): void {
392
- if (this.enablingDeviceLogging()) {
415
+ async debugErrorLog(...log: any[]): Promise<void> {
416
+ if (await this.enablingDeviceLogging()) {
393
417
  if (this.deviceLogging?.includes('debug')) {
394
- this.log.error('[DEBUG]', String(...log));
418
+ this.log.error(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
395
419
  }
396
420
  }
397
421
  }
398
422
 
399
- debugLog(...log: any[]): void {
400
- if (this.enablingDeviceLogging()) {
423
+ async debugLog(...log: any[]): Promise<void> {
424
+ if (await this.enablingDeviceLogging()) {
401
425
  if (this.deviceLogging === 'debug') {
402
- this.log.info('[DEBUG]', String(...log));
426
+ this.log.info(`[DEBUG] ${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
403
427
  } else {
404
- this.log.debug(String(...log));
428
+ this.log.debug(`${this.device.remoteType}: ${this.accessory.displayName}`, String(...log));
405
429
  }
406
430
  }
407
431
  }
408
432
 
409
- enablingDeviceLogging(): boolean {
433
+ async enablingDeviceLogging(): Promise<boolean> {
410
434
  return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
411
435
  }
412
436
  }
@@ -127,7 +127,7 @@ export class Light extends irdeviceBase {
127
127
  }
128
128
 
129
129
  async OnSet(value: CharacteristicValue): Promise<void> {
130
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
130
+ await this.debugLog(`On: ${value}`);
131
131
 
132
132
  this.LightBulb!.On = value;
133
133
  if (this.LightBulb?.On) {
@@ -144,7 +144,7 @@ export class Light extends irdeviceBase {
144
144
  }
145
145
 
146
146
  async ProgrammableSwitchOutputStateSetOn(value: CharacteristicValue): Promise<void> {
147
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
147
+ await this.debugLog(`On: ${value}`);
148
148
 
149
149
  this.ProgrammableSwitchOn!.ProgrammableSwitchOutputState = value;
150
150
  if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === 1) {
@@ -158,7 +158,7 @@ export class Light extends irdeviceBase {
158
158
  }
159
159
 
160
160
  async ProgrammableSwitchOutputStateSetOff(value: CharacteristicValue): Promise<void> {
161
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
161
+ await this.debugLog(`On: ${value}`);
162
162
 
163
163
  this.ProgrammableSwitchOff!.ProgrammableSwitchOutputState = value;
164
164
  if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === 1) {
@@ -184,7 +184,7 @@ export class Light extends irdeviceBase {
184
184
  * Light - "command" "channelSub" "default" = previous channel
185
185
  */
186
186
  async pushLightOnChanges(On: boolean): Promise<void> {
187
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`);
187
+ await this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`);
188
188
  if (On === true && this.disablePushOn === false) {
189
189
  const commandType: string = await this.commandType();
190
190
  const command: string = await this.commandOn();
@@ -198,7 +198,7 @@ export class Light extends irdeviceBase {
198
198
  }
199
199
 
200
200
  async pushLightOffChanges(On: boolean): Promise<void> {
201
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`);
201
+ await this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`);
202
202
  if (On === false && this.disablePushOff === false) {
203
203
  const commandType: string = await this.commandType();
204
204
  const command: string = await this.commandOff();
@@ -212,9 +212,9 @@ export class Light extends irdeviceBase {
212
212
  }
213
213
 
214
214
  async pushChanges(bodyChange: any, On: boolean): Promise<void> {
215
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
215
+ this.debugLog('pushChanges');
216
216
  if (this.device.connectionType === 'OpenAPI') {
217
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
217
+ this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
218
218
  try {
219
219
  const { body, statusCode } = await this.pushChangeRequest(bodyChange);
220
220
  const deviceStatus: any = await body.json();
@@ -232,43 +232,41 @@ export class Light extends irdeviceBase {
232
232
  await this.pushChangeError(e);
233
233
  }
234
234
  } else {
235
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Connection Type: `
235
+ this.warnLog('Connection Type: '
236
236
  + `${this.device.connectionType}, commands will not be sent to OpenAPI`);
237
237
  }
238
238
  }
239
239
 
240
240
  async updateHomeKitCharacteristics(): Promise<void> {
241
+ await this.debugLog('updateHomeKitCharacteristics');
241
242
  if (!this.device.irlight?.stateless) {
242
243
  // On
243
244
  if (this.LightBulb?.On === undefined) {
244
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.LightBulb?.On}`);
245
+ await this.debugLog(`On: ${this.LightBulb?.On}`);
245
246
  } else {
246
247
  this.accessory.context.On = this.LightBulb.On;
247
248
  this.LightBulb?.Service.updateCharacteristic(this.hap.Characteristic.On, this.LightBulb.On);
248
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.LightBulb.On}`);
249
+ await this.debugLog(`updateCharacteristic On: ${this.LightBulb.On}`);
249
250
  }
250
251
  } else {
251
252
  // On Stateful Programmable Switch
252
253
  if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === undefined) {
253
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
254
- + ` ProgrammableSwitchOutputStateOn: ${this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState}`);
254
+ await this.debugLog(`ProgrammableSwitchOutputStateOn: ${this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState}`);
255
255
  } else {
256
256
  this.accessory.context.ProgrammableSwitchOutputStateOn = this.ProgrammableSwitchOn.ProgrammableSwitchOutputState;
257
257
  this.ProgrammableSwitchOn?.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState,
258
258
  this.ProgrammableSwitchOn.ProgrammableSwitchOutputState);
259
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
259
+ this.debugLog('updateCharacteristic'
260
260
  + ` ProgrammableSwitchOutputStateOn: ${this.ProgrammableSwitchOn.ProgrammableSwitchOutputState}`);
261
261
  }
262
262
  // Off Stateful Programmable Switch
263
263
  if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === undefined) {
264
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
265
- + ` ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
264
+ await this.debugLog(`ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
266
265
  } else {
267
266
  this.accessory.context.ProgrammableSwitchOutputStateOff = this.ProgrammableSwitchOff.ProgrammableSwitchOutputState;
268
267
  this.ProgrammableSwitchOff.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState,
269
268
  this.ProgrammableSwitchOff.ProgrammableSwitchOutputState);
270
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
271
- + ` ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
269
+ await this.debugLog(`updateCharacteristic ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
272
270
  }
273
271
  }
274
272
  }