@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.
- package/CHANGELOG.md +1 -1
- package/dist/devices/bots.d.ts +15 -15
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +162 -159
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +5 -5
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +69 -66
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +8 -8
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +81 -78
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +7 -7
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +100 -97
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +5 -5
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +72 -69
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +4 -4
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +63 -60
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +6 -6
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +81 -78
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +4 -4
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +63 -60
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +2 -2
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +30 -27
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +2 -2
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +30 -27
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +2 -2
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +30 -27
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +2 -2
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +30 -27
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +2 -2
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +30 -27
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +3 -3
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +41 -38
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +2 -2
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +30 -27
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +2 -2
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +30 -27
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +2 -2
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +30 -27
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/package.json +1 -1
- package/src/devices/bots.ts +169 -166
- package/src/devices/colorbulb.ts +68 -65
- package/src/devices/contact.ts +82 -79
- package/src/devices/curtains.ts +98 -95
- package/src/devices/humidifiers.ts +71 -68
- package/src/devices/meters.ts +62 -59
- package/src/devices/motion.ts +80 -77
- package/src/devices/plugs.ts +62 -59
- package/src/irdevices/airconditioners.ts +29 -26
- package/src/irdevices/airpurifiers.ts +29 -26
- package/src/irdevices/cameras.ts +29 -26
- package/src/irdevices/fans.ts +29 -26
- package/src/irdevices/lights.ts +29 -26
- package/src/irdevices/others.ts +40 -37
- package/src/irdevices/tvs.ts +29 -26
- package/src/irdevices/vacuumcleaners.ts +29 -26
- package/src/irdevices/waterheaters.ts +29 -26
package/src/devices/curtains.ts
CHANGED
|
@@ -209,101 +209,6 @@ export class Curtain {
|
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
config(device: device & devicesConfig) {
|
|
213
|
-
const config: any = device.curtain;
|
|
214
|
-
if (device.ble) {
|
|
215
|
-
config['ble'] = device.ble;
|
|
216
|
-
}
|
|
217
|
-
if (device.logging !== undefined) {
|
|
218
|
-
config['logging'] = device.logging;
|
|
219
|
-
}
|
|
220
|
-
if (device.refreshRate !== undefined) {
|
|
221
|
-
config['refreshRate'] = device.refreshRate;
|
|
222
|
-
}
|
|
223
|
-
if (device.scanDuration !== undefined) {
|
|
224
|
-
config['scanDuration'] = device.scanDuration;
|
|
225
|
-
}
|
|
226
|
-
if (config !== undefined) {
|
|
227
|
-
this.warnLog(`Curtain: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
refreshRate(device: device & devicesConfig) {
|
|
232
|
-
// refreshRate
|
|
233
|
-
if (device.refreshRate) {
|
|
234
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
235
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
236
|
-
} else if (this.platform.config.options!.refreshRate) {
|
|
237
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
238
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
239
|
-
}
|
|
240
|
-
// updateRate
|
|
241
|
-
if (device?.curtain?.updateRate) {
|
|
242
|
-
this.updateRate = device?.curtain?.updateRate;
|
|
243
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config Curtain refreshRate: ${this.deviceRefreshRate}`);
|
|
244
|
-
} else {
|
|
245
|
-
this.updateRate = 5;
|
|
246
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Default Curtain Refresh Rate.`);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
scan(device: device & devicesConfig) {
|
|
251
|
-
if (device.scanDuration) {
|
|
252
|
-
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
253
|
-
if (device.ble) {
|
|
254
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
258
|
-
if (this.device.ble) {
|
|
259
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
logs(device: device & devicesConfig) {
|
|
265
|
-
if (this.platform.debugMode) {
|
|
266
|
-
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
267
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
268
|
-
} else if (device.logging) {
|
|
269
|
-
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
270
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
271
|
-
} else if (this.platform.config.options?.logging) {
|
|
272
|
-
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
273
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
274
|
-
} else {
|
|
275
|
-
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
276
|
-
this.debugLog(`Curtain: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
private minStep(device: device & devicesConfig): number {
|
|
281
|
-
if (device.curtain?.set_minStep) {
|
|
282
|
-
this.set_minStep = device.curtain?.set_minStep;
|
|
283
|
-
} else {
|
|
284
|
-
this.set_minStep = 1;
|
|
285
|
-
}
|
|
286
|
-
return this.set_minStep;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
private minLux(): number {
|
|
290
|
-
if (this.device.curtain?.set_minLux) {
|
|
291
|
-
this.set_minLux = this.device.curtain?.set_minLux;
|
|
292
|
-
} else {
|
|
293
|
-
this.set_minLux = 1;
|
|
294
|
-
}
|
|
295
|
-
return this.set_minLux;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
private maxLux(): number {
|
|
299
|
-
if (this.device.curtain?.set_maxLux) {
|
|
300
|
-
this.set_maxLux = this.device.curtain?.set_maxLux;
|
|
301
|
-
} else {
|
|
302
|
-
this.set_maxLux = 6001;
|
|
303
|
-
}
|
|
304
|
-
return this.set_maxLux;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
212
|
/**
|
|
308
213
|
* Parse the device status from the SwitchBot api
|
|
309
214
|
*/
|
|
@@ -812,6 +717,104 @@ export class Curtain {
|
|
|
812
717
|
}
|
|
813
718
|
}
|
|
814
719
|
|
|
720
|
+
config(device: device & devicesConfig) {
|
|
721
|
+
let config = {};
|
|
722
|
+
if (device.curtain) {
|
|
723
|
+
config = device.curtain;
|
|
724
|
+
}
|
|
725
|
+
if (device.ble) {
|
|
726
|
+
config['ble'] = device.ble;
|
|
727
|
+
}
|
|
728
|
+
if (device.logging !== undefined) {
|
|
729
|
+
config['logging'] = device.logging;
|
|
730
|
+
}
|
|
731
|
+
if (device.refreshRate !== undefined) {
|
|
732
|
+
config['refreshRate'] = device.refreshRate;
|
|
733
|
+
}
|
|
734
|
+
if (device.scanDuration !== undefined) {
|
|
735
|
+
config['scanDuration'] = device.scanDuration;
|
|
736
|
+
}
|
|
737
|
+
if (Object.entries(config).length === 0) {
|
|
738
|
+
this.warnLog(`Curtain: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
refreshRate(device: device & devicesConfig) {
|
|
743
|
+
// refreshRate
|
|
744
|
+
if (device.refreshRate) {
|
|
745
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
746
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
747
|
+
} else if (this.platform.config.options!.refreshRate) {
|
|
748
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
749
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
750
|
+
}
|
|
751
|
+
// updateRate
|
|
752
|
+
if (device?.curtain?.updateRate) {
|
|
753
|
+
this.updateRate = device?.curtain?.updateRate;
|
|
754
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config Curtain refreshRate: ${this.deviceRefreshRate}`);
|
|
755
|
+
} else {
|
|
756
|
+
this.updateRate = 5;
|
|
757
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Default Curtain Refresh Rate.`);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
scan(device: device & devicesConfig) {
|
|
762
|
+
if (device.scanDuration) {
|
|
763
|
+
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
764
|
+
if (device.ble) {
|
|
765
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
766
|
+
}
|
|
767
|
+
} else {
|
|
768
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
769
|
+
if (this.device.ble) {
|
|
770
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
logs(device: device & devicesConfig) {
|
|
776
|
+
if (this.platform.debugMode) {
|
|
777
|
+
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
778
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
779
|
+
} else if (device.logging) {
|
|
780
|
+
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
781
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
782
|
+
} else if (this.platform.config.options?.logging) {
|
|
783
|
+
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
784
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
785
|
+
} else {
|
|
786
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
787
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
private minStep(device: device & devicesConfig): number {
|
|
792
|
+
if (device.curtain?.set_minStep) {
|
|
793
|
+
this.set_minStep = device.curtain?.set_minStep;
|
|
794
|
+
} else {
|
|
795
|
+
this.set_minStep = 1;
|
|
796
|
+
}
|
|
797
|
+
return this.set_minStep;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
private minLux(): number {
|
|
801
|
+
if (this.device.curtain?.set_minLux) {
|
|
802
|
+
this.set_minLux = this.device.curtain?.set_minLux;
|
|
803
|
+
} else {
|
|
804
|
+
this.set_minLux = 1;
|
|
805
|
+
}
|
|
806
|
+
return this.set_minLux;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
private maxLux(): number {
|
|
810
|
+
if (this.device.curtain?.set_maxLux) {
|
|
811
|
+
this.set_maxLux = this.device.curtain?.set_maxLux;
|
|
812
|
+
} else {
|
|
813
|
+
this.set_maxLux = 6001;
|
|
814
|
+
}
|
|
815
|
+
return this.set_maxLux;
|
|
816
|
+
}
|
|
817
|
+
|
|
815
818
|
/**
|
|
816
819
|
* Logging for Device
|
|
817
820
|
*/
|
|
@@ -198,74 +198,6 @@ export class Humidifier {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
config(device: device & devicesConfig) {
|
|
202
|
-
const config: any = device.humidifier;
|
|
203
|
-
if (device.ble !== undefined) {
|
|
204
|
-
config['ble'] = device.ble;
|
|
205
|
-
}
|
|
206
|
-
if (device.logging !== undefined) {
|
|
207
|
-
config['logging'] = device.logging;
|
|
208
|
-
}
|
|
209
|
-
if (device.refreshRate !== undefined) {
|
|
210
|
-
config['refreshRate'] = device.refreshRate;
|
|
211
|
-
}
|
|
212
|
-
if (device.scanDuration !== undefined) {
|
|
213
|
-
config['scanDuration'] = device.scanDuration;
|
|
214
|
-
}
|
|
215
|
-
if (config !== undefined) {
|
|
216
|
-
this.warnLog(`Humidifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
refreshRate(device: device & devicesConfig) {
|
|
221
|
-
if (device.refreshRate) {
|
|
222
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
223
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
224
|
-
} else if (this.platform.config.options!.refreshRate) {
|
|
225
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
226
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
scan(device: device & devicesConfig) {
|
|
231
|
-
if (device.scanDuration) {
|
|
232
|
-
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
233
|
-
if (device.ble) {
|
|
234
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
235
|
-
}
|
|
236
|
-
} else {
|
|
237
|
-
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
238
|
-
if (this.device.ble) {
|
|
239
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
logs(device: device & devicesConfig) {
|
|
245
|
-
if (this.platform.debugMode) {
|
|
246
|
-
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
247
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
248
|
-
} else if (device.logging) {
|
|
249
|
-
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
250
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
251
|
-
} else if (this.platform.config.options?.logging) {
|
|
252
|
-
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
253
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
254
|
-
} else {
|
|
255
|
-
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
256
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
private minStep(): number | undefined {
|
|
261
|
-
if (this.device.humidifier?.set_minStep) {
|
|
262
|
-
this.set_minStep = this.device.humidifier?.set_minStep;
|
|
263
|
-
} else {
|
|
264
|
-
this.set_minStep = 1;
|
|
265
|
-
}
|
|
266
|
-
return this.set_minStep;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
201
|
/**
|
|
270
202
|
* Parse the device status from the SwitchBot api
|
|
271
203
|
*/
|
|
@@ -779,6 +711,77 @@ export class Humidifier {
|
|
|
779
711
|
this.doHumidifierUpdate.next();
|
|
780
712
|
}
|
|
781
713
|
|
|
714
|
+
config(device: device & devicesConfig) {
|
|
715
|
+
let config = {};
|
|
716
|
+
if (device.humidifier) {
|
|
717
|
+
config = device.humidifier;
|
|
718
|
+
}
|
|
719
|
+
if (device.ble !== undefined) {
|
|
720
|
+
config['ble'] = device.ble;
|
|
721
|
+
}
|
|
722
|
+
if (device.logging !== undefined) {
|
|
723
|
+
config['logging'] = device.logging;
|
|
724
|
+
}
|
|
725
|
+
if (device.refreshRate !== undefined) {
|
|
726
|
+
config['refreshRate'] = device.refreshRate;
|
|
727
|
+
}
|
|
728
|
+
if (device.scanDuration !== undefined) {
|
|
729
|
+
config['scanDuration'] = device.scanDuration;
|
|
730
|
+
}
|
|
731
|
+
if (Object.entries(config).length === 0) {
|
|
732
|
+
this.warnLog(`Humidifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
refreshRate(device: device & devicesConfig) {
|
|
737
|
+
if (device.refreshRate) {
|
|
738
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
739
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
740
|
+
} else if (this.platform.config.options!.refreshRate) {
|
|
741
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
742
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
scan(device: device & devicesConfig) {
|
|
747
|
+
if (device.scanDuration) {
|
|
748
|
+
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
749
|
+
if (device.ble) {
|
|
750
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
751
|
+
}
|
|
752
|
+
} else {
|
|
753
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
754
|
+
if (this.device.ble) {
|
|
755
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
logs(device: device & devicesConfig) {
|
|
761
|
+
if (this.platform.debugMode) {
|
|
762
|
+
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
763
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
764
|
+
} else if (device.logging) {
|
|
765
|
+
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
766
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
767
|
+
} else if (this.platform.config.options?.logging) {
|
|
768
|
+
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
769
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
770
|
+
} else {
|
|
771
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
772
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
private minStep(): number | undefined {
|
|
777
|
+
if (this.device.humidifier?.set_minStep) {
|
|
778
|
+
this.set_minStep = this.device.humidifier?.set_minStep;
|
|
779
|
+
} else {
|
|
780
|
+
this.set_minStep = 1;
|
|
781
|
+
}
|
|
782
|
+
return this.set_minStep;
|
|
783
|
+
}
|
|
784
|
+
|
|
782
785
|
/**
|
|
783
786
|
* Logging for Device
|
|
784
787
|
*/
|
package/src/devices/meters.ts
CHANGED
|
@@ -174,65 +174,6 @@ export class Meter {
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
config(device: device & devicesConfig) {
|
|
178
|
-
const config: any = device.meter;
|
|
179
|
-
if (device.ble !== undefined) {
|
|
180
|
-
config['ble'] = device.ble;
|
|
181
|
-
}
|
|
182
|
-
if (device.logging !== undefined) {
|
|
183
|
-
config['logging'] = device.logging;
|
|
184
|
-
}
|
|
185
|
-
if (device.refreshRate !== undefined) {
|
|
186
|
-
config['refreshRate'] = device.refreshRate;
|
|
187
|
-
}
|
|
188
|
-
if (device.scanDuration !== undefined) {
|
|
189
|
-
config['scanDuration'] = device.scanDuration;
|
|
190
|
-
}
|
|
191
|
-
if (config !== undefined) {
|
|
192
|
-
this.warnLog(`Meter: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
refreshRate(device: device & devicesConfig) {
|
|
197
|
-
if (device.refreshRate) {
|
|
198
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
199
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
200
|
-
} else if (this.platform.config.options!.refreshRate) {
|
|
201
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
202
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
scan(device: device & devicesConfig) {
|
|
207
|
-
if (device.scanDuration) {
|
|
208
|
-
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
209
|
-
if (device.ble) {
|
|
210
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
214
|
-
if (this.device.ble) {
|
|
215
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
logs(device: device & devicesConfig) {
|
|
221
|
-
if (this.platform.debugMode) {
|
|
222
|
-
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
223
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
224
|
-
} else if (device.logging) {
|
|
225
|
-
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
226
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
227
|
-
} else if (this.platform.config.options?.logging) {
|
|
228
|
-
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
229
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
230
|
-
} else {
|
|
231
|
-
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
232
|
-
this.debugLog(`Meter: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
177
|
/**
|
|
237
178
|
* Parse the device status from the SwitchBot api
|
|
238
179
|
*/
|
|
@@ -449,6 +390,68 @@ export class Meter {
|
|
|
449
390
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
450
391
|
}
|
|
451
392
|
|
|
393
|
+
config(device: device & devicesConfig) {
|
|
394
|
+
let config = {};
|
|
395
|
+
if (device.meter) {
|
|
396
|
+
config = device.meter;
|
|
397
|
+
}
|
|
398
|
+
if (device.ble !== undefined) {
|
|
399
|
+
config['ble'] = device.ble;
|
|
400
|
+
}
|
|
401
|
+
if (device.logging !== undefined) {
|
|
402
|
+
config['logging'] = device.logging;
|
|
403
|
+
}
|
|
404
|
+
if (device.refreshRate !== undefined) {
|
|
405
|
+
config['refreshRate'] = device.refreshRate;
|
|
406
|
+
}
|
|
407
|
+
if (device.scanDuration !== undefined) {
|
|
408
|
+
config['scanDuration'] = device.scanDuration;
|
|
409
|
+
}
|
|
410
|
+
if (Object.entries(config).length === 0) {
|
|
411
|
+
this.warnLog(`Meter: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
refreshRate(device: device & devicesConfig) {
|
|
416
|
+
if (device.refreshRate) {
|
|
417
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
418
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
419
|
+
} else if (this.platform.config.options!.refreshRate) {
|
|
420
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
421
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
scan(device: device & devicesConfig) {
|
|
426
|
+
if (device.scanDuration) {
|
|
427
|
+
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
428
|
+
if (device.ble) {
|
|
429
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
433
|
+
if (this.device.ble) {
|
|
434
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
logs(device: device & devicesConfig) {
|
|
440
|
+
if (this.platform.debugMode) {
|
|
441
|
+
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
442
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
443
|
+
} else if (device.logging) {
|
|
444
|
+
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
445
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
446
|
+
} else if (this.platform.config.options?.logging) {
|
|
447
|
+
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
448
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
449
|
+
} else {
|
|
450
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
451
|
+
this.debugLog(`Meter: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
452
455
|
/**
|
|
453
456
|
* Logging for Device
|
|
454
457
|
*/
|
package/src/devices/motion.ts
CHANGED
|
@@ -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 (Object.entries(config).length === 0) {
|
|
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
|
*/
|