@switchbot/homebridge-switchbot 1.8.0 → 1.8.1-beta.3

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 +7 -0
  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 +75 -79
  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 +74 -78
  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
@@ -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 (config !== undefined) {
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 (config !== undefined) {
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
  */
@@ -58,32 +58,6 @@ export class VacuumCleaner {
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.irvc;
63
- if (device.logging !== undefined) {
64
- config['logging'] = device.logging;
65
- }
66
- if (config !== undefined) {
67
- this.warnLog(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
81
- } else {
82
- this.deviceLogging = this.accessory.context.logging = 'standard';
83
- this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
84
- }
85
- }
86
-
87
61
  private OnSet(value: CharacteristicValue) {
88
62
  this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} On: ${value}`);
89
63
  this.On = value;
@@ -195,6 +169,35 @@ export class VacuumCleaner {
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.irvc) {
175
+ config = device.irvc;
176
+ }
177
+ if (device.logging !== undefined) {
178
+ config['logging'] = device.logging;
179
+ }
180
+ if (config !== undefined) {
181
+ this.warnLog(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${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(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
195
+ } else {
196
+ this.deviceLogging = this.accessory.context.logging = 'standard';
197
+ this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
198
+ }
199
+ }
200
+
198
201
  /**
199
202
  * Logging for Device
200
203
  */
@@ -67,32 +67,6 @@ export class WaterHeater {
67
67
  this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
68
68
  }
69
69
 
70
- config(device: irdevice & irDevicesConfig) {
71
- const config: any = device.irwh;
72
- if (device.logging !== undefined) {
73
- config['logging'] = device.logging;
74
- }
75
- if (config !== undefined) {
76
- this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
77
- }
78
- }
79
-
80
- logs(device: irdevice & irDevicesConfig) {
81
- if (this.platform.debugMode) {
82
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
83
- this.debugLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
84
- } else if (device.logging) {
85
- this.deviceLogging = this.accessory.context.logging = device.logging;
86
- this.debugLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
87
- } else if (this.platform.config.options?.logging) {
88
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
89
- this.debugLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
90
- } else {
91
- this.deviceLogging = this.accessory.context.logging = 'standard';
92
- this.debugLog(`Water Heater: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
93
- }
94
- }
95
-
96
70
  private ActiveSet(value: CharacteristicValue) {
97
71
  this.debugLog(`Water Heater: ${this.accessory.displayName} Active: ${value}`);
98
72
  if (value === this.platform.Characteristic.Active.INACTIVE) {
@@ -209,6 +183,35 @@ export class WaterHeater {
209
183
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
210
184
  }
211
185
 
186
+ config(device: irdevice & irDevicesConfig) {
187
+ let config = {};
188
+ if (device.irwh) {
189
+ config = device.irwh;
190
+ }
191
+ if (device.logging !== undefined) {
192
+ config['logging'] = device.logging;
193
+ }
194
+ if (config !== undefined) {
195
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
196
+ }
197
+ }
198
+
199
+ logs(device: irdevice & irDevicesConfig) {
200
+ if (this.platform.debugMode) {
201
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
202
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
203
+ } else if (device.logging) {
204
+ this.deviceLogging = this.accessory.context.logging = device.logging;
205
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
206
+ } else if (this.platform.config.options?.logging) {
207
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
208
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
209
+ } else {
210
+ this.deviceLogging = this.accessory.context.logging = 'standard';
211
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
212
+ }
213
+ }
214
+
212
215
  /**
213
216
  * Logging for Device
214
217
  */