@switchbot/homebridge-switchbot 1.8.2 → 1.8.3-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.
Files changed (104) hide show
  1. package/.eslintrc +1 -1
  2. package/.vscode/extensions.json +5 -0
  3. package/.vscode/settings.json +15 -0
  4. package/dist/devices/bots.d.ts +34 -35
  5. package/dist/devices/bots.d.ts.map +1 -1
  6. package/dist/devices/bots.js +241 -184
  7. package/dist/devices/bots.js.map +1 -1
  8. package/dist/devices/colorbulb.d.ts +50 -50
  9. package/dist/devices/colorbulb.d.ts.map +1 -1
  10. package/dist/devices/colorbulb.js +145 -131
  11. package/dist/devices/colorbulb.js.map +1 -1
  12. package/dist/devices/contact.d.ts +27 -29
  13. package/dist/devices/contact.d.ts.map +1 -1
  14. package/dist/devices/contact.js +138 -115
  15. package/dist/devices/contact.js.map +1 -1
  16. package/dist/devices/curtains.d.ts +29 -31
  17. package/dist/devices/curtains.d.ts.map +1 -1
  18. package/dist/devices/curtains.js +211 -176
  19. package/dist/devices/curtains.js.map +1 -1
  20. package/dist/devices/humidifiers.d.ts +33 -33
  21. package/dist/devices/humidifiers.d.ts.map +1 -1
  22. package/dist/devices/humidifiers.js +214 -189
  23. package/dist/devices/humidifiers.js.map +1 -1
  24. package/dist/devices/meters.d.ts +30 -31
  25. package/dist/devices/meters.d.ts.map +1 -1
  26. package/dist/devices/meters.js +124 -100
  27. package/dist/devices/meters.js.map +1 -1
  28. package/dist/devices/motion.d.ts +25 -26
  29. package/dist/devices/motion.d.ts.map +1 -1
  30. package/dist/devices/motion.js +120 -102
  31. package/dist/devices/motion.js.map +1 -1
  32. package/dist/devices/plugs.d.ts +23 -23
  33. package/dist/devices/plugs.d.ts.map +1 -1
  34. package/dist/devices/plugs.js +81 -63
  35. package/dist/devices/plugs.js.map +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +22 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/irdevices/airconditioners.d.ts +6 -6
  41. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  42. package/dist/irdevices/airconditioners.js +105 -79
  43. package/dist/irdevices/airconditioners.js.map +1 -1
  44. package/dist/irdevices/airpurifiers.d.ts +5 -5
  45. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  46. package/dist/irdevices/airpurifiers.js +56 -42
  47. package/dist/irdevices/airpurifiers.js.map +1 -1
  48. package/dist/irdevices/cameras.d.ts +5 -5
  49. package/dist/irdevices/cameras.d.ts.map +1 -1
  50. package/dist/irdevices/cameras.js +31 -27
  51. package/dist/irdevices/cameras.js.map +1 -1
  52. package/dist/irdevices/fans.d.ts +5 -5
  53. package/dist/irdevices/fans.d.ts.map +1 -1
  54. package/dist/irdevices/fans.js +45 -38
  55. package/dist/irdevices/fans.js.map +1 -1
  56. package/dist/irdevices/lights.d.ts +5 -5
  57. package/dist/irdevices/lights.d.ts.map +1 -1
  58. package/dist/irdevices/lights.js +37 -33
  59. package/dist/irdevices/lights.js.map +1 -1
  60. package/dist/irdevices/others.d.ts +5 -5
  61. package/dist/irdevices/others.d.ts.map +1 -1
  62. package/dist/irdevices/others.js +34 -29
  63. package/dist/irdevices/others.js.map +1 -1
  64. package/dist/irdevices/tvs.d.ts +5 -5
  65. package/dist/irdevices/tvs.d.ts.map +1 -1
  66. package/dist/irdevices/tvs.js +91 -76
  67. package/dist/irdevices/tvs.js.map +1 -1
  68. package/dist/irdevices/vacuumcleaners.d.ts +5 -5
  69. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  70. package/dist/irdevices/vacuumcleaners.js +31 -27
  71. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  72. package/dist/irdevices/waterheaters.d.ts +5 -5
  73. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  74. package/dist/irdevices/waterheaters.js +31 -27
  75. package/dist/irdevices/waterheaters.js.map +1 -1
  76. package/dist/platform.d.ts +12 -12
  77. package/dist/platform.d.ts.map +1 -1
  78. package/dist/platform.js +241 -172
  79. package/dist/platform.js.map +1 -1
  80. package/dist/settings.d.ts +1 -1
  81. package/dist/settings.d.ts.map +1 -1
  82. package/dist/settings.js +4 -4
  83. package/dist/settings.js.map +1 -1
  84. package/package.json +72 -71
  85. package/src/devices/bots.ts +927 -442
  86. package/src/devices/colorbulb.ts +473 -246
  87. package/src/devices/contact.ts +381 -208
  88. package/src/devices/curtains.ts +613 -321
  89. package/src/devices/humidifiers.ts +594 -323
  90. package/src/devices/meters.ts +331 -186
  91. package/src/devices/motion.ts +327 -184
  92. package/src/devices/plugs.ts +175 -107
  93. package/src/index.ts +5 -5
  94. package/src/irdevices/airconditioners.ts +360 -149
  95. package/src/irdevices/airpurifiers.ts +178 -80
  96. package/src/irdevices/cameras.ts +109 -51
  97. package/src/irdevices/fans.ts +174 -77
  98. package/src/irdevices/lights.ts +110 -57
  99. package/src/irdevices/others.ts +137 -62
  100. package/src/irdevices/tvs.ts +249 -124
  101. package/src/irdevices/vacuumcleaners.ts +112 -52
  102. package/src/irdevices/waterheaters.ts +115 -53
  103. package/src/platform.ts +768 -357
  104. package/src/settings.ts +17 -23
@@ -1,7 +1,13 @@
1
- import { AxiosResponse } from 'axios';
2
- import { SwitchBotPlatform } from '../platform';
3
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
- import { DeviceURL, irdevice, deviceStatusResponse, irDevicesConfig, payload } from '../settings';
1
+ import { AxiosResponse } from "axios";
2
+ import { SwitchBotPlatform } from "../platform";
3
+ import { CharacteristicValue, PlatformAccessory, Service } from "homebridge";
4
+ import {
5
+ DeviceURL,
6
+ irdevice,
7
+ deviceStatusResponse,
8
+ irDevicesConfig,
9
+ payload,
10
+ } from "../settings";
5
11
 
6
12
  /**
7
13
  * Platform Accessory
@@ -46,15 +52,19 @@ export class Fan {
46
52
  // set accessory information
47
53
  accessory
48
54
  .getService(this.platform.Service.AccessoryInformation)!
49
- .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
55
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, "SwitchBot")
50
56
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
51
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
57
+ .setCharacteristic(
58
+ this.platform.Characteristic.SerialNumber,
59
+ device.deviceId!,
60
+ );
52
61
 
53
62
  // get the Television service if it exists, otherwise create a new Television service
54
63
  // you can create multiple services for each accessory
55
64
  (this.service =
56
65
  accessory.getService(this.platform.Service.Fanv2) ||
57
- accessory.addService(this.platform.Service.Fanv2)), `${accessory.displayName} Fan`;
66
+ accessory.addService(this.platform.Service.Fanv2)),
67
+ `${accessory.displayName} Fan`;
58
68
 
59
69
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
60
70
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
@@ -62,10 +72,15 @@ export class Fan {
62
72
 
63
73
  // set the service name, this is what is displayed as the default name on the Home app
64
74
  // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
65
- this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
75
+ this.service.setCharacteristic(
76
+ this.platform.Characteristic.Name,
77
+ accessory.displayName,
78
+ );
66
79
 
67
80
  // handle on / off events using the Active characteristic
68
- this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
81
+ this.service
82
+ .getCharacteristic(this.platform.Characteristic.Active)
83
+ .onSet(this.ActiveSet.bind(this));
69
84
 
70
85
  if (device.irfan?.rotation_speed) {
71
86
  if (device.irfan?.set_minStep) {
@@ -93,27 +108,46 @@ export class Fan {
93
108
  })
94
109
  .onSet(this.RotationSpeedSet.bind(this));
95
110
  } else if (
96
- this.service.testCharacteristic(this.platform.Characteristic.RotationSpeed) &&
97
- !device.irfan?.swing_mode) {
98
- const characteristic = this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed);
111
+ this.service.testCharacteristic(
112
+ this.platform.Characteristic.RotationSpeed,
113
+ ) &&
114
+ !device.irfan?.swing_mode
115
+ ) {
116
+ const characteristic = this.service.getCharacteristic(
117
+ this.platform.Characteristic.RotationSpeed,
118
+ );
99
119
  this.service.removeCharacteristic(characteristic);
100
- this.debugLog(`Fan: ${this.accessory.displayName} Rotation Speed Characteristic was removed.`);
120
+ this.debugLog(
121
+ `Fan: ${this.accessory.displayName} Rotation Speed Characteristic was removed.`,
122
+ );
101
123
  } else {
102
124
  // eslint-disable-next-line max-len
103
- this.debugLog(`Fan: ${this.accessory.displayName} Rotation Speed Characteristic was not removed or not added. To Remove Chracteristic, Clear Cache on this Accessory.`);
125
+ this.debugLog(
126
+ `Fan: ${this.accessory.displayName} Rotation Speed Characteristic was not removed or not added. To Remove Chracteristic, Clear Cache on this Accessory.`,
127
+ );
104
128
  }
105
129
 
106
130
  if (device.irfan?.swing_mode) {
107
131
  // handle Osolcation events using the SwingMode characteristic
108
- this.service.getCharacteristic(this.platform.Characteristic.SwingMode).onSet(this.SwingModeSet.bind(this));
109
- } else if (this.service.testCharacteristic(this.platform.Characteristic.SwingMode) && !device.irfan?.swing_mode) {
110
- const characteristic = this.service.getCharacteristic(this.platform.Characteristic.SwingMode);
132
+ this.service
133
+ .getCharacteristic(this.platform.Characteristic.SwingMode)
134
+ .onSet(this.SwingModeSet.bind(this));
135
+ } else if (
136
+ this.service.testCharacteristic(this.platform.Characteristic.SwingMode) &&
137
+ !device.irfan?.swing_mode
138
+ ) {
139
+ const characteristic = this.service.getCharacteristic(
140
+ this.platform.Characteristic.SwingMode,
141
+ );
111
142
  this.service.removeCharacteristic(characteristic);
112
- this.debugLog(`Fan: ${this.accessory.displayName} Swing Mode Characteristic was removed.`);
143
+ this.debugLog(
144
+ `Fan: ${this.accessory.displayName} Swing Mode Characteristic was removed.`,
145
+ );
113
146
  } else {
114
147
  // eslint-disable-next-line max-len
115
- this.debugLog(`Fan: ${this.accessory.displayName} Swing Mode Characteristic was not removed or not added. To Remove Chracteristic, Clear Cache on this Accessory.`);
116
-
148
+ this.debugLog(
149
+ `Fan: ${this.accessory.displayName} Swing Mode Characteristic was not removed or not added. To Remove Chracteristic, Clear Cache on this Accessory.`,
150
+ );
117
151
  }
118
152
  }
119
153
 
@@ -133,22 +167,43 @@ export class Fan {
133
167
 
134
168
  private updateHomeKitCharacteristics() {
135
169
  if (this.Active === undefined) {
136
- this.debugLog(`Fan: ${this.accessory.displayName} Active: ${this.Active}`);
170
+ this.debugLog(
171
+ `Fan: ${this.accessory.displayName} Active: ${this.Active}`,
172
+ );
137
173
  } else {
138
- this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
139
- this.debugLog(`Fan: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
174
+ this.service?.updateCharacteristic(
175
+ this.platform.Characteristic.Active,
176
+ this.Active,
177
+ );
178
+ this.debugLog(
179
+ `Fan: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`,
180
+ );
140
181
  }
141
182
  if (this.SwingMode === undefined) {
142
- this.debugLog(`Fan: ${this.accessory.displayName} SwingMode: ${this.SwingMode}`);
183
+ this.debugLog(
184
+ `Fan: ${this.accessory.displayName} SwingMode: ${this.SwingMode}`,
185
+ );
143
186
  } else {
144
- this.service?.updateCharacteristic(this.platform.Characteristic.SwingMode, this.SwingMode);
145
- this.debugLog(`Fan: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.SwingMode}`);
187
+ this.service?.updateCharacteristic(
188
+ this.platform.Characteristic.SwingMode,
189
+ this.SwingMode,
190
+ );
191
+ this.debugLog(
192
+ `Fan: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.SwingMode}`,
193
+ );
146
194
  }
147
195
  if (this.RotationSpeed === undefined) {
148
- this.debugLog(`Fan: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
196
+ this.debugLog(
197
+ `Fan: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`,
198
+ );
149
199
  } else {
150
- this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
151
- this.debugLog(`Fan: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
200
+ this.service?.updateCharacteristic(
201
+ this.platform.Characteristic.RotationSpeed,
202
+ this.RotationSpeed,
203
+ );
204
+ this.debugLog(
205
+ `Fan: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`,
206
+ );
152
207
  }
153
208
  }
154
209
 
@@ -189,9 +244,9 @@ export class Fan {
189
244
  async pushFanOnChanges() {
190
245
  if (this.Active !== 1) {
191
246
  const payload = {
192
- commandType: 'command',
193
- parameter: 'default',
194
- command: 'turnOn',
247
+ commandType: "command",
248
+ parameter: "default",
249
+ command: "turnOn",
195
250
  } as payload;
196
251
  await this.pushTVChanges(payload);
197
252
  }
@@ -199,87 +254,112 @@ export class Fan {
199
254
 
200
255
  async pushFanOffChanges() {
201
256
  const payload = {
202
- commandType: 'command',
203
- parameter: 'default',
204
- command: 'turnOff',
257
+ commandType: "command",
258
+ parameter: "default",
259
+ command: "turnOff",
205
260
  } as payload;
206
261
  await this.pushTVChanges(payload);
207
262
  }
208
263
 
209
264
  async pushFanSpeedUpChanges() {
210
265
  const payload = {
211
- commandType: 'command',
212
- parameter: 'default',
213
- command: 'highSpeed',
266
+ commandType: "command",
267
+ parameter: "default",
268
+ command: "highSpeed",
214
269
  } as payload;
215
270
  await this.pushTVChanges(payload);
216
271
  }
217
272
 
218
273
  async pushFanSpeedDownChanges() {
219
274
  const payload = {
220
- commandType: 'command',
221
- parameter: 'default',
222
- command: 'lowSpeed',
275
+ commandType: "command",
276
+ parameter: "default",
277
+ command: "lowSpeed",
223
278
  } as payload;
224
279
  await this.pushTVChanges(payload);
225
280
  }
226
281
 
227
282
  async pushFanSwingChanges() {
228
283
  const payload = {
229
- commandType: 'command',
230
- parameter: 'default',
231
- command: 'swing',
284
+ commandType: "command",
285
+ parameter: "default",
286
+ command: "swing",
232
287
  } as payload;
233
288
  await this.pushTVChanges(payload);
234
289
  }
235
290
 
236
291
  public async pushTVChanges(payload: payload) {
237
292
  try {
238
- this.infoLog(`Fan: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
239
- + ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
293
+ this.infoLog(
294
+ `Fan: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
295
+ ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`,
296
+ );
240
297
 
241
298
  // Make the API request
242
- const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
243
- this.debugLog(`Fan: ${this.accessory.displayName} pushTVChanges: ${push.data}`);
299
+ const push = await this.platform.axios.post(
300
+ `${DeviceURL}/${this.device.deviceId}/commands`,
301
+ payload,
302
+ );
303
+ this.debugLog(
304
+ `Fan: ${this.accessory.displayName} pushTVChanges: ${push.data}`,
305
+ );
244
306
  this.statusCode(push);
245
307
  this.updateHomeKitCharacteristics();
246
308
  } catch (e: any) {
247
- this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
248
- if (this.deviceLogging === 'debug') {
249
- this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
250
- + ` Error Message: ${JSON.stringify(e.message)}`);
309
+ this.errorLog(
310
+ `Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`,
311
+ );
312
+ if (this.deviceLogging === "debug") {
313
+ this.errorLog(
314
+ `Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
315
+ ` Error Message: ${JSON.stringify(e.message)}`,
316
+ );
251
317
  }
252
318
  if (this.platform.debugMode) {
253
- this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
254
- + ` Error: ${JSON.stringify(e)}`);
319
+ this.errorLog(
320
+ `Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
321
+ ` Error: ${JSON.stringify(e)}`,
322
+ );
255
323
  }
256
324
  this.apiError(e);
257
325
  }
258
326
  }
259
327
 
260
- private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
328
+ private statusCode(push: AxiosResponse<{ statusCode: number }>) {
261
329
  switch (push.data.statusCode) {
262
330
  case 151:
263
- this.errorLog(`Fan: ${this.accessory.displayName} Command not supported by this device type.`);
331
+ this.errorLog(
332
+ `Fan: ${this.accessory.displayName} Command not supported by this device type.`,
333
+ );
264
334
  break;
265
335
  case 152:
266
336
  this.errorLog(`Fan: ${this.accessory.displayName} Device not found.`);
267
337
  break;
268
338
  case 160:
269
- this.errorLog(`Fan: ${this.accessory.displayName} Command is not supported.`);
339
+ this.errorLog(
340
+ `Fan: ${this.accessory.displayName} Command is not supported.`,
341
+ );
270
342
  break;
271
343
  case 161:
272
344
  this.errorLog(`Fan: ${this.accessory.displayName} Device is offline.`);
273
345
  break;
274
346
  case 171:
275
- this.errorLog(`Fan: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
347
+ this.errorLog(
348
+ `Fan: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`,
349
+ );
276
350
  break;
277
351
  case 190:
278
- this.errorLog(`Fan: ${this.accessory.displayName} Device internal error due to device states not synchronized`
279
- + ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
352
+ this.errorLog(
353
+ `Fan: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
354
+ ` with server, Or command: ${JSON.stringify(
355
+ push.data,
356
+ )} format is invalid`,
357
+ );
280
358
  break;
281
359
  case 100:
282
- this.debugLog(`Fan: ${this.accessory.displayName} Command successfully sent.`);
360
+ this.debugLog(
361
+ `Fan: ${this.accessory.displayName} Command successfully sent.`,
362
+ );
283
363
  break;
284
364
  default:
285
365
  this.debugLog(`Fan: ${this.accessory.displayName} Unknown statusCode.`);
@@ -288,8 +368,14 @@ export class Fan {
288
368
 
289
369
  public apiError(e: any) {
290
370
  this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
291
- this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, e);
292
- this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
371
+ this.service.updateCharacteristic(
372
+ this.platform.Characteristic.RotationSpeed,
373
+ e,
374
+ );
375
+ this.service.updateCharacteristic(
376
+ this.platform.Characteristic.SwingMode,
377
+ e,
378
+ );
293
379
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
294
380
  }
295
381
 
@@ -299,32 +385,43 @@ export class Fan {
299
385
  config = device.irfan;
300
386
  }
301
387
  if (device.logging !== undefined) {
302
- config['logging'] = device.logging;
388
+ config["logging"] = device.logging;
303
389
  }
304
390
  if (Object.entries(config).length !== 0) {
305
- this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
391
+ this.warnLog(
392
+ `Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`,
393
+ );
306
394
  }
307
395
  }
308
396
 
309
397
  logs(device: irdevice & irDevicesConfig) {
310
398
  if (this.platform.debugMode) {
311
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
312
- this.debugLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
399
+ this.deviceLogging = this.accessory.context.logging = "debugMode";
400
+ this.debugLog(
401
+ `Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`,
402
+ );
313
403
  } else if (device.logging) {
314
404
  this.deviceLogging = this.accessory.context.logging = device.logging;
315
- this.debugLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
405
+ this.debugLog(
406
+ `Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`,
407
+ );
316
408
  } else if (this.platform.config.options?.logging) {
317
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
318
- this.debugLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
409
+ this.deviceLogging = this.accessory.context.logging =
410
+ this.platform.config.options?.logging;
411
+ this.debugLog(
412
+ `Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`,
413
+ );
319
414
  } else {
320
- this.deviceLogging = this.accessory.context.logging = 'standard';
321
- this.debugLog(`Fan: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
415
+ this.deviceLogging = this.accessory.context.logging = "standard";
416
+ this.debugLog(
417
+ `Fan: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`,
418
+ );
322
419
  }
323
420
  }
324
421
 
325
422
  /**
326
- * Logging for Device
327
- */
423
+ * Logging for Device
424
+ */
328
425
  infoLog(...log: any[]) {
329
426
  if (this.enablingDeviceLogging()) {
330
427
  this.platform.log.info(String(...log));
@@ -345,8 +442,8 @@ export class Fan {
345
442
 
346
443
  debugLog(...log: any[]) {
347
444
  if (this.enablingDeviceLogging()) {
348
- if (this.deviceLogging === 'debug') {
349
- this.platform.log.info('[DEBUG]', String(...log));
445
+ if (this.deviceLogging === "debug") {
446
+ this.platform.log.info("[DEBUG]", String(...log));
350
447
  } else {
351
448
  this.platform.log.debug(String(...log));
352
449
  }
@@ -354,6 +451,6 @@ export class Fan {
354
451
  }
355
452
 
356
453
  enablingDeviceLogging(): boolean {
357
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
454
+ return this.deviceLogging.includes("debug") || this.deviceLogging === "standard";
358
455
  }
359
456
  }