@switchbot/homebridge-switchbot 1.8.1-beta.0 → 1.8.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 (87) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/devices/bots.d.ts +15 -15
  3. package/dist/devices/bots.d.ts.map +1 -1
  4. package/dist/devices/bots.js +162 -159
  5. package/dist/devices/bots.js.map +1 -1
  6. package/dist/devices/colorbulb.d.ts +5 -5
  7. package/dist/devices/colorbulb.d.ts.map +1 -1
  8. package/dist/devices/colorbulb.js +69 -66
  9. package/dist/devices/colorbulb.js.map +1 -1
  10. package/dist/devices/contact.d.ts +8 -8
  11. package/dist/devices/contact.d.ts.map +1 -1
  12. package/dist/devices/contact.js +81 -78
  13. package/dist/devices/contact.js.map +1 -1
  14. package/dist/devices/curtains.d.ts +7 -7
  15. package/dist/devices/curtains.d.ts.map +1 -1
  16. package/dist/devices/curtains.js +105 -113
  17. package/dist/devices/curtains.js.map +1 -1
  18. package/dist/devices/humidifiers.d.ts +5 -5
  19. package/dist/devices/humidifiers.d.ts.map +1 -1
  20. package/dist/devices/humidifiers.js +72 -69
  21. package/dist/devices/humidifiers.js.map +1 -1
  22. package/dist/devices/meters.d.ts +4 -4
  23. package/dist/devices/meters.d.ts.map +1 -1
  24. package/dist/devices/meters.js +63 -60
  25. package/dist/devices/meters.js.map +1 -1
  26. package/dist/devices/motion.d.ts +6 -6
  27. package/dist/devices/motion.d.ts.map +1 -1
  28. package/dist/devices/motion.js +81 -78
  29. package/dist/devices/motion.js.map +1 -1
  30. package/dist/devices/plugs.d.ts +4 -4
  31. package/dist/devices/plugs.d.ts.map +1 -1
  32. package/dist/devices/plugs.js +63 -60
  33. package/dist/devices/plugs.js.map +1 -1
  34. package/dist/irdevices/airconditioners.d.ts +2 -2
  35. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  36. package/dist/irdevices/airconditioners.js +30 -27
  37. package/dist/irdevices/airconditioners.js.map +1 -1
  38. package/dist/irdevices/airpurifiers.d.ts +2 -2
  39. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  40. package/dist/irdevices/airpurifiers.js +30 -27
  41. package/dist/irdevices/airpurifiers.js.map +1 -1
  42. package/dist/irdevices/cameras.d.ts +2 -2
  43. package/dist/irdevices/cameras.d.ts.map +1 -1
  44. package/dist/irdevices/cameras.js +30 -27
  45. package/dist/irdevices/cameras.js.map +1 -1
  46. package/dist/irdevices/fans.d.ts +2 -2
  47. package/dist/irdevices/fans.d.ts.map +1 -1
  48. package/dist/irdevices/fans.js +30 -27
  49. package/dist/irdevices/fans.js.map +1 -1
  50. package/dist/irdevices/lights.d.ts +2 -2
  51. package/dist/irdevices/lights.d.ts.map +1 -1
  52. package/dist/irdevices/lights.js +30 -27
  53. package/dist/irdevices/lights.js.map +1 -1
  54. package/dist/irdevices/others.d.ts +3 -3
  55. package/dist/irdevices/others.d.ts.map +1 -1
  56. package/dist/irdevices/others.js +41 -38
  57. package/dist/irdevices/others.js.map +1 -1
  58. package/dist/irdevices/tvs.d.ts +2 -2
  59. package/dist/irdevices/tvs.d.ts.map +1 -1
  60. package/dist/irdevices/tvs.js +30 -27
  61. package/dist/irdevices/tvs.js.map +1 -1
  62. package/dist/irdevices/vacuumcleaners.d.ts +2 -2
  63. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  64. package/dist/irdevices/vacuumcleaners.js +30 -27
  65. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  66. package/dist/irdevices/waterheaters.d.ts +2 -2
  67. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  68. package/dist/irdevices/waterheaters.js +30 -27
  69. package/dist/irdevices/waterheaters.js.map +1 -1
  70. package/package.json +71 -71
  71. package/src/devices/bots.ts +169 -166
  72. package/src/devices/colorbulb.ts +68 -65
  73. package/src/devices/contact.ts +82 -79
  74. package/src/devices/curtains.ts +103 -111
  75. package/src/devices/humidifiers.ts +71 -68
  76. package/src/devices/meters.ts +62 -59
  77. package/src/devices/motion.ts +80 -77
  78. package/src/devices/plugs.ts +62 -59
  79. package/src/irdevices/airconditioners.ts +29 -26
  80. package/src/irdevices/airpurifiers.ts +29 -26
  81. package/src/irdevices/cameras.ts +29 -26
  82. package/src/irdevices/fans.ts +29 -26
  83. package/src/irdevices/lights.ts +29 -26
  84. package/src/irdevices/others.ts +40 -37
  85. package/src/irdevices/tvs.ts +29 -26
  86. package/src/irdevices/vacuumcleaners.ts +29 -26
  87. package/src/irdevices/waterheaters.ts +29 -26
@@ -139,83 +139,6 @@ export class Motion {
139
139
  });
140
140
  }
141
141
 
142
- config(device: device & devicesConfig) {
143
- const config: any = device.motion;
144
- if (device.ble !== undefined) {
145
- config['ble'] = device.ble;
146
- }
147
- if (device.logging !== undefined) {
148
- config['logging'] = device.logging;
149
- }
150
- if (device.refreshRate !== undefined) {
151
- config['refreshRate'] = device.refreshRate;
152
- }
153
- if (device.scanDuration !== undefined) {
154
- config['scanDuration'] = device.scanDuration;
155
- }
156
- if (config !== undefined) {
157
- this.warnLog(`Motion Sensor: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
158
- }
159
- }
160
-
161
- refreshRate(device: device & devicesConfig) {
162
- if (device.refreshRate) {
163
- this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
164
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
165
- } else if (this.platform.config.options!.refreshRate) {
166
- this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
167
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
168
- }
169
- }
170
-
171
- scan(device: device & devicesConfig) {
172
- if (device.scanDuration) {
173
- this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
174
- if (device.ble) {
175
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
176
- }
177
- } else {
178
- this.scanDuration = this.accessory.context.scanDuration = 1;
179
- if (this.device.ble) {
180
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
181
- }
182
- }
183
- }
184
-
185
- logs(device: device & devicesConfig) {
186
- if (this.platform.debugMode) {
187
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
188
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
189
- } else if (device.logging) {
190
- this.deviceLogging = this.accessory.context.logging = device.logging;
191
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
192
- } else if (this.platform.config.options?.logging) {
193
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
194
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
195
- } else {
196
- this.deviceLogging = this.accessory.context.logging = 'standard';
197
- this.debugLog(`Motion Sensor: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
198
- }
199
- }
200
-
201
- private minLux(): number {
202
- if (this.device.motion?.set_minLux) {
203
- this.set_minLux = this.device.motion!.set_minLux!;
204
- } else {
205
- this.set_minLux = 1;
206
- }
207
- return this.set_minLux;
208
- }
209
-
210
- private maxLux(): number {
211
- if (this.device.motion?.set_maxLux) {
212
- this.set_maxLux = this.device.motion!.set_maxLux!;
213
- } else {
214
- this.set_maxLux = 6001;
215
- }
216
- return this.set_maxLux;
217
- }
218
-
219
142
  /**
220
143
  * Parse the device status from the SwitchBot api
221
144
  */
@@ -441,6 +364,86 @@ export class Motion {
441
364
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
442
365
  }
443
366
 
367
+ config(device: device & devicesConfig) {
368
+ let config = {};
369
+ if (device.motion) {
370
+ config = device.motion;
371
+ }
372
+ if (device.ble !== undefined) {
373
+ config['ble'] = device.ble;
374
+ }
375
+ if (device.logging !== undefined) {
376
+ config['logging'] = device.logging;
377
+ }
378
+ if (device.refreshRate !== undefined) {
379
+ config['refreshRate'] = device.refreshRate;
380
+ }
381
+ if (device.scanDuration !== undefined) {
382
+ config['scanDuration'] = device.scanDuration;
383
+ }
384
+ if (config !== undefined) {
385
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
386
+ }
387
+ }
388
+
389
+ refreshRate(device: device & devicesConfig) {
390
+ if (device.refreshRate) {
391
+ this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
392
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
393
+ } else if (this.platform.config.options!.refreshRate) {
394
+ this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
395
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
396
+ }
397
+ }
398
+
399
+ scan(device: device & devicesConfig) {
400
+ if (device.scanDuration) {
401
+ this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
402
+ if (device.ble) {
403
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
404
+ }
405
+ } else {
406
+ this.scanDuration = this.accessory.context.scanDuration = 1;
407
+ if (this.device.ble) {
408
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
409
+ }
410
+ }
411
+ }
412
+
413
+ logs(device: device & devicesConfig) {
414
+ if (this.platform.debugMode) {
415
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
416
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
417
+ } else if (device.logging) {
418
+ this.deviceLogging = this.accessory.context.logging = device.logging;
419
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
420
+ } else if (this.platform.config.options?.logging) {
421
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
422
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
423
+ } else {
424
+ this.deviceLogging = this.accessory.context.logging = 'standard';
425
+ this.debugLog(`Motion Sensor: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
426
+ }
427
+ }
428
+
429
+ private minLux(): number {
430
+ if (this.device.motion?.set_minLux) {
431
+ this.set_minLux = this.device.motion!.set_minLux!;
432
+ } else {
433
+ this.set_minLux = 1;
434
+ }
435
+ return this.set_minLux;
436
+ }
437
+
438
+ private maxLux(): number {
439
+ if (this.device.motion?.set_maxLux) {
440
+ this.set_maxLux = this.device.motion!.set_maxLux!;
441
+ } else {
442
+ this.set_maxLux = 6001;
443
+ }
444
+ return this.set_maxLux;
445
+ }
446
+
444
447
  /**
445
448
  * Logging for Device
446
449
  */
@@ -118,65 +118,6 @@ export class Plug {
118
118
  });
119
119
  }
120
120
 
121
- config(device: device & devicesConfig) {
122
- const config: any = device.plug;
123
- if (device.ble !== undefined) {
124
- config['ble'] = device.ble;
125
- }
126
- if (device.logging !== undefined) {
127
- config['logging'] = device.logging;
128
- }
129
- if (device.refreshRate !== undefined) {
130
- config['refreshRate'] = device.refreshRate;
131
- }
132
- if (device.scanDuration !== undefined) {
133
- config['scanDuration'] = device.scanDuration;
134
- }
135
- if (config !== undefined) {
136
- this.warnLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
137
- }
138
- }
139
-
140
- refreshRate(device: device & devicesConfig) {
141
- if (device.refreshRate) {
142
- this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
143
- this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
144
- } else if (this.platform.config.options!.refreshRate) {
145
- this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
146
- this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
147
- }
148
- }
149
-
150
- scan(device: device & devicesConfig) {
151
- if (device.scanDuration) {
152
- this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
153
- if (device.ble) {
154
- this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
155
- }
156
- } else {
157
- this.scanDuration = this.accessory.context.scanDuration = 1;
158
- if (this.device.ble) {
159
- this.debugLog(`Plug: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
160
- }
161
- }
162
- }
163
-
164
- logs(device: device & devicesConfig) {
165
- if (this.platform.debugMode) {
166
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
167
- this.debugLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
168
- } else if (device.logging) {
169
- this.deviceLogging = this.accessory.context.logging = device.logging;
170
- this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
171
- } else if (this.platform.config.options?.logging) {
172
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
173
- this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
174
- } else {
175
- this.deviceLogging = this.accessory.context.logging = 'standard';
176
- this.debugLog(`Plug: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
177
- }
178
- }
179
-
180
121
  parseStatus() {
181
122
  switch (this.power) {
182
123
  case 'on':
@@ -308,6 +249,68 @@ export class Plug {
308
249
  this.doPlugUpdate.next();
309
250
  }
310
251
 
252
+ config(device: device & devicesConfig) {
253
+ let config = {};
254
+ if (device.plug) {
255
+ config = device.plug;
256
+ }
257
+ if (device.ble !== undefined) {
258
+ config['ble'] = device.ble;
259
+ }
260
+ if (device.logging !== undefined) {
261
+ config['logging'] = device.logging;
262
+ }
263
+ if (device.refreshRate !== undefined) {
264
+ config['refreshRate'] = device.refreshRate;
265
+ }
266
+ if (device.scanDuration !== undefined) {
267
+ config['scanDuration'] = device.scanDuration;
268
+ }
269
+ if (config !== undefined) {
270
+ this.warnLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
271
+ }
272
+ }
273
+
274
+ refreshRate(device: device & devicesConfig) {
275
+ if (device.refreshRate) {
276
+ this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
277
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
278
+ } else if (this.platform.config.options!.refreshRate) {
279
+ this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
280
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
281
+ }
282
+ }
283
+
284
+ scan(device: device & devicesConfig) {
285
+ if (device.scanDuration) {
286
+ this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
287
+ if (device.ble) {
288
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
289
+ }
290
+ } else {
291
+ this.scanDuration = this.accessory.context.scanDuration = 1;
292
+ if (this.device.ble) {
293
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
294
+ }
295
+ }
296
+ }
297
+
298
+ logs(device: device & devicesConfig) {
299
+ if (this.platform.debugMode) {
300
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
301
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
302
+ } else if (device.logging) {
303
+ this.deviceLogging = this.accessory.context.logging = device.logging;
304
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
305
+ } else if (this.platform.config.options?.logging) {
306
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
307
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
308
+ } else {
309
+ this.deviceLogging = this.accessory.context.logging = 'standard';
310
+ this.debugLog(`Plug: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
311
+ }
312
+ }
313
+
311
314
  /**
312
315
  * Logging for Device
313
316
  */
@@ -167,32 +167,6 @@ export class AirConditioner {
167
167
  .onSet(this.RotationSpeedSet.bind(this));
168
168
  }
169
169
 
170
- config(device: irdevice & irDevicesConfig) {
171
- const config: any = device.irair;
172
- if (device.logging !== undefined) {
173
- config['logging'] = device.logging;
174
- }
175
- if (config !== undefined) {
176
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
177
- }
178
- }
179
-
180
- logs(device: irdevice & irDevicesConfig) {
181
- if (this.platform.debugMode) {
182
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
183
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
184
- } else if (device.logging) {
185
- this.deviceLogging = this.accessory.context.logging = device.logging;
186
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
187
- } else if (this.platform.config.options?.logging) {
188
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
189
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
190
- } else {
191
- this.deviceLogging = this.accessory.context.logging = 'standard';
192
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
193
- }
194
- }
195
-
196
170
  /**
197
171
  * Pushes the requested changes to the SwitchBot API
198
172
  * deviceType commandType Command command parameter Description
@@ -584,6 +558,35 @@ export class AirConditioner {
584
558
  }
585
559
  }
586
560
 
561
+ config(device: irdevice & irDevicesConfig) {
562
+ let config = {};
563
+ if (device.irair) {
564
+ config = device.irair;
565
+ }
566
+ if (device.logging !== undefined) {
567
+ config['logging'] = device.logging;
568
+ }
569
+ if (config !== undefined) {
570
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
571
+ }
572
+ }
573
+
574
+ logs(device: irdevice & irDevicesConfig) {
575
+ if (this.platform.debugMode) {
576
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
577
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
578
+ } else if (device.logging) {
579
+ this.deviceLogging = this.accessory.context.logging = device.logging;
580
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
581
+ } else if (this.platform.config.options?.logging) {
582
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
583
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
584
+ } else {
585
+ this.deviceLogging = this.accessory.context.logging = 'standard';
586
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
587
+ }
588
+ }
589
+
587
590
  /**
588
591
  * Logging for Device
589
592
  */
@@ -88,32 +88,6 @@ export class AirPurifier {
88
88
  this.service.getCharacteristic(this.platform.Characteristic.TargetAirPurifierState).onSet(this.TargetAirPurifierStateSet.bind(this));
89
89
  }
90
90
 
91
- config(device: irdevice & irDevicesConfig) {
92
- const config: any = device.irpur;
93
- if (device.logging !== undefined) {
94
- config['logging'] = device.logging;
95
- }
96
- if (config !== undefined) {
97
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
98
- }
99
- }
100
-
101
- logs(device: irdevice & irDevicesConfig) {
102
- if (this.platform.debugMode) {
103
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
104
- this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
105
- } else if (device.logging) {
106
- this.deviceLogging = this.accessory.context.logging = device.logging;
107
- this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
108
- } else if (this.platform.config.options?.logging) {
109
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
110
- this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
111
- } else {
112
- this.deviceLogging = this.accessory.context.logging = 'standard';
113
- this.debugLog(`Air Purifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
114
- }
115
- }
116
-
117
91
  private ActiveSet(value: CharacteristicValue) {
118
92
  this.debugLog(`Air Purifier: ${this.accessory.displayName} Set Active: ${value}`);
119
93
  if (value === this.platform.Characteristic.Active.INACTIVE) {
@@ -306,6 +280,35 @@ export class AirPurifier {
306
280
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
307
281
  }
308
282
 
283
+ config(device: irdevice & irDevicesConfig) {
284
+ let config = {};
285
+ if (device.irpur) {
286
+ config = device.irpur;
287
+ }
288
+ if (device.logging !== undefined) {
289
+ config['logging'] = device.logging;
290
+ }
291
+ if (config !== undefined) {
292
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
293
+ }
294
+ }
295
+
296
+ logs(device: irdevice & irDevicesConfig) {
297
+ if (this.platform.debugMode) {
298
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
299
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
300
+ } else if (device.logging) {
301
+ this.deviceLogging = this.accessory.context.logging = device.logging;
302
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
303
+ } else if (this.platform.config.options?.logging) {
304
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
305
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
306
+ } else {
307
+ this.deviceLogging = this.accessory.context.logging = 'standard';
308
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
309
+ }
310
+ }
311
+
309
312
  /**
310
313
  * Logging for Device
311
314
  */
@@ -58,32 +58,6 @@ export class Camera {
58
58
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
59
59
  }
60
60
 
61
- config(device: irdevice & irDevicesConfig) {
62
- const config: any = device.ircam;
63
- if (device.logging !== undefined) {
64
- config['logging'] = device.logging;
65
- }
66
- if (config !== undefined) {
67
- this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
68
- }
69
- }
70
-
71
- logs(device: irdevice & irDevicesConfig) {
72
- if (this.platform.debugMode) {
73
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
74
- this.debugLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
75
- } else if (device.logging) {
76
- this.deviceLogging = this.accessory.context.logging = device.logging;
77
- this.debugLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
78
- } else if (this.platform.config.options?.logging) {
79
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
80
- this.debugLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
81
- } else {
82
- this.deviceLogging = this.accessory.context.logging = 'standard';
83
- this.debugLog(`Camera: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
84
- }
85
- }
86
-
87
61
  private OnSet(value: CharacteristicValue) {
88
62
  this.debugLog(`Camera: ${this.accessory.displayName} On: ${value}`);
89
63
  this.On = value;
@@ -195,6 +169,35 @@ export class Camera {
195
169
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
196
170
  }
197
171
 
172
+ config(device: irdevice & irDevicesConfig) {
173
+ let config = {};
174
+ if (device.ircam) {
175
+ config = device.ircam;
176
+ }
177
+ if (device.logging !== undefined) {
178
+ config['logging'] = device.logging;
179
+ }
180
+ if (config !== undefined) {
181
+ this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
182
+ }
183
+ }
184
+
185
+ logs(device: irdevice & irDevicesConfig) {
186
+ if (this.platform.debugMode) {
187
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
188
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
189
+ } else if (device.logging) {
190
+ this.deviceLogging = this.accessory.context.logging = device.logging;
191
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
192
+ } else if (this.platform.config.options?.logging) {
193
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
194
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
195
+ } else {
196
+ this.deviceLogging = this.accessory.context.logging = 'standard';
197
+ this.debugLog(`Camera: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
198
+ }
199
+ }
200
+
198
201
  /**
199
202
  * Logging for Device
200
203
  */
@@ -117,32 +117,6 @@ export class Fan {
117
117
  }
118
118
  }
119
119
 
120
- config(device: irdevice & irDevicesConfig) {
121
- const config: any = device.irfan;
122
- if (device.logging !== undefined) {
123
- config['logging'] = device.logging;
124
- }
125
- if (config !== undefined) {
126
- this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
127
- }
128
- }
129
-
130
- logs(device: irdevice & irDevicesConfig) {
131
- if (this.platform.debugMode) {
132
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
133
- this.debugLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
134
- } else if (device.logging) {
135
- this.deviceLogging = this.accessory.context.logging = device.logging;
136
- this.debugLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
137
- } else if (this.platform.config.options?.logging) {
138
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
139
- this.debugLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
140
- } else {
141
- this.deviceLogging = this.accessory.context.logging = 'standard';
142
- this.debugLog(`Fan: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
143
- }
144
- }
145
-
146
120
  private SwingModeSet(value: CharacteristicValue) {
147
121
  this.debugLog(`Fan: ${this.accessory.displayName} SwingMode: ${value}`);
148
122
  if (value > this.SwingMode) {
@@ -319,6 +293,35 @@ export class Fan {
319
293
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
320
294
  }
321
295
 
296
+ config(device: irdevice & irDevicesConfig) {
297
+ let config = {};
298
+ if (device.irfan) {
299
+ config = device.irfan;
300
+ }
301
+ if (device.logging !== undefined) {
302
+ config['logging'] = device.logging;
303
+ }
304
+ if (config !== undefined) {
305
+ this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
306
+ }
307
+ }
308
+
309
+ logs(device: irdevice & irDevicesConfig) {
310
+ 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}`);
313
+ } else if (device.logging) {
314
+ this.deviceLogging = this.accessory.context.logging = device.logging;
315
+ this.debugLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
316
+ } 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}`);
319
+ } else {
320
+ this.deviceLogging = this.accessory.context.logging = 'standard';
321
+ this.debugLog(`Fan: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
322
+ }
323
+ }
324
+
322
325
  /**
323
326
  * Logging for Device
324
327
  */
@@ -73,32 +73,6 @@ export class Light {
73
73
  });*/
74
74
  }
75
75
 
76
- config(device: irdevice & irDevicesConfig) {
77
- const config: any = device.irlight;
78
- if (device.logging !== undefined) {
79
- config['logging'] = device.logging;
80
- }
81
- if (config !== undefined) {
82
- this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
83
- }
84
- }
85
-
86
- logs(device: irdevice & irDevicesConfig) {
87
- if (this.platform.debugMode) {
88
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
89
- this.debugLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
90
- } else if (device.logging) {
91
- this.deviceLogging = this.accessory.context.logging = device.logging;
92
- this.debugLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
93
- } else if (this.platform.config.options?.logging) {
94
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
95
- this.debugLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
96
- } else {
97
- this.deviceLogging = this.accessory.context.logging = 'standard';
98
- this.debugLog(`Light: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
99
- }
100
- }
101
-
102
76
  private OnSet(value: CharacteristicValue) {
103
77
  this.debugLog(`Light: ${this.accessory.displayName} On: ${value}`);
104
78
  this.On = value;
@@ -229,6 +203,35 @@ export class Light {
229
203
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
230
204
  }
231
205
 
206
+ config(device: irdevice & irDevicesConfig) {
207
+ let config = {};
208
+ if (device.irlight) {
209
+ config = device.irlight;
210
+ }
211
+ if (device.logging !== undefined) {
212
+ config['logging'] = device.logging;
213
+ }
214
+ if (config !== undefined) {
215
+ this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
216
+ }
217
+ }
218
+
219
+ logs(device: irdevice & irDevicesConfig) {
220
+ if (this.platform.debugMode) {
221
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
222
+ this.debugLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
223
+ } else if (device.logging) {
224
+ this.deviceLogging = this.accessory.context.logging = device.logging;
225
+ this.debugLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
226
+ } else if (this.platform.config.options?.logging) {
227
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
228
+ this.debugLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
229
+ } else {
230
+ this.deviceLogging = this.accessory.context.logging = 'standard';
231
+ this.debugLog(`Light: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
232
+ }
233
+ }
234
+
232
235
  /**
233
236
  * Logging for Device
234
237
  */