@switchbot/homebridge-switchbot 1.8.1-beta.1 → 1.8.2-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 (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 +100 -97
  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 +1 -1
  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 +98 -95
  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
@@ -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 (Object.entries(config).length === 0) {
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 (Object.entries(config).length === 0) {
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 (Object.entries(config).length === 0) {
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 (Object.entries(config).length === 0) {
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 (Object.entries(config).length === 0) {
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 (Object.entries(config).length === 0) {
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
  */
@@ -66,43 +66,6 @@ export class Others {
66
66
  }
67
67
  }
68
68
 
69
- deviceType(device: irdevice & irDevicesConfig) {
70
- if (device.other?.deviceType) {
71
- this.otherDeviceType = this.accessory.context.deviceType = device.other.deviceType;
72
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
73
- this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
74
- }
75
- } else {
76
- this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
77
- }
78
- }
79
-
80
- config(device: irdevice & irDevicesConfig) {
81
- const config: any = device.other;
82
- if (device.logging !== undefined) {
83
- config['logging'] = device.logging;
84
- }
85
- if (config !== undefined) {
86
- this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
87
- }
88
- }
89
-
90
- logs(device: irdevice & irDevicesConfig) {
91
- if (this.platform.debugMode) {
92
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
93
- this.debugLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
94
- } else if (device.logging) {
95
- this.deviceLogging = this.accessory.context.logging = device.logging;
96
- this.debugLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
97
- } else if (this.platform.config.options?.logging) {
98
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
99
- this.debugLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
100
- } else {
101
- this.deviceLogging = this.accessory.context.logging = 'standard';
102
- this.debugLog(`Other: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
103
- }
104
- }
105
-
106
69
  private ActiveSet(value: CharacteristicValue) {
107
70
  this.debugLog(`Other: ${this.accessory.displayName} On: ${value}`);
108
71
  if (this.Active) {
@@ -238,6 +201,46 @@ export class Others {
238
201
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
239
202
  }
240
203
 
204
+ deviceType(device: irdevice & irDevicesConfig) {
205
+ if (device.other?.deviceType) {
206
+ this.otherDeviceType = this.accessory.context.deviceType = device.other.deviceType;
207
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
208
+ this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
209
+ }
210
+ } else {
211
+ this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
212
+ }
213
+ }
214
+
215
+ config(device: irdevice & irDevicesConfig) {
216
+ let config = {};
217
+ if (device.other) {
218
+ config = device.other;
219
+ }
220
+ if (device.logging !== undefined) {
221
+ config['logging'] = device.logging;
222
+ }
223
+ if (Object.entries(config).length === 0) {
224
+ this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
225
+ }
226
+ }
227
+
228
+ logs(device: irdevice & irDevicesConfig) {
229
+ if (this.platform.debugMode) {
230
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
231
+ this.debugLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
232
+ } else if (device.logging) {
233
+ this.deviceLogging = this.accessory.context.logging = device.logging;
234
+ this.debugLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
235
+ } else if (this.platform.config.options?.logging) {
236
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
237
+ this.debugLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
238
+ } else {
239
+ this.deviceLogging = this.accessory.context.logging = 'standard';
240
+ this.debugLog(`Other: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
241
+ }
242
+ }
243
+
241
244
  /**
242
245
  * Logging for Device
243
246
  */
@@ -129,32 +129,6 @@ export class TV {
129
129
  .onSet(this.VolumeSelectorSet.bind(this));
130
130
  }
131
131
 
132
- config(device: irdevice & irDevicesConfig) {
133
- const config: any = device.irtv;
134
- if (device.logging !== undefined) {
135
- config['logging'] = device.logging;
136
- }
137
- if (config !== undefined) {
138
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
139
- }
140
- }
141
-
142
- logs(device: irdevice & irDevicesConfig) {
143
- if (this.platform.debugMode) {
144
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
145
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
146
- } else if (device.logging) {
147
- this.deviceLogging = this.accessory.context.logging = device.logging;
148
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
149
- } else if (this.platform.config.options?.logging) {
150
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
151
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
152
- } else {
153
- this.deviceLogging = this.accessory.context.logging = 'standard';
154
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
155
- }
156
- }
157
-
158
132
  private VolumeSelectorSet(value: CharacteristicValue) {
159
133
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} VolumeSelector: ${value}`);
160
134
  if (value === this.platform.Characteristic.VolumeSelector.INCREMENT) {
@@ -435,6 +409,35 @@ export class TV {
435
409
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
436
410
  }
437
411
 
412
+ config(device: irdevice & irDevicesConfig) {
413
+ let config = {};
414
+ if (device.irtv) {
415
+ config = device.irtv;
416
+ }
417
+ if (device.logging !== undefined) {
418
+ config['logging'] = device.logging;
419
+ }
420
+ if (Object.entries(config).length === 0) {
421
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
422
+ }
423
+ }
424
+
425
+ logs(device: irdevice & irDevicesConfig) {
426
+ if (this.platform.debugMode) {
427
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
428
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
429
+ } else if (device.logging) {
430
+ this.deviceLogging = this.accessory.context.logging = device.logging;
431
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
432
+ } else if (this.platform.config.options?.logging) {
433
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
434
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
435
+ } else {
436
+ this.deviceLogging = this.accessory.context.logging = 'standard';
437
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
438
+ }
439
+ }
440
+
438
441
  /**
439
442
  * Logging for Device
440
443
  */