@switchbot/homebridge-switchbot 3.5.1-beta.9 → 3.5.1

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 (159) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/config.schema.json +19 -3
  3. package/dist/device/blindtilt.d.ts +6 -4
  4. package/dist/device/blindtilt.d.ts.map +1 -1
  5. package/dist/device/blindtilt.js +60 -46
  6. package/dist/device/blindtilt.js.map +1 -1
  7. package/dist/device/bot.d.ts +6 -3
  8. package/dist/device/bot.d.ts.map +1 -1
  9. package/dist/device/bot.js +59 -25
  10. package/dist/device/bot.js.map +1 -1
  11. package/dist/device/ceilinglight.d.ts +6 -3
  12. package/dist/device/ceilinglight.d.ts.map +1 -1
  13. package/dist/device/ceilinglight.js +47 -29
  14. package/dist/device/ceilinglight.js.map +1 -1
  15. package/dist/device/colorbulb.d.ts +6 -3
  16. package/dist/device/colorbulb.d.ts.map +1 -1
  17. package/dist/device/colorbulb.js +53 -36
  18. package/dist/device/colorbulb.js.map +1 -1
  19. package/dist/device/contact.d.ts +6 -3
  20. package/dist/device/contact.d.ts.map +1 -1
  21. package/dist/device/contact.js +45 -31
  22. package/dist/device/contact.js.map +1 -1
  23. package/dist/device/curtain.d.ts +6 -4
  24. package/dist/device/curtain.d.ts.map +1 -1
  25. package/dist/device/curtain.js +41 -27
  26. package/dist/device/curtain.js.map +1 -1
  27. package/dist/device/device.d.ts +6 -3
  28. package/dist/device/device.d.ts.map +1 -1
  29. package/dist/device/device.js +59 -152
  30. package/dist/device/device.js.map +1 -1
  31. package/dist/device/fan.d.ts +6 -3
  32. package/dist/device/fan.d.ts.map +1 -1
  33. package/dist/device/fan.js +53 -32
  34. package/dist/device/fan.js.map +1 -1
  35. package/dist/device/hub.d.ts +6 -3
  36. package/dist/device/hub.d.ts.map +1 -1
  37. package/dist/device/hub.js +49 -30
  38. package/dist/device/hub.js.map +1 -1
  39. package/dist/device/humidifier.d.ts +6 -3
  40. package/dist/device/humidifier.d.ts.map +1 -1
  41. package/dist/device/humidifier.js +47 -28
  42. package/dist/device/humidifier.js.map +1 -1
  43. package/dist/device/iosensor.d.ts +6 -3
  44. package/dist/device/iosensor.d.ts.map +1 -1
  45. package/dist/device/iosensor.js +44 -27
  46. package/dist/device/iosensor.js.map +1 -1
  47. package/dist/device/lightstrip.d.ts +6 -3
  48. package/dist/device/lightstrip.d.ts.map +1 -1
  49. package/dist/device/lightstrip.js +46 -28
  50. package/dist/device/lightstrip.js.map +1 -1
  51. package/dist/device/lock.d.ts +6 -3
  52. package/dist/device/lock.d.ts.map +1 -1
  53. package/dist/device/lock.js +38 -25
  54. package/dist/device/lock.js.map +1 -1
  55. package/dist/device/meter.d.ts +6 -3
  56. package/dist/device/meter.d.ts.map +1 -1
  57. package/dist/device/meter.js +43 -27
  58. package/dist/device/meter.js.map +1 -1
  59. package/dist/device/meterplus.d.ts +6 -3
  60. package/dist/device/meterplus.d.ts.map +1 -1
  61. package/dist/device/meterplus.js +42 -27
  62. package/dist/device/meterplus.js.map +1 -1
  63. package/dist/device/motion.d.ts +6 -3
  64. package/dist/device/motion.d.ts.map +1 -1
  65. package/dist/device/motion.js +37 -24
  66. package/dist/device/motion.js.map +1 -1
  67. package/dist/device/plug.d.ts +6 -3
  68. package/dist/device/plug.d.ts.map +1 -1
  69. package/dist/device/plug.js +30 -17
  70. package/dist/device/plug.js.map +1 -1
  71. package/dist/device/robotvacuumcleaner.d.ts +6 -3
  72. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  73. package/dist/device/robotvacuumcleaner.js +37 -22
  74. package/dist/device/robotvacuumcleaner.js.map +1 -1
  75. package/dist/device/waterdetector.d.ts +6 -3
  76. package/dist/device/waterdetector.d.ts.map +1 -1
  77. package/dist/device/waterdetector.js +43 -26
  78. package/dist/device/waterdetector.js.map +1 -1
  79. package/dist/homebridge-ui/public/index.html +2 -2
  80. package/dist/irdevice/airconditioner.d.ts +1 -3
  81. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  82. package/dist/irdevice/airconditioner.js +67 -177
  83. package/dist/irdevice/airconditioner.js.map +1 -1
  84. package/dist/irdevice/airpurifier.d.ts +0 -1
  85. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  86. package/dist/irdevice/airpurifier.js +24 -53
  87. package/dist/irdevice/airpurifier.js.map +1 -1
  88. package/dist/irdevice/camera.d.ts.map +1 -1
  89. package/dist/irdevice/camera.js +12 -17
  90. package/dist/irdevice/camera.js.map +1 -1
  91. package/dist/irdevice/fan.d.ts.map +1 -1
  92. package/dist/irdevice/fan.js +22 -38
  93. package/dist/irdevice/fan.js.map +1 -1
  94. package/dist/irdevice/irdevice.d.ts +22 -10
  95. package/dist/irdevice/irdevice.d.ts.map +1 -1
  96. package/dist/irdevice/irdevice.js +94 -100
  97. package/dist/irdevice/irdevice.js.map +1 -1
  98. package/dist/irdevice/light.d.ts.map +1 -1
  99. package/dist/irdevice/light.js +20 -38
  100. package/dist/irdevice/light.js.map +1 -1
  101. package/dist/irdevice/other.d.ts.map +1 -1
  102. package/dist/irdevice/other.js +79 -77
  103. package/dist/irdevice/other.js.map +1 -1
  104. package/dist/irdevice/tv.d.ts.map +1 -1
  105. package/dist/irdevice/tv.js +38 -53
  106. package/dist/irdevice/tv.js.map +1 -1
  107. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  108. package/dist/irdevice/vacuumcleaner.js +11 -16
  109. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  110. package/dist/irdevice/waterheater.d.ts.map +1 -1
  111. package/dist/irdevice/waterheater.js +11 -16
  112. package/dist/irdevice/waterheater.js.map +1 -1
  113. package/dist/platform.d.ts +4 -6
  114. package/dist/platform.d.ts.map +1 -1
  115. package/dist/platform.js +564 -665
  116. package/dist/platform.js.map +1 -1
  117. package/dist/settings.d.ts +10 -8
  118. package/dist/settings.d.ts.map +1 -1
  119. package/dist/settings.js.map +1 -1
  120. package/dist/types/bledevicestatus.d.ts +2 -1
  121. package/dist/types/bledevicestatus.d.ts.map +1 -1
  122. package/dist/types/devicestatus.d.ts +1 -1
  123. package/dist/types/devicestatus.d.ts.map +1 -1
  124. package/package.json +11 -11
  125. package/src/device/blindtilt.ts +64 -48
  126. package/src/device/bot.ts +79 -26
  127. package/src/device/ceilinglight.ts +57 -31
  128. package/src/device/colorbulb.ts +57 -43
  129. package/src/device/contact.ts +49 -31
  130. package/src/device/curtain.ts +51 -28
  131. package/src/device/device.ts +61 -135
  132. package/src/device/fan.ts +67 -33
  133. package/src/device/hub.ts +62 -33
  134. package/src/device/humidifier.ts +60 -33
  135. package/src/device/iosensor.ts +51 -30
  136. package/src/device/lightstrip.ts +52 -29
  137. package/src/device/lock.ts +55 -26
  138. package/src/device/meter.ts +60 -29
  139. package/src/device/meterplus.ts +56 -29
  140. package/src/device/motion.ts +50 -26
  141. package/src/device/plug.ts +38 -18
  142. package/src/device/robotvacuumcleaner.ts +53 -24
  143. package/src/device/waterdetector.ts +62 -28
  144. package/src/homebridge-ui/public/index.html +2 -2
  145. package/src/irdevice/airconditioner.ts +76 -165
  146. package/src/irdevice/airpurifier.ts +29 -49
  147. package/src/irdevice/camera.ts +13 -16
  148. package/src/irdevice/fan.ts +25 -35
  149. package/src/irdevice/irdevice.ts +97 -96
  150. package/src/irdevice/light.ts +21 -35
  151. package/src/irdevice/other.ts +79 -77
  152. package/src/irdevice/tv.ts +40 -51
  153. package/src/irdevice/vacuumcleaner.ts +12 -15
  154. package/src/irdevice/waterheater.ts +12 -15
  155. package/src/platform.ts +566 -696
  156. package/src/settings.ts +11 -8
  157. package/src/types/bledevicestatus.ts +4 -2
  158. package/src/types/devicestatus.ts +1 -1
  159. package/.github/npm-version-script.cjs +0 -81
@@ -42,6 +42,8 @@ export class Light extends irdeviceBase {
42
42
  device: irdevice & irDevicesConfig,
43
43
  ) {
44
44
  super(platform, accessory, device);
45
+ // Set category
46
+ accessory.category = this.hap.Categories.LIGHTBULB;
45
47
 
46
48
  if (!device.irlight?.stateless) {
47
49
  // Initialize LightBulb Service
@@ -127,7 +129,7 @@ export class Light extends irdeviceBase {
127
129
  }
128
130
 
129
131
  async OnSet(value: CharacteristicValue): Promise<void> {
130
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
132
+ await this.debugLog(`On: ${value}`);
131
133
 
132
134
  this.LightBulb!.On = value;
133
135
  if (this.LightBulb?.On) {
@@ -144,7 +146,7 @@ export class Light extends irdeviceBase {
144
146
  }
145
147
 
146
148
  async ProgrammableSwitchOutputStateSetOn(value: CharacteristicValue): Promise<void> {
147
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
149
+ await this.debugLog(`On: ${value}`);
148
150
 
149
151
  this.ProgrammableSwitchOn!.ProgrammableSwitchOutputState = value;
150
152
  if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === 1) {
@@ -158,7 +160,7 @@ export class Light extends irdeviceBase {
158
160
  }
159
161
 
160
162
  async ProgrammableSwitchOutputStateSetOff(value: CharacteristicValue): Promise<void> {
161
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
163
+ await this.debugLog(`On: ${value}`);
162
164
 
163
165
  this.ProgrammableSwitchOff!.ProgrammableSwitchOutputState = value;
164
166
  if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === 1) {
@@ -184,7 +186,7 @@ export class Light extends irdeviceBase {
184
186
  * Light - "command" "channelSub" "default" = previous channel
185
187
  */
186
188
  async pushLightOnChanges(On: boolean): Promise<void> {
187
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`);
189
+ await this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`);
188
190
  if (On === true && this.disablePushOn === false) {
189
191
  const commandType: string = await this.commandType();
190
192
  const command: string = await this.commandOn();
@@ -198,7 +200,7 @@ export class Light extends irdeviceBase {
198
200
  }
199
201
 
200
202
  async pushLightOffChanges(On: boolean): Promise<void> {
201
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`);
203
+ await this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`);
202
204
  if (On === false && this.disablePushOff === false) {
203
205
  const commandType: string = await this.commandType();
204
206
  const command: string = await this.commandOff();
@@ -212,14 +214,14 @@ export class Light extends irdeviceBase {
212
214
  }
213
215
 
214
216
  async pushChanges(bodyChange: any, On: boolean): Promise<void> {
215
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
217
+ this.debugLog('pushChanges');
216
218
  if (this.device.connectionType === 'OpenAPI') {
217
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
219
+ this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
218
220
  try {
219
221
  const { body, statusCode } = await this.pushChangeRequest(bodyChange);
220
222
  const deviceStatus: any = await body.json();
221
223
  await this.pushStatusCodes(statusCode, deviceStatus);
222
- if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
224
+ if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
223
225
  await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
224
226
  this.accessory.context.On = On;
225
227
  await this.updateHomeKitCharacteristics();
@@ -232,43 +234,27 @@ export class Light extends irdeviceBase {
232
234
  await this.pushChangeError(e);
233
235
  }
234
236
  } else {
235
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Connection Type: `
237
+ this.warnLog('Connection Type: '
236
238
  + `${this.device.connectionType}, commands will not be sent to OpenAPI`);
237
239
  }
238
240
  }
239
241
 
240
242
  async updateHomeKitCharacteristics(): Promise<void> {
241
- if (!this.device.irlight?.stateless) {
243
+ await this.debugLog('updateHomeKitCharacteristics');
244
+ if (!this.device.irlight?.stateless && this.LightBulb?.Service) {
242
245
  // On
243
- if (this.LightBulb?.On === undefined) {
244
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.LightBulb?.On}`);
245
- } else {
246
- this.accessory.context.On = this.LightBulb.On;
247
- 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
- }
246
+ await this.updateCharacteristic(this.LightBulb.Service, this.hap.Characteristic.On,
247
+ this.LightBulb.On, 'On');
250
248
  } else {
249
+ if (this.ProgrammableSwitchOn?.Service) {
251
250
  // On Stateful Programmable Switch
252
- if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === undefined) {
253
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
254
- + ` ProgrammableSwitchOutputStateOn: ${this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState}`);
255
- } else {
256
- this.accessory.context.ProgrammableSwitchOutputStateOn = this.ProgrammableSwitchOn.ProgrammableSwitchOutputState;
257
- this.ProgrammableSwitchOn?.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState,
258
- this.ProgrammableSwitchOn.ProgrammableSwitchOutputState);
259
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
260
- + ` ProgrammableSwitchOutputStateOn: ${this.ProgrammableSwitchOn.ProgrammableSwitchOutputState}`);
251
+ await this.updateCharacteristic(this.ProgrammableSwitchOn.Service, this.hap.Characteristic.ProgrammableSwitchOutputState,
252
+ this.ProgrammableSwitchOn.ProgrammableSwitchOutputState, 'ProgrammableSwitchOutputState');
261
253
  }
254
+ if (this.ProgrammableSwitchOff?.Service) {
262
255
  // Off Stateful Programmable Switch
263
- if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === undefined) {
264
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
265
- + ` ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
266
- } else {
267
- this.accessory.context.ProgrammableSwitchOutputStateOff = this.ProgrammableSwitchOff.ProgrammableSwitchOutputState;
268
- this.ProgrammableSwitchOff.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState,
269
- this.ProgrammableSwitchOff.ProgrammableSwitchOutputState);
270
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
271
- + ` ProgrammableSwitchOutputStateOff: ${this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState}`);
256
+ await this.updateCharacteristic(this.ProgrammableSwitchOff.Service, this.hap.Characteristic.ProgrammableSwitchOutputState,
257
+ this.ProgrammableSwitchOff.ProgrammableSwitchOutputState, 'ProgrammableSwitchOutputState');
272
258
  }
273
259
  }
274
260
  }
@@ -85,6 +85,8 @@ export class Others extends irdeviceBase {
85
85
  device: irdevice & irDevicesConfig,
86
86
  ) {
87
87
  super(platform, accessory, device);
88
+ // Set category
89
+ accessory.category = this.hap.Categories.OTHER;
88
90
 
89
91
  // default placeholders
90
92
  this.getOtherConfigSettings(device);
@@ -99,7 +101,7 @@ export class Others extends irdeviceBase {
99
101
  On: accessory.context.On ?? false,
100
102
  };
101
103
  accessory.context.Switch = this.Switch as object;
102
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Switch`);
104
+ this.debugWarnLog('Displaying as Switch');
103
105
 
104
106
  this.Switch.Service
105
107
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -128,7 +130,7 @@ export class Others extends irdeviceBase {
128
130
  On: accessory.context.On ?? false,
129
131
  };
130
132
  accessory.context.GarageDoor = this.GarageDoor as object;
131
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Garage Door Opener`);
133
+ this.debugWarnLog('Displaying as Garage Door Opener');
132
134
 
133
135
  this.GarageDoor.Service
134
136
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -158,7 +160,7 @@ export class Others extends irdeviceBase {
158
160
  On: accessory.context.On ?? false,
159
161
  };
160
162
  accessory.context.Door = this.Door as object;
161
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Door`);
163
+ this.debugWarnLog('Displaying as Door');
162
164
 
163
165
  this.Door!.Service
164
166
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -194,7 +196,7 @@ export class Others extends irdeviceBase {
194
196
  On: accessory.context.On ?? false,
195
197
  };
196
198
  accessory.context.Window = this.Window as object;
197
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window`);
199
+ this.debugWarnLog('Displaying as Window');
198
200
 
199
201
  this.Window!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
200
202
  .setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
@@ -229,7 +231,7 @@ export class Others extends irdeviceBase {
229
231
  On: accessory.context.On ?? false,
230
232
  };
231
233
  accessory.context.WindowCovering = this.WindowCovering as object;
232
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window Covering`);
234
+ this.debugWarnLog('Displaying as Window Covering');
233
235
 
234
236
  this.WindowCovering.Service
235
237
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -265,7 +267,7 @@ export class Others extends irdeviceBase {
265
267
  On: accessory.context.On ?? false,
266
268
  };
267
269
  accessory.context.LockMechanism = this.LockMechanism as object;
268
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Lock`);
270
+ this.debugWarnLog('Displaying as Lock');
269
271
 
270
272
  this.LockMechanism.Service
271
273
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -294,7 +296,7 @@ export class Others extends irdeviceBase {
294
296
  On: accessory.context.On ?? false,
295
297
  };
296
298
  accessory.context.Faucet = this.Faucet as object;
297
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Faucet`);
299
+ this.debugWarnLog('Displaying as Faucet');
298
300
 
299
301
  this.Faucet.Service
300
302
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -323,7 +325,7 @@ export class Others extends irdeviceBase {
323
325
  On: accessory.context.On ?? false,
324
326
  };
325
327
  accessory.context.Fan = this.Fan as object;
326
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Fan`);
328
+ this.debugWarnLog('Displaying as Fan');
327
329
 
328
330
  this.Fan.Service
329
331
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -353,7 +355,7 @@ export class Others extends irdeviceBase {
353
355
  On: accessory.context.On ?? false,
354
356
  };
355
357
  accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
356
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
358
+ this.debugWarnLog('Displaying as Stateful Programmable Switch');
357
359
 
358
360
  this.StatefulProgrammableSwitch.Service
359
361
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -382,7 +384,7 @@ export class Others extends irdeviceBase {
382
384
  On: accessory.context.On ?? false,
383
385
  };
384
386
  accessory.context.Outlet = this.Outlet as object;
385
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Outlet`);
387
+ this.debugWarnLog('Displaying as Outlet');
386
388
 
387
389
  this.Outlet.Service
388
390
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
@@ -411,7 +413,7 @@ export class Others extends irdeviceBase {
411
413
  async OnSet(value: CharacteristicValue): Promise<void> {
412
414
  let On: boolean;
413
415
  if (this.otherDeviceType === 'garagedoor') {
414
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetDoorState: ${value}`);
416
+ this.infoLog(`Set TargetDoorState: ${value}`);
415
417
  if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
416
418
  this.GarageDoor!.On = false;
417
419
  } else {
@@ -419,7 +421,7 @@ export class Others extends irdeviceBase {
419
421
  }
420
422
  On = this.GarageDoor!.On;
421
423
  } else if (this.otherDeviceType === 'door') {
422
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
424
+ this.infoLog(`Set TargetPosition: ${value}`);
423
425
  if (value === 0) {
424
426
  this.Door!.On = false;
425
427
  } else {
@@ -427,7 +429,7 @@ export class Others extends irdeviceBase {
427
429
  }
428
430
  On = this.Door!.On;
429
431
  } else if (this.otherDeviceType === 'window') {
430
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
432
+ this.infoLog(`Set TargetPosition: ${value}`);
431
433
  if (value === 0) {
432
434
  this.Window!.On = false;
433
435
  } else {
@@ -435,7 +437,7 @@ export class Others extends irdeviceBase {
435
437
  }
436
438
  On = this.Window!.On;
437
439
  } else if (this.otherDeviceType === 'windowcovering') {
438
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
440
+ this.infoLog(`Set TargetPosition: ${value}`);
439
441
  if (value === 0) {
440
442
  this.WindowCovering!.On = false;
441
443
  } else {
@@ -443,7 +445,7 @@ export class Others extends irdeviceBase {
443
445
  }
444
446
  On = this.WindowCovering!.On;
445
447
  } else if (this.otherDeviceType === 'lock') {
446
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set LockTargetState: ${value}`);
448
+ this.infoLog(`Set LockTargetState: ${value}`);
447
449
  if (value === this.hap.Characteristic.LockTargetState.SECURED) {
448
450
  this.LockMechanism!.On = false;
449
451
  } else {
@@ -451,7 +453,7 @@ export class Others extends irdeviceBase {
451
453
  }
452
454
  On = this.LockMechanism!.On;
453
455
  } else if (this.otherDeviceType === 'faucet') {
454
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
456
+ this.infoLog(`Set Active: ${value}`);
455
457
  if (value === this.hap.Characteristic.Active.INACTIVE) {
456
458
  this.Faucet!.On = false;
457
459
  } else {
@@ -459,7 +461,7 @@ export class Others extends irdeviceBase {
459
461
  }
460
462
  On = this.Faucet!.On;
461
463
  } else if (this.otherDeviceType === 'stateful') {
462
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ProgrammableSwitchOutputState: ${value}`);
464
+ this.infoLog(`Set ProgrammableSwitchOutputState: ${value}`);
463
465
  if (value === 0) {
464
466
  this.StatefulProgrammableSwitch!.On = false;
465
467
  } else {
@@ -468,7 +470,7 @@ export class Others extends irdeviceBase {
468
470
 
469
471
  On = this.StatefulProgrammableSwitch!.On;
470
472
  } else {
471
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set On: ${value}`);
473
+ this.infoLog(`Set On: ${value}`);
472
474
  this.Outlet!.On = value;
473
475
  On = this.Outlet!.On ? true : false;
474
476
  }
@@ -492,7 +494,7 @@ export class Others extends irdeviceBase {
492
494
  * Other - "command" "channelSub" "default" = previous channel
493
495
  */
494
496
  async pushOnChanges(On: boolean): Promise<void> {
495
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${On},`
497
+ await this.debugLog(`pushOnChanges On: ${On},`
496
498
  + ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
497
499
  if (this.device.customize) {
498
500
  if (On === true && !this.disablePushOn) {
@@ -506,12 +508,12 @@ export class Others extends irdeviceBase {
506
508
  await this.pushChanges(bodyChange);
507
509
  }
508
510
  } else {
509
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set`);
511
+ this.errorLog('On Command not set');
510
512
  }
511
513
  }
512
514
 
513
515
  async pushOffChanges(On: boolean): Promise<void> {
514
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${On},`
516
+ await this.debugLog(`pushOffChanges On: ${On},`
515
517
  + ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
516
518
  if (this.device.customize) {
517
519
  if (On === false && !this.disablePushOff) {
@@ -525,19 +527,19 @@ export class Others extends irdeviceBase {
525
527
  await this.pushChanges(bodyChange);
526
528
  }
527
529
  } else {
528
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set.`);
530
+ this.errorLog('Off Command not set.');
529
531
  }
530
532
  }
531
533
 
532
534
  async pushChanges(bodyChange: any): Promise<void> {
533
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
535
+ await this.debugLog('pushChanges');
534
536
  if (this.device.connectionType === 'OpenAPI') {
535
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
537
+ this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
536
538
  try {
537
539
  const { body, statusCode } = await this.pushChangeRequest(bodyChange);
538
540
  const deviceStatus: any = await body.json();
539
541
  await this.pushStatusCodes(statusCode, deviceStatus);
540
- if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
542
+ if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
541
543
  await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
542
544
  await this.updateHomeKitCharacteristics();
543
545
  } else {
@@ -549,165 +551,165 @@ export class Others extends irdeviceBase {
549
551
  await this.pushChangeError(e);
550
552
  }
551
553
  } else {
552
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
553
- + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
554
+ await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
554
555
  }
555
556
  }
556
557
 
557
558
  async updateHomeKitCharacteristics(): Promise<void> {
559
+ await this.debugLog('updateHomeKitCharacteristics');
558
560
  if (this.otherDeviceType === 'garagedoor') {
559
561
  if (this.GarageDoor!.On === undefined) {
560
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.GarageDoor!.On}`);
562
+ await this.debugLog(`On: ${this.GarageDoor!.On}`);
561
563
  } else {
562
564
  if (this.GarageDoor!.On) {
563
565
  this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
564
566
  this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
565
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
567
+ await this.debugLog('updateCharacteristic'
566
568
  + ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor!.On})`);
567
569
  } else {
568
570
  this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
569
571
  this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
570
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
572
+ await this.debugLog('updateCharacteristic'
571
573
  + ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor!.On})`);
572
574
  }
573
575
  }
574
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Garage Door On: ${this.GarageDoor!.On}`);
576
+ await this.debugLog(`Garage Door On: ${this.GarageDoor!.On}`);
575
577
  } else if (this.otherDeviceType === 'door') {
576
578
  if (this.Door!.On === undefined) {
577
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Door!.On}`);
579
+ await this.debugLog(`On: ${this.Door!.On}`);
578
580
  } else {
579
581
  if (this.Door!.On) {
580
582
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
581
583
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
582
584
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
583
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
585
+ await this.debugLog('updateCharacteristic'
584
586
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.Door!.On})`);
585
587
  } else {
586
588
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
587
589
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
588
590
  this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
589
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
591
+ await this.debugLog('updateCharacteristic'
590
592
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.Door!.On})`);
591
593
  }
592
594
  }
593
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Door On: ${this.Door!.On}`);
595
+ await this.debugLog(`Door On: ${this.Door!.On}`);
594
596
  } else if (this.otherDeviceType === 'window') {
595
597
  if (this.Window!.On === undefined) {
596
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Window!.On}`);
598
+ await this.debugLog(`On: ${this.Window!.On}`);
597
599
  } else {
598
600
  if (this.Window!.On) {
599
601
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
600
602
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
601
603
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
602
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
604
+ await this.debugLog('updateCharacteristic'
603
605
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.Window!.On})`);
604
606
  } else {
605
607
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
606
608
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
607
609
  this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
608
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
610
+ await this.debugLog('updateCharacteristic'
609
611
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.Window!.On})`);
610
612
  }
611
613
  }
612
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window On: ${this.Window!.On}`);
614
+ await this.debugLog(`Window On: ${this.Window!.On}`);
613
615
  } else if (this.otherDeviceType === 'windowcovering') {
614
616
  if (this.WindowCovering!.On === undefined) {
615
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.WindowCovering!.On}`);
617
+ await this.debugLog(`On: ${this.WindowCovering!.On}`);
616
618
  } else {
617
619
  if (this.WindowCovering!.On) {
618
620
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
619
621
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
620
622
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
621
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
623
+ await this.debugLog('updateCharacteristic'
622
624
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering!.On})`);
623
625
  } else {
624
626
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
625
627
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
626
628
  this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
627
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
629
+ await this.debugLog('updateCharacteristic'
628
630
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering!.On})`);
629
631
  }
630
632
  }
631
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window Covering On: ${this.WindowCovering!.On}`);
633
+ await this.debugLog(`Window Covering On: ${this.WindowCovering!.On}`);
632
634
  } else if (this.otherDeviceType === 'lock') {
633
635
  if (this.LockMechanism?.On === undefined) {
634
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.LockMechanism?.On}`);
636
+ await this.debugLog(`On: ${this.LockMechanism?.On}`);
635
637
  } else {
636
638
  if (this.LockMechanism.On) {
637
639
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState,
638
640
  this.hap.Characteristic.LockTargetState.UNSECURED);
639
641
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState,
640
642
  this.hap.Characteristic.LockCurrentState.UNSECURED);
641
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
643
+ await this.debugLog('updateCharacteristic'
642
644
  + ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
643
645
  } else {
644
646
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState,
645
647
  this.hap.Characteristic.LockTargetState.SECURED);
646
648
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState,
647
649
  this.hap.Characteristic.LockCurrentState.SECURED);
648
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
650
+ await this.debugLog('updateCharacteristic'
649
651
  + ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
650
652
  }
651
653
  }
652
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Lock On: ${this.LockMechanism?.On}`);
654
+ await this.debugLog(`Lock On: ${this.LockMechanism?.On}`);
653
655
  } else if (this.otherDeviceType === 'faucet') {
654
656
  if (this.Faucet!.On === undefined) {
655
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Faucet!.On}`);
657
+ await this.debugLog(`On: ${this.Faucet!.On}`);
656
658
  } else {
657
659
  if (this.Faucet!.On) {
658
660
  this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
659
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet!.On}`);
661
+ await this.debugLog(`updateCharacteristic Active: ${this.Faucet!.On}`);
660
662
  } else {
661
663
  this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
662
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet!.On}`);
664
+ await this.debugLog(`updateCharacteristic Active: ${this.Faucet!.On}`);
663
665
  }
664
666
  }
665
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Faucet On: ${this.Faucet!.On}`);
667
+ await this.debugLog(`Faucet On: ${this.Faucet!.On}`);
666
668
  } else if (this.otherDeviceType === 'fan') {
667
669
  if (this.Fan!.On === undefined) {
668
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Fan!.On}`);
670
+ await this.debugLog(`On: ${this.Fan!.On}`);
669
671
  } else {
670
672
  if (this.Fan!.On) {
671
673
  this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
672
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan!.On}`);
674
+ await this.debugLog(`updateCharacteristic On: ${this.Fan!.On}`);
673
675
  } else {
674
676
  this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
675
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan!.On}`);
677
+ await this.debugLog(`updateCharacteristic On: ${this.Fan!.On}`);
676
678
  }
677
679
  }
678
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Fan On: ${this.Fan!.On}`);
680
+ await this.debugLog(`Fan On: ${this.Fan!.On}`);
679
681
  } else if (this.otherDeviceType === 'stateful') {
680
682
  if (this.StatefulProgrammableSwitch!.On === undefined) {
681
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.StatefulProgrammableSwitch!.On}`);
683
+ await this.debugLog(`On: ${this.StatefulProgrammableSwitch!.On}`);
682
684
  } else {
683
685
  if (this.StatefulProgrammableSwitch!.On) {
684
686
  this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
685
687
  this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
686
688
  this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
687
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
689
+ await this.debugLog('updateCharacteristic'
688
690
  + ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch!.On})`);
689
691
  } else {
690
692
  this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
691
693
  this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
692
694
  this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
693
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
695
+ await this.debugLog('updateCharacteristic'
694
696
  + ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch!.On})`);
695
697
  }
696
698
  }
697
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch!.On}`);
699
+ await this.debugLog(`StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch!.On}`);
698
700
  } else if (this.otherDeviceType === 'switch') {
699
701
  if (this.Switch!.On === undefined) {
700
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Switch!.On}`);
702
+ await this.debugLog(`On: ${this.Switch!.On}`);
701
703
  } else {
702
704
  this.Switch!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch!.On);
703
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch!.On}`);
705
+ await this.debugLog(`updateCharacteristic On: ${this.Switch!.On}`);
704
706
  }
705
707
  } else {
706
708
  if (this.Outlet!.On === undefined) {
707
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Outlet!.On}`);
709
+ await this.debugLog(`On: ${this.Outlet!.On}`);
708
710
  } else {
709
711
  this.Outlet!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet!.On);
710
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Outlet!.On}`);
712
+ await this.debugLog(`updateCharacteristic On: ${this.Outlet!.On}`);
711
713
  }
712
714
  }
713
715
  }
@@ -770,7 +772,7 @@ export class Others extends irdeviceBase {
770
772
  // If Outlet.Service still present, then remove first
771
773
  if (this.Outlet?.Service) {
772
774
  this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet) as Service;
773
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Outlet Service`);
775
+ this.warnLog('Removing Leftover Outlet Service');
774
776
  accessory.removeService(this.Outlet.Service);
775
777
  }
776
778
  }
@@ -779,7 +781,7 @@ export class Others extends irdeviceBase {
779
781
  // If GarageDoor.Service still present, then remove first
780
782
  if (this.GarageDoor?.Service) {
781
783
  this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener) as Service;
782
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Garage Door Service`);
784
+ this.warnLog('Removing Leftover Garage Door Service');
783
785
  accessory.removeService(this.GarageDoor.Service);
784
786
  }
785
787
  }
@@ -788,7 +790,7 @@ export class Others extends irdeviceBase {
788
790
  // If Door.Service still present, then remove first
789
791
  if (this.Door?.Service) {
790
792
  this.Door.Service = this.accessory.getService(this.hap.Service.Door) as Service;
791
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Door Service`);
793
+ this.warnLog('Removing Leftover Door Service');
792
794
  accessory.removeService(this.Door.Service);
793
795
  }
794
796
  }
@@ -797,7 +799,7 @@ export class Others extends irdeviceBase {
797
799
  // If Lock.Service still present, then remove first
798
800
  if (this.LockMechanism?.Service) {
799
801
  this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism) as Service;
800
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Lock Service`);
802
+ this.warnLog('Removing Leftover Lock Service');
801
803
  accessory.removeService(this.LockMechanism.Service);
802
804
  }
803
805
  }
@@ -806,7 +808,7 @@ export class Others extends irdeviceBase {
806
808
  // If Faucet.Service still present, then remove first
807
809
  if (this.Faucet?.Service) {
808
810
  this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet) as Service;
809
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Faucet Service`);
811
+ this.warnLog('Removing Leftover Faucet Service');
810
812
  accessory.removeService(this.Faucet.Service);
811
813
  }
812
814
  }
@@ -815,7 +817,7 @@ export class Others extends irdeviceBase {
815
817
  // If Fan Service still present, then remove first
816
818
  if (this.Fan?.Service) {
817
819
  this.Fan.Service = this.accessory.getService(this.hap.Service.Fan) as Service;
818
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Fan Service`);
820
+ this.warnLog('Removing Leftover Fan Service');
819
821
  accessory.removeService(this.Fan.Service);
820
822
  }
821
823
  }
@@ -824,7 +826,7 @@ export class Others extends irdeviceBase {
824
826
  // If Window.Service still present, then remove first
825
827
  if (this.Window?.Service) {
826
828
  this.Window.Service = this.accessory.getService(this.hap.Service.Window) as Service;
827
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Service`);
829
+ this.warnLog('Removing Leftover Window Service');
828
830
  accessory.removeService(this.Window.Service);
829
831
  }
830
832
  }
@@ -833,7 +835,7 @@ export class Others extends irdeviceBase {
833
835
  // If WindowCovering.Service still present, then remove first
834
836
  if (this.WindowCovering?.Service) {
835
837
  this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering) as Service;
836
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Covering Service`);
838
+ this.warnLog('Removing Leftover Window Covering Service');
837
839
  accessory.removeService(this.WindowCovering.Service);
838
840
  }
839
841
  }
@@ -842,7 +844,7 @@ export class Others extends irdeviceBase {
842
844
  // If StatefulProgrammableSwitch.Service still present, then remove first
843
845
  if (this.StatefulProgrammableSwitch?.Service) {
844
846
  this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service;
845
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Stateful Programmable Switch Service`);
847
+ this.warnLog('Removing Leftover Stateful Programmable Switch Service');
846
848
  accessory.removeService(this.StatefulProgrammableSwitch.Service);
847
849
  }
848
850
  }
@@ -851,7 +853,7 @@ export class Others extends irdeviceBase {
851
853
  // If Switch.Service still present, then remove first
852
854
  if (this.Switch?.Service) {
853
855
  this.Switch.Service = this.accessory.getService(this.hap.Service.Switch) as Service;
854
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Switch Service`);
856
+ this.warnLog('Removing Leftover Switch Service');
855
857
  accessory.removeService(this.Switch.Service);
856
858
  }
857
859
  }
@@ -859,15 +861,15 @@ export class Others extends irdeviceBase {
859
861
  async getOtherConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
860
862
  if (!device.other?.deviceType && this.accessory.context.deviceType) {
861
863
  this.otherDeviceType = this.accessory.context.deviceType;
862
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
864
+ await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
863
865
  } else if (device.other?.deviceType) {
864
866
  this.accessory.context.deviceType = device.other.deviceType;
865
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Accessory Cache: ${this.accessory.context.deviceType}`);
867
+ await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
866
868
  this.otherDeviceType = this.accessory.context.deviceType;
867
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
869
+ await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
868
870
  } else {
869
871
  this.otherDeviceType = 'outlet';
870
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} no deviceType set, using default deviceType: ${this.otherDeviceType}`);
872
+ this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
871
873
  }
872
874
  }
873
875
  }