@switchbot/homebridge-switchbot 2.0.0-beta.17 → 2.0.0-beta.19

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 (106) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/config.schema.json +14 -4
  3. package/dist/device/bot.d.ts +2 -0
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +201 -163
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts +2 -0
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +250 -218
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.d.ts +2 -0
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +85 -66
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts +2 -0
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +166 -136
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/humidifier.d.ts.map +1 -1
  20. package/dist/device/humidifier.js +126 -115
  21. package/dist/device/humidifier.js.map +1 -1
  22. package/dist/device/lock.d.ts +2 -0
  23. package/dist/device/lock.d.ts.map +1 -1
  24. package/dist/device/lock.js +156 -130
  25. package/dist/device/lock.js.map +1 -1
  26. package/dist/device/meter.d.ts +2 -0
  27. package/dist/device/meter.d.ts.map +1 -1
  28. package/dist/device/meter.js +85 -64
  29. package/dist/device/meter.js.map +1 -1
  30. package/dist/device/meterplus.d.ts +2 -0
  31. package/dist/device/meterplus.d.ts.map +1 -1
  32. package/dist/device/meterplus.js +78 -59
  33. package/dist/device/meterplus.js.map +1 -1
  34. package/dist/device/motion.d.ts +2 -0
  35. package/dist/device/motion.d.ts.map +1 -1
  36. package/dist/device/motion.js +76 -57
  37. package/dist/device/motion.js.map +1 -1
  38. package/dist/device/plug.d.ts +2 -0
  39. package/dist/device/plug.d.ts.map +1 -1
  40. package/dist/device/plug.js +133 -107
  41. package/dist/device/plug.js.map +1 -1
  42. package/dist/device/striplight.d.ts +2 -0
  43. package/dist/device/striplight.d.ts.map +1 -1
  44. package/dist/device/striplight.js +224 -195
  45. package/dist/device/striplight.js.map +1 -1
  46. package/dist/irdevice/airconditioner.d.ts +2 -0
  47. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  48. package/dist/irdevice/airconditioner.js +127 -105
  49. package/dist/irdevice/airconditioner.js.map +1 -1
  50. package/dist/irdevice/airpurifier.d.ts +2 -0
  51. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  52. package/dist/irdevice/airpurifier.js +83 -66
  53. package/dist/irdevice/airpurifier.js.map +1 -1
  54. package/dist/irdevice/camera.d.ts +8 -6
  55. package/dist/irdevice/camera.d.ts.map +1 -1
  56. package/dist/irdevice/camera.js +83 -68
  57. package/dist/irdevice/camera.js.map +1 -1
  58. package/dist/irdevice/fan.d.ts +7 -5
  59. package/dist/irdevice/fan.d.ts.map +1 -1
  60. package/dist/irdevice/fan.js +90 -75
  61. package/dist/irdevice/fan.js.map +1 -1
  62. package/dist/irdevice/light.d.ts +8 -6
  63. package/dist/irdevice/light.d.ts.map +1 -1
  64. package/dist/irdevice/light.js +83 -68
  65. package/dist/irdevice/light.js.map +1 -1
  66. package/dist/irdevice/other.d.ts +8 -6
  67. package/dist/irdevice/other.d.ts.map +1 -1
  68. package/dist/irdevice/other.js +93 -78
  69. package/dist/irdevice/other.js.map +1 -1
  70. package/dist/irdevice/tv.d.ts +8 -6
  71. package/dist/irdevice/tv.d.ts.map +1 -1
  72. package/dist/irdevice/tv.js +68 -52
  73. package/dist/irdevice/tv.js.map +1 -1
  74. package/dist/irdevice/vacuumcleaner.d.ts +8 -6
  75. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  76. package/dist/irdevice/vacuumcleaner.js +83 -69
  77. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  78. package/dist/irdevice/waterheater.d.ts +2 -0
  79. package/dist/irdevice/waterheater.d.ts.map +1 -1
  80. package/dist/irdevice/waterheater.js +75 -60
  81. package/dist/irdevice/waterheater.js.map +1 -1
  82. package/dist/settings.d.ts +12 -11
  83. package/dist/settings.d.ts.map +1 -1
  84. package/dist/settings.js.map +1 -1
  85. package/package.json +1 -1
  86. package/src/device/bot.ts +200 -163
  87. package/src/device/colorbulb.ts +252 -221
  88. package/src/device/contact.ts +85 -66
  89. package/src/device/curtain.ts +165 -136
  90. package/src/device/humidifier.ts +126 -115
  91. package/src/device/lock.ts +156 -131
  92. package/src/device/meter.ts +85 -64
  93. package/src/device/meterplus.ts +78 -59
  94. package/src/device/motion.ts +76 -57
  95. package/src/device/plug.ts +132 -107
  96. package/src/device/striplight.ts +226 -198
  97. package/src/irdevice/airconditioner.ts +126 -103
  98. package/src/irdevice/airpurifier.ts +84 -66
  99. package/src/irdevice/camera.ts +84 -68
  100. package/src/irdevice/fan.ts +91 -75
  101. package/src/irdevice/light.ts +84 -68
  102. package/src/irdevice/other.ts +94 -78
  103. package/src/irdevice/tv.ts +69 -53
  104. package/src/irdevice/vacuumcleaner.ts +83 -68
  105. package/src/irdevice/waterheater.ts +76 -60
  106. package/src/settings.ts +12 -11
@@ -83,12 +83,12 @@ class Humidifier {
83
83
  .onSet(this.handleRelativeHumidityHumidifierThresholdSet.bind(this));
84
84
  // Temperature Sensor Service
85
85
  if (device.humidifier?.hide_temperature || device.ble) {
86
- this.debugLog(`Humidifier: ${accessory.displayName} Removing Temperature Sensor Service`);
86
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
87
87
  this.temperatureservice = this.accessory.getService(this.platform.Service.TemperatureSensor);
88
88
  accessory.removeService(this.temperatureservice);
89
89
  }
90
90
  else if (!this.temperatureservice && !device.ble) {
91
- this.debugLog(`Humidifier: ${accessory.displayName} Add Temperature Sensor Service`);
91
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
92
92
  (this.temperatureservice =
93
93
  this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)),
94
94
  `${accessory.displayName} Temperature Sensor`;
@@ -106,7 +106,7 @@ class Humidifier {
106
106
  });
107
107
  }
108
108
  else {
109
- this.debugLog(`Humidifier: ${accessory.displayName} Temperature Sensor Service Not Added`);
109
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Temperature Sensor Service Not Added`);
110
110
  }
111
111
  // Retrieve initial values and updateHomekit
112
112
  this.updateHomeKitCharacteristics();
@@ -127,9 +127,10 @@ class Humidifier {
127
127
  await this.pushChanges();
128
128
  }
129
129
  catch (e) {
130
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges`);
130
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges`);
131
131
  if (this.deviceLogging.includes('debug')) {
132
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
132
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges,`
133
+ + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
133
134
  }
134
135
  this.apiError(e);
135
136
  }
@@ -148,10 +149,10 @@ class Humidifier {
148
149
  }
149
150
  }
150
151
  async BLEparseStatus() {
151
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE parseStatus`);
152
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE parseStatus`);
152
153
  // Current Relative Humidity
153
154
  this.CurrentRelativeHumidity = this.percentage;
154
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
155
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
155
156
  // Active
156
157
  if (this.onState) {
157
158
  this.Active = this.platform.Characteristic.Active.ACTIVE;
@@ -159,18 +160,18 @@ class Humidifier {
159
160
  else {
160
161
  this.Active = this.platform.Characteristic.Active.INACTIVE;
161
162
  }
162
- this.debugLog(`Humidifier: ${this.accessory.displayName} Active: ${this.Active}`);
163
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${this.Active}`);
163
164
  }
164
165
  async openAPIparseStatus() {
165
166
  if (this.platform.config.credentials?.token) {
166
- this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI parseStatus`);
167
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI parseStatus`);
167
168
  // Current Relative Humidity
168
169
  this.CurrentRelativeHumidity = this.humidity;
169
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
170
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
170
171
  // Current Temperature
171
172
  if (!this.device.humidifier?.hide_temperature) {
172
173
  this.CurrentTemperature = this.temperature;
173
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
174
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
174
175
  }
175
176
  // Target Humidifier Dehumidifier State
176
177
  switch (this.auto) {
@@ -197,9 +198,12 @@ class Humidifier {
197
198
  this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
198
199
  }
199
200
  }
200
- this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
201
- this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
202
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
201
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
202
+ + ` TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
203
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
204
+ + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
205
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
206
+ + ` CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
203
207
  // Active
204
208
  switch (this.power) {
205
209
  case 'on':
@@ -208,7 +212,7 @@ class Humidifier {
208
212
  default:
209
213
  this.Active = this.platform.Characteristic.Active.INACTIVE;
210
214
  }
211
- this.debugLog(`Humidifier: ${this.accessory.displayName} Active: ${this.Active}`);
215
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${this.Active}`);
212
216
  // Water Level
213
217
  if (this.lackWater) {
214
218
  this.WaterLevel = 0;
@@ -216,7 +220,7 @@ class Humidifier {
216
220
  else {
217
221
  this.WaterLevel = 100;
218
222
  }
219
- this.debugLog(`Humidifier: ${this.accessory.displayName} WaterLevel: ${this.WaterLevel}`);
223
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} WaterLevel: ${this.WaterLevel}`);
220
224
  }
221
225
  }
222
226
  /**
@@ -231,14 +235,14 @@ class Humidifier {
231
235
  }
232
236
  }
233
237
  async BLERefreshStatus() {
234
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE refreshStatus`);
238
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE refreshStatus`);
235
239
  const switchbot = await this.platform.connectBLE();
236
240
  // Convert to BLE Address
237
241
  this.device.bleMac = this.device
238
242
  .deviceId.match(/.{1,2}/g)
239
243
  .join(':')
240
244
  .toLowerCase();
241
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
245
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
242
246
  this.getCustomBLEAddress(switchbot);
243
247
  // Start to monitor advertisement packets
244
248
  if (switchbot !== false) {
@@ -254,23 +258,23 @@ class Humidifier {
254
258
  if (this.deviceLogging.includes('debug')) {
255
259
  this.infoLog(this.address);
256
260
  this.infoLog(this.device.bleMac);
257
- this.infoLog(`Humidifier: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
258
- this.infoLog(`Humidifier: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
261
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
262
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
259
263
  }
260
264
  this.serviceData = ad.serviceData;
261
265
  this.autoMode = ad.serviceData.autoMode;
262
266
  this.onState = ad.serviceData.onState;
263
267
  this.percentage = ad.serviceData.percentage;
264
- this.debugLog(`Humidifier: ${this.accessory.displayName} serviceData: ${(0, super_stringify_1.default)(ad.serviceData)}`);
265
- this.debugLog(`Humidifier: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName},` +
268
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${(0, super_stringify_1.default)(ad.serviceData)}`);
269
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName},` +
266
270
  `autoMode: ${ad.serviceData.autoMode}, onState: ${ad.serviceData.onState}, percentage: ${ad.serviceData.percentage}`);
267
271
  if (this.serviceData) {
268
272
  this.connected = true;
269
- this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
273
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.connected}`);
270
274
  }
271
275
  else {
272
276
  this.connected = false;
273
- this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
277
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.connected}`);
274
278
  }
275
279
  };
276
280
  // Wait 2 seconds
@@ -288,12 +292,13 @@ class Humidifier {
288
292
  }
289
293
  })
290
294
  .catch(async (e) => {
291
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
295
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
292
296
  if (this.deviceLogging.includes('debug')) {
293
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
297
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with BLE Connection,`
298
+ + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
294
299
  }
295
300
  if (this.platform.config.credentials?.token) {
296
- this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
301
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
297
302
  await this.openAPIRefreshStatus();
298
303
  }
299
304
  this.apiError(e);
@@ -312,7 +317,7 @@ class Humidifier {
312
317
  });
313
318
  // Set an event handler
314
319
  switchbot.onadvertisement = (ad) => {
315
- this.warnLog(`Humidifier: ${this.accessory.displayName} ad: ${(0, super_stringify_1.default)(ad, null, ' ')}`);
320
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} ad: ${(0, super_stringify_1.default)(ad, null, ' ')}`);
316
321
  };
317
322
  await switchbot.wait(10000);
318
323
  // Stop to monitor
@@ -321,22 +326,22 @@ class Humidifier {
321
326
  }
322
327
  }
323
328
  async BLEconnection(switchbot) {
324
- this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
329
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
325
330
  if (this.platform.config.credentials?.token) {
326
- this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
331
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
327
332
  await this.openAPIRefreshStatus();
328
333
  }
329
334
  }
330
335
  async openAPIRefreshStatus() {
331
- if (this.platform.config.credentials?.token && this.device.openAPI) {
332
- this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI refreshStatus`);
336
+ if (this.platform.config.credentials?.token && this.OpenAPI) {
337
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI refreshStatus`);
333
338
  try {
334
339
  const t = Date.now();
335
340
  const nonce = 'requestID';
336
341
  const data = this.platform.config.credentials?.token + t + nonce;
337
342
  const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret).update(Buffer.from(data, 'utf-8')).digest();
338
343
  const sign = signTerm.toString('base64');
339
- this.debugLog(`Humidifier: ${this.accessory.displayName} sign: ${sign}`);
344
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
340
345
  const options = {
341
346
  hostname: settings_1.HostDomain,
342
347
  port: 443,
@@ -351,16 +356,16 @@ class Humidifier {
351
356
  },
352
357
  };
353
358
  const req = https_1.default.request(options, (res) => {
354
- this.debugLog(`Humidifier: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
359
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
355
360
  let rawData = '';
356
361
  res.on('data', (d) => {
357
362
  rawData += d;
358
- this.debugLog(`Humidifier: ${this.accessory.displayName} d: ${d}`);
363
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
359
364
  });
360
365
  res.on('end', () => {
361
366
  try {
362
367
  this.deviceStatus = JSON.parse(rawData);
363
- this.debugLog(`Humidifier: ${this.accessory.displayName} refreshStatus: ${(0, super_stringify_1.default)(this.deviceStatus)}`);
368
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${(0, super_stringify_1.default)(this.deviceStatus)}`);
364
369
  this.auto = this.deviceStatus.body.auto;
365
370
  this.power = this.deviceStatus.body.power;
366
371
  this.lackWater = this.deviceStatus.body.lackWater;
@@ -371,19 +376,19 @@ class Humidifier {
371
376
  this.updateHomeKitCharacteristics();
372
377
  }
373
378
  catch (e) {
374
- this.errorLog(`Humidifier: ${this.accessory.displayName} error message: ${e.message}`);
379
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
375
380
  }
376
381
  });
377
382
  });
378
383
  req.on('error', (e) => {
379
- this.errorLog(`Humidifier: ${this.accessory.displayName} error message: ${e.message}`);
384
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
380
385
  });
381
386
  req.end();
382
387
  }
383
388
  catch (e) {
384
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
389
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
385
390
  if (this.deviceLogging.includes('debug')) {
386
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
391
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
387
392
  ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
388
393
  }
389
394
  this.apiError(e);
@@ -391,7 +396,7 @@ class Humidifier {
391
396
  }
392
397
  else {
393
398
  if (this.deviceLogging.includes('debug')) {
394
- this.warnLog(`Humidifier: ${this.accessory.displayName} OpenAPI is disabled, device status will not be sent.`);
399
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI is disabled, device status will not be sent.`);
395
400
  }
396
401
  }
397
402
  }
@@ -411,14 +416,14 @@ class Humidifier {
411
416
  });
412
417
  }
413
418
  async BLEpushChanges() {
414
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE pushChanges`);
419
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE pushChanges`);
415
420
  const switchbot = await this.platform.connectBLE();
416
421
  // Convert to BLE Address
417
422
  this.device.bleMac = this.device
418
423
  .deviceId.match(/.{1,2}/g)
419
424
  .join(':')
420
425
  .toLowerCase();
421
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
426
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
422
427
  if (switchbot !== false) {
423
428
  switchbot
424
429
  .discover({ model: 'e', quick: true, id: this.device.bleMac })
@@ -427,31 +432,32 @@ class Humidifier {
427
432
  return device_list[0].percentage(this.RelativeHumidityHumidifierThreshold);
428
433
  })
429
434
  .then(() => {
430
- this.debugLog(`Humidifier: ${this.accessory.displayName} Done.`);
435
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Done.`);
431
436
  })
432
437
  .catch(async (e) => {
433
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
438
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
434
439
  if (this.deviceLogging.includes('debug')) {
435
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,` + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
440
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
441
+ + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
436
442
  }
437
443
  if (this.platform.config.credentials?.token) {
438
- this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
444
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
439
445
  await this.openAPIpushChanges();
440
446
  }
441
447
  this.apiError(e);
442
448
  });
443
449
  }
444
450
  else {
445
- this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
451
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
446
452
  if (this.platform.config.credentials?.token) {
447
- this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
453
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
448
454
  await this.openAPIpushChanges();
449
455
  }
450
456
  }
451
457
  }
452
458
  async openAPIpushChanges() {
453
- if (this.platform.config.credentials?.token && this.device.openAPI) {
454
- this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI pushChanges`);
459
+ if (this.platform.config.credentials?.token && this.OpenAPI) {
460
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI pushChanges`);
455
461
  if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER &&
456
462
  this.Active === this.platform.Characteristic.Active.ACTIVE) {
457
463
  // Make Push On request to the API
@@ -462,14 +468,14 @@ class Humidifier {
462
468
  .update(Buffer.from(data, 'utf-8'))
463
469
  .digest();
464
470
  const sign = signTerm.toString('base64');
465
- this.debugLog(`Humidifier: ${this.accessory.displayName} sign: ${sign}`);
471
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
466
472
  this.debugLog(`Pushing Manual: ${this.RelativeHumidityHumidifierThreshold}!`);
467
473
  const body = (0, super_stringify_1.default)({
468
474
  'command': 'setMode',
469
475
  'parameter': `${this.RelativeHumidityHumidifierThreshold}`,
470
476
  'commandType': 'command',
471
477
  });
472
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
478
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
473
479
  const options = {
474
480
  hostname: settings_1.HostDomain,
475
481
  port: 443,
@@ -485,18 +491,18 @@ class Humidifier {
485
491
  },
486
492
  };
487
493
  const req = https_1.default.request(options, res => {
488
- this.debugLog(`Humidifier: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
494
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
489
495
  res.on('data', d => {
490
- this.debugLog(`Humidifier: ${this.accessory.displayName} d: ${d}`);
496
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
491
497
  });
492
498
  });
493
499
  req.on('error', (e) => {
494
- this.errorLog(`Humidifier: ${this.accessory.displayName} error message: ${e.message}`);
500
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
495
501
  this.apiError(e);
496
502
  });
497
503
  req.write(body);
498
504
  req.end();
499
- this.debugLog(`Humidifier: ${this.accessory.displayName} openAPIpushChanges: ${(0, super_stringify_1.default)(req)}`);
505
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges: ${(0, super_stringify_1.default)(req)}`);
500
506
  }
501
507
  else if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
502
508
  this.Active === this.platform.Characteristic.Active.ACTIVE) {
@@ -507,7 +513,7 @@ class Humidifier {
507
513
  }
508
514
  }
509
515
  else {
510
- this.warnLog(`Humidifier: ${this.accessory.displayName} OpenAPI is disabled, commands will not be sent.`);
516
+ this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} OpenAPI is disabled, commands will not be sent.`);
511
517
  }
512
518
  }
513
519
  /**
@@ -525,14 +531,14 @@ class Humidifier {
525
531
  .update(Buffer.from(data, 'utf-8'))
526
532
  .digest();
527
533
  const sign = signTerm.toString('base64');
528
- this.debugLog(`Humidifier: ${this.accessory.displayName} sign: ${sign}`);
534
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
529
535
  this.debugLog('Pushing Auto!');
530
536
  const body = (0, super_stringify_1.default)({
531
537
  'command': 'setMode',
532
538
  'parameter': 'auto',
533
539
  'commandType': 'command',
534
540
  });
535
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
541
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
536
542
  const options = {
537
543
  hostname: settings_1.HostDomain,
538
544
  port: 443,
@@ -548,24 +554,24 @@ class Humidifier {
548
554
  },
549
555
  };
550
556
  const req = https_1.default.request(options, res => {
551
- this.debugLog(`Humidifier: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
557
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
552
558
  this.statusCode({ res });
553
559
  res.on('data', d => {
554
- this.debugLog(`Humidifier: ${this.accessory.displayName} d: ${d}`);
560
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
555
561
  });
556
562
  });
557
563
  req.on('error', (e) => {
558
- this.errorLog(`Humidifier: ${this.accessory.displayName} error message: ${e.message}`);
564
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
559
565
  });
560
566
  req.write(body);
561
567
  req.end();
562
- this.debugLog(`Humidifier: ${this.accessory.displayName} pushAutoChanges: ${(0, super_stringify_1.default)(req)}`);
568
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushAutoChanges: ${(0, super_stringify_1.default)(req)}`);
563
569
  }
564
570
  }
565
571
  catch (e) {
566
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection`);
572
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection`);
567
573
  if (this.deviceLogging.includes('debug')) {
568
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,` +
574
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,` +
569
575
  ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
570
576
  }
571
577
  this.apiError(e);
@@ -585,14 +591,14 @@ class Humidifier {
585
591
  .update(Buffer.from(data, 'utf-8'))
586
592
  .digest();
587
593
  const sign = signTerm.toString('base64');
588
- this.debugLog(`Humidifier: ${this.accessory.displayName} sign: ${sign}`);
594
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} sign: ${sign}`);
589
595
  this.debugLog('Pushing Off!');
590
596
  const body = (0, super_stringify_1.default)({
591
597
  'command': 'turnOff',
592
598
  'parameter': 'default',
593
599
  'commandType': 'command',
594
600
  });
595
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
601
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
596
602
  const options = {
597
603
  hostname: settings_1.HostDomain,
598
604
  port: 443,
@@ -608,24 +614,24 @@ class Humidifier {
608
614
  },
609
615
  };
610
616
  const req = https_1.default.request(options, res => {
611
- this.debugLog(`Humidifier: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
617
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
612
618
  this.statusCode({ res });
613
619
  res.on('data', d => {
614
- this.debugLog(`Humidifier: ${this.accessory.displayName} d: ${d}`);
620
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} d: ${d}`);
615
621
  });
616
622
  });
617
623
  req.on('error', (e) => {
618
- this.errorLog(`Humidifier: ${this.accessory.displayName} error message: ${e.message}`);
624
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} error message: ${e.message}`);
619
625
  });
620
626
  req.write(body);
621
627
  req.end();
622
- this.debugLog(`Humidifier: ${this.accessory.displayName} pushActiveChanges: ${(0, super_stringify_1.default)(req)}`);
628
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushActiveChanges: ${(0, super_stringify_1.default)(req)}`);
623
629
  }
624
630
  }
625
631
  catch (e) {
626
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection`);
632
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection`);
627
633
  if (this.deviceLogging.includes('debug')) {
628
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,` +
634
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,` +
629
635
  ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
630
636
  }
631
637
  this.apiError(e);
@@ -636,59 +642,63 @@ class Humidifier {
636
642
  */
637
643
  async updateHomeKitCharacteristics() {
638
644
  if (this.CurrentRelativeHumidity === undefined) {
639
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
645
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
640
646
  }
641
647
  else {
642
648
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
643
- this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
649
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
650
+ + ` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
644
651
  }
645
652
  if (!this.device.ble) {
646
653
  if (this.WaterLevel === undefined) {
647
- this.debugLog(`Humidifier: ${this.accessory.displayName} WaterLevel: ${this.WaterLevel}`);
654
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} WaterLevel: ${this.WaterLevel}`);
648
655
  }
649
656
  else {
650
657
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.WaterLevel, this.WaterLevel);
651
- this.debugLog(`Humidifier: ${this.accessory.displayName} updateCharacteristic WaterLevel: ${this.WaterLevel}`);
658
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic WaterLevel: ${this.WaterLevel}`);
652
659
  }
653
660
  }
654
661
  if (this.CurrentHumidifierDehumidifierState === undefined) {
655
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
662
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
663
+ + ` CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
656
664
  }
657
665
  else {
658
666
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.CurrentHumidifierDehumidifierState, this.CurrentHumidifierDehumidifierState);
659
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
667
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` +
660
668
  ` updateCharacteristic CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
661
669
  }
662
670
  if (this.TargetHumidifierDehumidifierState === undefined) {
663
- this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
671
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
672
+ + ` TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
664
673
  }
665
674
  else {
666
675
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.TargetHumidifierDehumidifierState, this.TargetHumidifierDehumidifierState);
667
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
676
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` +
668
677
  ` updateCharacteristic TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
669
678
  }
670
679
  if (this.Active === undefined) {
671
- this.debugLog(`Humidifier: ${this.accessory.displayName} Active: ${this.Active}`);
680
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${this.Active}`);
672
681
  }
673
682
  else {
674
683
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
675
- this.debugLog(`Humidifier: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
684
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
676
685
  }
677
686
  if (this.RelativeHumidityHumidifierThreshold === undefined) {
678
- this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
687
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
688
+ + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
679
689
  }
680
690
  else {
681
691
  this.humidifierService.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, this.RelativeHumidityHumidifierThreshold);
682
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
692
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` +
683
693
  ` updateCharacteristic RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
684
694
  }
685
695
  if (!this.device.humidifier?.hide_temperature && !this.device.ble) {
686
696
  if (this.CurrentTemperature === undefined) {
687
- this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
697
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
688
698
  }
689
699
  else {
690
700
  this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
691
- this.debugLog(`Humidifier: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
701
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
692
702
  }
693
703
  }
694
704
  }
@@ -709,31 +719,31 @@ class Humidifier {
709
719
  async statusCode({ res }) {
710
720
  switch (res.statusCode) {
711
721
  case 151:
712
- this.errorLog(`Humidifier: ${this.accessory.displayName} Command not supported by this device type.`);
722
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command not supported by this device type.`);
713
723
  break;
714
724
  case 152:
715
- this.errorLog(`Humidifier: ${this.accessory.displayName} Device not found.`);
725
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device not found.`);
716
726
  break;
717
727
  case 160:
718
- this.errorLog(`Humidifier: ${this.accessory.displayName} Command is not supported.`);
728
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Command is not supported.`);
719
729
  break;
720
730
  case 161:
721
- this.errorLog(`Humidifier: ${this.accessory.displayName} Device is offline.`);
731
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device is offline.`);
722
732
  this.offlineOff();
723
733
  break;
724
734
  case 171:
725
- this.errorLog(`Humidifier: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
735
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
726
736
  this.offlineOff();
727
737
  break;
728
738
  case 190:
729
- this.errorLog(`Humidifier: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
739
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
730
740
  ` Or command: ${(0, super_stringify_1.default)(res)} format is invalid`);
731
741
  break;
732
742
  case 100:
733
- this.debugLog(`Humidifier: ${this.accessory.displayName} Command successfully sent.`);
743
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Command successfully sent.`);
734
744
  break;
735
745
  default:
736
- this.debugLog(`Humidifier: ${this.accessory.displayName} Unknown statusCode.`);
746
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode.`);
737
747
  }
738
748
  }
739
749
  async offlineOff() {
@@ -746,7 +756,7 @@ class Humidifier {
746
756
  * Handle requests to set the "Target Humidifier Dehumidifier State" characteristic
747
757
  */
748
758
  async handleTargetHumidifierDehumidifierStateSet(value) {
749
- this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${value}`);
759
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${value}`);
750
760
  this.TargetHumidifierDehumidifierState = value;
751
761
  this.doHumidifierUpdate.next();
752
762
  }
@@ -754,7 +764,7 @@ class Humidifier {
754
764
  * Handle requests to set the "Active" characteristic
755
765
  */
756
766
  async handleActiveSet(value) {
757
- this.debugLog(`Humidifier: ${this.accessory.displayName} Active: ${value}`);
767
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Active: ${value}`);
758
768
  this.Active = value;
759
769
  this.doHumidifierUpdate.next();
760
770
  }
@@ -762,7 +772,7 @@ class Humidifier {
762
772
  * Handle requests to set the "Relative Humidity Humidifier Threshold" characteristic
763
773
  */
764
774
  async handleRelativeHumidityHumidifierThresholdSet(value) {
765
- this.debugLog(`Humidifier: ${this.accessory.displayName} RelativeHumidityHumidifierThreshold: ${value}`);
775
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} RelativeHumidityHumidifierThreshold: ${value}`);
766
776
  this.RelativeHumidityHumidifierThreshold = value;
767
777
  if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
768
778
  this.Active = this.platform.Characteristic.Active.ACTIVE;
@@ -778,6 +788,9 @@ class Humidifier {
778
788
  if (device.ble !== undefined) {
779
789
  config['ble'] = device.ble;
780
790
  }
791
+ if (device.openAPI !== undefined) {
792
+ config['openAPI'] = device.openAPI;
793
+ }
781
794
  if (device.logging !== undefined) {
782
795
  config['logging'] = device.logging;
783
796
  }
@@ -790,21 +803,18 @@ class Humidifier {
790
803
  if (device.offline !== undefined) {
791
804
  config['offline'] = device.offline;
792
805
  }
793
- if (device.openAPI !== undefined) {
794
- config['openAPI'] = device.openAPI;
795
- }
796
806
  if (Object.entries(config).length !== 0) {
797
- this.infoLog(`Humidifier: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
807
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
798
808
  }
799
809
  }
800
810
  async refreshRate(device) {
801
811
  if (device.refreshRate) {
802
812
  this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
803
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
813
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
804
814
  }
805
815
  else if (this.platform.config.options.refreshRate) {
806
816
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options.refreshRate;
807
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
817
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
808
818
  }
809
819
  }
810
820
  async openAPI() {
@@ -814,45 +824,46 @@ class Humidifier {
814
824
  else {
815
825
  this.OpenAPI = this.device.openAPI;
816
826
  }
817
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI: ${this.OpenAPI}`);
827
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI: ${this.OpenAPI}`);
818
828
  }
819
829
  async scan(device) {
820
830
  if (device.scanDuration) {
821
831
  this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
822
832
  if (device.ble) {
823
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
833
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
824
834
  }
825
835
  }
826
836
  else {
827
837
  this.scanDuration = this.accessory.context.scanDuration = 1;
828
838
  if (this.device.ble) {
829
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
839
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
830
840
  }
831
841
  }
832
842
  }
833
843
  async logs(device) {
834
844
  if (this.platform.debugMode) {
835
845
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
836
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
846
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
837
847
  }
838
848
  else if (device.logging) {
839
849
  this.deviceLogging = this.accessory.context.logging = device.logging;
840
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
850
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
841
851
  }
842
852
  else if (this.platform.config.options?.logging) {
843
853
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
844
- this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
854
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
845
855
  }
846
856
  else {
847
857
  this.deviceLogging = this.accessory.context.logging = 'standard';
848
- this.debugLog(`Humidifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
858
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
849
859
  }
850
860
  }
851
861
  FirmwareRevision(accessory, device) {
852
862
  let FirmwareRevision;
853
- this.debugLog(`Humidifier: ${this.accessory.displayName} accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
854
- this.debugLog(`Humidifier: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
855
- this.debugLog(`Humidifier: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
863
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
864
+ + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
865
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
866
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
856
867
  if (accessory.context.FirmwareRevision) {
857
868
  FirmwareRevision = accessory.context.FirmwareRevision;
858
869
  }