@switchbot/homebridge-switchbot 2.0.0-beta.26 → 2.0.0-beta.28
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 +0 -2
- package/config.schema.json +2 -29
- package/dist/device/bot.d.ts +2 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +23 -19
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +43 -16
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -0
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +19 -9
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +27 -12
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +6 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +45 -20
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +2 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +25 -6
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +2 -0
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +19 -9
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +2 -0
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +19 -9
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +2 -0
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +19 -9
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +27 -12
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +2 -0
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +45 -18
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +2 -0
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +14 -0
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +2 -0
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +14 -0
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +2 -0
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +14 -0
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -0
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +14 -0
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +2 -0
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +14 -0
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +2 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +14 -0
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +2 -0
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +14 -0
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +2 -0
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +14 -0
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +2 -0
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +14 -0
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +4 -5
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +148 -180
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/device/bot.ts +25 -19
- package/src/device/colorbulb.ts +40 -16
- package/src/device/contact.ts +21 -9
- package/src/device/curtain.ts +28 -12
- package/src/device/humidifier.ts +44 -20
- package/src/device/lock.ts +26 -6
- package/src/device/meter.ts +21 -9
- package/src/device/meterplus.ts +21 -9
- package/src/device/motion.ts +21 -9
- package/src/device/plug.ts +28 -12
- package/src/device/striplight.ts +42 -18
- package/src/irdevice/airconditioner.ts +16 -0
- package/src/irdevice/airpurifier.ts +16 -0
- package/src/irdevice/camera.ts +16 -0
- package/src/irdevice/fan.ts +16 -0
- package/src/irdevice/light.ts +16 -0
- package/src/irdevice/other.ts +16 -0
- package/src/irdevice/tv.ts +16 -0
- package/src/irdevice/vacuumcleaner.ts +16 -0
- package/src/irdevice/waterheater.ts +16 -0
- package/src/platform.ts +146 -181
- package/src/settings.ts +1 -0
package/src/device/meter.ts
CHANGED
|
@@ -181,7 +181,7 @@ export class Meter {
|
|
|
181
181
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
182
182
|
await this.openAPIparseStatus();
|
|
183
183
|
} else {
|
|
184
|
-
this.
|
|
184
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
185
185
|
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -236,7 +236,7 @@ export class Meter {
|
|
|
236
236
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
237
237
|
await this.openAPIRefreshStatus();
|
|
238
238
|
} else {
|
|
239
|
-
this.
|
|
239
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
240
240
|
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -262,12 +262,8 @@ export class Meter {
|
|
|
262
262
|
// Set an event hander
|
|
263
263
|
switchbot.onadvertisement = (ad: ad) => {
|
|
264
264
|
this.address = ad.address;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.infoLog(this.device.bleMac);
|
|
268
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
|
|
269
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
270
|
-
}
|
|
265
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
266
|
+
+ ` BLE Address Found: ${this.address}`);
|
|
271
267
|
if (ad.serviceData.humidity! > 0) {
|
|
272
268
|
// reject unreliable data
|
|
273
269
|
this.humidity = ad.serviceData.humidity;
|
|
@@ -491,7 +487,7 @@ export class Meter {
|
|
|
491
487
|
|
|
492
488
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
493
489
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
494
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
490
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
495
491
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
496
492
|
await this.openAPIRefreshStatus();
|
|
497
493
|
}
|
|
@@ -683,12 +679,28 @@ export class Meter {
|
|
|
683
679
|
}
|
|
684
680
|
}
|
|
685
681
|
|
|
682
|
+
debugWarnLog(...log: any[]): void {
|
|
683
|
+
if (this.enablingDeviceLogging()) {
|
|
684
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
685
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
686
690
|
errorLog(...log: any[]): void {
|
|
687
691
|
if (this.enablingDeviceLogging()) {
|
|
688
692
|
this.platform.log.error(String(...log));
|
|
689
693
|
}
|
|
690
694
|
}
|
|
691
695
|
|
|
696
|
+
debugErrorLog(...log: any[]): void {
|
|
697
|
+
if (this.enablingDeviceLogging()) {
|
|
698
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
699
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
692
704
|
debugLog(...log: any[]): void {
|
|
693
705
|
if (this.enablingDeviceLogging()) {
|
|
694
706
|
if (this.deviceLogging === 'debug') {
|
package/src/device/meterplus.ts
CHANGED
|
@@ -181,7 +181,7 @@ export class MeterPlus {
|
|
|
181
181
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
182
182
|
await this.openAPIparseStatus();
|
|
183
183
|
} else {
|
|
184
|
-
this.
|
|
184
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
185
185
|
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -236,7 +236,7 @@ export class MeterPlus {
|
|
|
236
236
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
237
237
|
await this.openAPIRefreshStatus();
|
|
238
238
|
} else {
|
|
239
|
-
this.
|
|
239
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
240
240
|
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -262,12 +262,8 @@ export class MeterPlus {
|
|
|
262
262
|
// Set an event hander
|
|
263
263
|
switchbot.onadvertisement = (ad: ad) => {
|
|
264
264
|
this.address = ad.address;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.infoLog(this.device.bleMac);
|
|
268
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
|
|
269
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
270
|
-
}
|
|
265
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
266
|
+
+ ` BLE Address Found: ${this.address}`);
|
|
271
267
|
if (ad.serviceData.humidity! > 0) {
|
|
272
268
|
// reject unreliable data
|
|
273
269
|
this.humidity = ad.serviceData.humidity;
|
|
@@ -490,7 +486,7 @@ export class MeterPlus {
|
|
|
490
486
|
|
|
491
487
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
492
488
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
493
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
489
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
494
490
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
495
491
|
await this.openAPIRefreshStatus();
|
|
496
492
|
}
|
|
@@ -692,12 +688,28 @@ export class MeterPlus {
|
|
|
692
688
|
}
|
|
693
689
|
}
|
|
694
690
|
|
|
691
|
+
debugWarnLog(...log: any[]): void {
|
|
692
|
+
if (this.enablingDeviceLogging()) {
|
|
693
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
694
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
695
699
|
errorLog(...log: any[]): void {
|
|
696
700
|
if (this.enablingDeviceLogging()) {
|
|
697
701
|
this.platform.log.error(String(...log));
|
|
698
702
|
}
|
|
699
703
|
}
|
|
700
704
|
|
|
705
|
+
debugErrorLog(...log: any[]): void {
|
|
706
|
+
if (this.enablingDeviceLogging()) {
|
|
707
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
708
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
701
713
|
debugLog(...log: any[]): void {
|
|
702
714
|
if (this.enablingDeviceLogging()) {
|
|
703
715
|
if (this.deviceLogging === 'debug') {
|
package/src/device/motion.ts
CHANGED
|
@@ -147,7 +147,7 @@ export class Motion {
|
|
|
147
147
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
148
148
|
await this.openAPIparseStatus();
|
|
149
149
|
} else {
|
|
150
|
-
this.
|
|
150
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
151
151
|
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -218,7 +218,7 @@ export class Motion {
|
|
|
218
218
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
219
219
|
await this.openAPIRefreshStatus();
|
|
220
220
|
} else {
|
|
221
|
-
this.
|
|
221
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
222
222
|
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -246,12 +246,8 @@ export class Motion {
|
|
|
246
246
|
// Set an event hander
|
|
247
247
|
switchbot.onadvertisement = (ad: any) => {
|
|
248
248
|
this.address = ad.address;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.infoLog(this.device.bleMac);
|
|
252
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
|
|
253
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
254
|
-
}
|
|
249
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
250
|
+
+ ` BLE Address Found: ${this.address}`);
|
|
255
251
|
this.serviceData = ad.serviceData;
|
|
256
252
|
this.movement = ad.serviceData.movement;
|
|
257
253
|
this.battery = ad.serviceData.battery;
|
|
@@ -407,7 +403,7 @@ export class Motion {
|
|
|
407
403
|
|
|
408
404
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
409
405
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
410
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
406
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
411
407
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
412
408
|
await this.openAPIRefreshStatus();
|
|
413
409
|
}
|
|
@@ -589,12 +585,28 @@ export class Motion {
|
|
|
589
585
|
}
|
|
590
586
|
}
|
|
591
587
|
|
|
588
|
+
debugWarnLog(...log: any[]): void {
|
|
589
|
+
if (this.enablingDeviceLogging()) {
|
|
590
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
591
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
592
596
|
errorLog(...log: any[]): void {
|
|
593
597
|
if (this.enablingDeviceLogging()) {
|
|
594
598
|
this.platform.log.error(String(...log));
|
|
595
599
|
}
|
|
596
600
|
}
|
|
597
601
|
|
|
602
|
+
debugErrorLog(...log: any[]): void {
|
|
603
|
+
if (this.enablingDeviceLogging()) {
|
|
604
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
605
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
598
610
|
debugLog(...log: any[]): void {
|
|
599
611
|
if (this.enablingDeviceLogging()) {
|
|
600
612
|
if (this.deviceLogging === 'debug') {
|
package/src/device/plug.ts
CHANGED
|
@@ -130,7 +130,7 @@ export class Plug {
|
|
|
130
130
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
131
131
|
await this.openAPIparseStatus();
|
|
132
132
|
} else {
|
|
133
|
-
this.
|
|
133
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
134
134
|
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -169,7 +169,7 @@ export class Plug {
|
|
|
169
169
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
170
170
|
await this.openAPIRefreshStatus();
|
|
171
171
|
} else {
|
|
172
|
-
this.
|
|
172
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
173
173
|
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -195,12 +195,8 @@ export class Plug {
|
|
|
195
195
|
// Set an event hander
|
|
196
196
|
switchbot.onadvertisement = (ad: any) => {
|
|
197
197
|
this.address = ad.address;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.infoLog(this.device.bleMac);
|
|
201
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
|
|
202
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
203
|
-
}
|
|
198
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
199
|
+
+ ` BLE Address Found: ${this.address}`);
|
|
204
200
|
this.serviceData = ad.serviceData;
|
|
205
201
|
this.state = ad.serviceData.state;
|
|
206
202
|
this.delay = ad.serviceData.delay;
|
|
@@ -317,7 +313,7 @@ export class Plug {
|
|
|
317
313
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
318
314
|
await this.openAPIpushChanges();
|
|
319
315
|
} else {
|
|
320
|
-
this.
|
|
316
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
321
317
|
+ ` ${this.device.connectionType}, pushChanges will not happen.`);
|
|
322
318
|
}
|
|
323
319
|
interval(5000)
|
|
@@ -436,7 +432,11 @@ export class Plug {
|
|
|
436
432
|
* Handle requests to set the value of the "On" characteristic
|
|
437
433
|
*/
|
|
438
434
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
439
|
-
|
|
435
|
+
if (this.On === this.accessory.context.On) {
|
|
436
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set On: ${value}`);
|
|
437
|
+
} else {
|
|
438
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set On: ${value}`);
|
|
439
|
+
}
|
|
440
440
|
|
|
441
441
|
this.On = value;
|
|
442
442
|
this.doPlugUpdate.next();
|
|
@@ -479,7 +479,7 @@ export class Plug {
|
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
async BLEPushConnection() {
|
|
482
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
482
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
483
483
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
484
484
|
await this.openAPIpushChanges();
|
|
485
485
|
}
|
|
@@ -487,7 +487,7 @@ export class Plug {
|
|
|
487
487
|
|
|
488
488
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
489
489
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
490
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
490
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
491
491
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
492
492
|
await this.openAPIRefreshStatus();
|
|
493
493
|
}
|
|
@@ -689,12 +689,28 @@ export class Plug {
|
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
debugWarnLog(...log: any[]): void {
|
|
693
|
+
if (this.enablingDeviceLogging()) {
|
|
694
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
695
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
692
700
|
errorLog(...log: any[]): void {
|
|
693
701
|
if (this.enablingDeviceLogging()) {
|
|
694
702
|
this.platform.log.error(String(...log));
|
|
695
703
|
}
|
|
696
704
|
}
|
|
697
705
|
|
|
706
|
+
debugErrorLog(...log: any[]): void {
|
|
707
|
+
if (this.enablingDeviceLogging()) {
|
|
708
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
709
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
698
714
|
debugLog(...log: any[]): void {
|
|
699
715
|
if (this.enablingDeviceLogging()) {
|
|
700
716
|
if (this.deviceLogging === 'debug') {
|
package/src/device/striplight.ts
CHANGED
|
@@ -224,7 +224,7 @@ export class StripLight {
|
|
|
224
224
|
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
225
225
|
await this.openAPIparseStatus();
|
|
226
226
|
} else {
|
|
227
|
-
this.
|
|
227
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
228
228
|
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -288,7 +288,7 @@ export class StripLight {
|
|
|
288
288
|
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
289
289
|
await this.openAPIRefreshStatus();
|
|
290
290
|
} else {
|
|
291
|
-
this.
|
|
291
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
292
292
|
+ ` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
@@ -314,12 +314,8 @@ export class StripLight {
|
|
|
314
314
|
// Set an event hander
|
|
315
315
|
switchbot.onadvertisement = (ad: any) => {
|
|
316
316
|
this.address = ad.address;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
this.infoLog(this.device.bleMac);
|
|
320
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
|
|
321
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
|
|
322
|
-
}
|
|
317
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
318
|
+
+ ` BLE Address Found: ${this.address}`);
|
|
323
319
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${superStringify(ad.serviceData)}`);
|
|
324
320
|
this.serviceData = ad.serviceData;
|
|
325
321
|
//this.state = ad.serviceData.state;
|
|
@@ -439,7 +435,7 @@ export class StripLight {
|
|
|
439
435
|
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
440
436
|
await this.openAPIpushChanges();
|
|
441
437
|
} else {
|
|
442
|
-
this.
|
|
438
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
443
439
|
+ ` ${this.device.connectionType}, pushChanges will not happen.`);
|
|
444
440
|
}
|
|
445
441
|
interval(5000)
|
|
@@ -683,7 +679,11 @@ export class StripLight {
|
|
|
683
679
|
* Handle requests to set the value of the "On" characteristic
|
|
684
680
|
*/
|
|
685
681
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
686
|
-
|
|
682
|
+
if (this.On === this.accessory.context.On) {
|
|
683
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set On: ${value}`);
|
|
684
|
+
} else {
|
|
685
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set On: ${value}`);
|
|
686
|
+
}
|
|
687
687
|
|
|
688
688
|
this.On = value;
|
|
689
689
|
this.doStripLightUpdate.next();
|
|
@@ -693,7 +693,9 @@ export class StripLight {
|
|
|
693
693
|
* Handle requests to set the value of the "Brightness" characteristic
|
|
694
694
|
*/
|
|
695
695
|
async BrightnessSet(value: CharacteristicValue): Promise<void> {
|
|
696
|
-
if (this.
|
|
696
|
+
if (this.Brightness === this.accessory.context.Brightness) {
|
|
697
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set Brightness: ${value}`);
|
|
698
|
+
} else if (this.On) {
|
|
697
699
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Brightness: ${value}`);
|
|
698
700
|
} else {
|
|
699
701
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Brightness: ${value}`);
|
|
@@ -707,10 +709,12 @@ export class StripLight {
|
|
|
707
709
|
* Handle requests to set the value of the "ColorTemperature" characteristic
|
|
708
710
|
*/
|
|
709
711
|
async ColorTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
710
|
-
if (this.
|
|
711
|
-
this.
|
|
712
|
+
if (this.ColorTemperature === this.accessory.context.ColorTemperature) {
|
|
713
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set ColorTemperature: ${value}`);
|
|
714
|
+
} else if (this.On) {
|
|
715
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set ColorTemperature: ${value}`);
|
|
712
716
|
} else {
|
|
713
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${value}`);
|
|
717
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Set ColorTemperature: ${value}`);
|
|
714
718
|
}
|
|
715
719
|
|
|
716
720
|
// Convert mired to kelvin to nearest 100 (SwitchBot seems to need this)
|
|
@@ -736,7 +740,9 @@ export class StripLight {
|
|
|
736
740
|
* Handle requests to set the value of the "Hue" characteristic
|
|
737
741
|
*/
|
|
738
742
|
async HueSet(value: CharacteristicValue): Promise<void> {
|
|
739
|
-
if (this.
|
|
743
|
+
if (this.Hue === this.accessory.context.Hue) {
|
|
744
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set Hue: ${value}`);
|
|
745
|
+
} else if (this.On) {
|
|
740
746
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Hue: ${value}`);
|
|
741
747
|
} else {
|
|
742
748
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Hue: ${value}`);
|
|
@@ -752,7 +758,9 @@ export class StripLight {
|
|
|
752
758
|
* Handle requests to set the value of the "Saturation" characteristic
|
|
753
759
|
*/
|
|
754
760
|
async SaturationSet(value: CharacteristicValue): Promise<void> {
|
|
755
|
-
if (this.
|
|
761
|
+
if (this.Saturation === this.accessory.context.Saturation) {
|
|
762
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No Changes, Set Saturation: ${value}`);
|
|
763
|
+
} else if (this.On) {
|
|
756
764
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Saturation: ${value}`);
|
|
757
765
|
} else {
|
|
758
766
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Set Saturation: ${value}`);
|
|
@@ -822,7 +830,7 @@ export class StripLight {
|
|
|
822
830
|
}
|
|
823
831
|
|
|
824
832
|
async BLEPushConnection() {
|
|
825
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
833
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
826
834
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
827
835
|
await this.openAPIpushChanges();
|
|
828
836
|
}
|
|
@@ -830,7 +838,7 @@ export class StripLight {
|
|
|
830
838
|
|
|
831
839
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
832
840
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
833
|
-
if (this.platform.config.credentials?.token && this.device.connectionType
|
|
841
|
+
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
834
842
|
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
835
843
|
await this.openAPIRefreshStatus();
|
|
836
844
|
}
|
|
@@ -1068,12 +1076,28 @@ export class StripLight {
|
|
|
1068
1076
|
}
|
|
1069
1077
|
}
|
|
1070
1078
|
|
|
1079
|
+
debugWarnLog(...log: any[]): void {
|
|
1080
|
+
if (this.enablingDeviceLogging()) {
|
|
1081
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
1082
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1071
1087
|
errorLog(...log: any[]): void {
|
|
1072
1088
|
if (this.enablingDeviceLogging()) {
|
|
1073
1089
|
this.platform.log.error(String(...log));
|
|
1074
1090
|
}
|
|
1075
1091
|
}
|
|
1076
1092
|
|
|
1093
|
+
debugErrorLog(...log: any[]): void {
|
|
1094
|
+
if (this.enablingDeviceLogging()) {
|
|
1095
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
1096
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1077
1101
|
debugLog(...log: any[]): void {
|
|
1078
1102
|
if (this.enablingDeviceLogging()) {
|
|
1079
1103
|
if (this.deviceLogging === 'debug') {
|
|
@@ -686,12 +686,28 @@ export class AirConditioner {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
+
debugWarnLog(...log: any[]): void {
|
|
690
|
+
if (this.enablingDeviceLogging()) {
|
|
691
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
692
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
689
697
|
errorLog(...log: any[]): void {
|
|
690
698
|
if (this.enablingDeviceLogging()) {
|
|
691
699
|
this.platform.log.error(String(...log));
|
|
692
700
|
}
|
|
693
701
|
}
|
|
694
702
|
|
|
703
|
+
debugErrorLog(...log: any[]): void {
|
|
704
|
+
if (this.enablingDeviceLogging()) {
|
|
705
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
706
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
695
711
|
debugLog(...log: any[]): void {
|
|
696
712
|
if (this.enablingDeviceLogging()) {
|
|
697
713
|
if (this.deviceLogging === 'debug') {
|
|
@@ -377,12 +377,28 @@ export class AirPurifier {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
debugWarnLog(...log: any[]): void {
|
|
381
|
+
if (this.enablingDeviceLogging()) {
|
|
382
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
383
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
380
388
|
errorLog(...log: any[]): void {
|
|
381
389
|
if (this.enablingDeviceLogging()) {
|
|
382
390
|
this.platform.log.error(String(...log));
|
|
383
391
|
}
|
|
384
392
|
}
|
|
385
393
|
|
|
394
|
+
debugErrorLog(...log: any[]): void {
|
|
395
|
+
if (this.enablingDeviceLogging()) {
|
|
396
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
397
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
386
402
|
debugLog(...log: any[]): void {
|
|
387
403
|
if (this.enablingDeviceLogging()) {
|
|
388
404
|
if (this.deviceLogging === 'debug') {
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -266,12 +266,28 @@ export class Camera {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
debugWarnLog(...log: any[]): void {
|
|
270
|
+
if (this.enablingDeviceLogging()) {
|
|
271
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
272
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
269
277
|
errorLog(...log: any[]): void {
|
|
270
278
|
if (this.enablingDeviceLogging()) {
|
|
271
279
|
this.platform.log.error(String(...log));
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
|
|
283
|
+
debugErrorLog(...log: any[]): void {
|
|
284
|
+
if (this.enablingDeviceLogging()) {
|
|
285
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
286
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
275
291
|
debugLog(...log: any[]): void {
|
|
276
292
|
if (this.enablingDeviceLogging()) {
|
|
277
293
|
if (this.deviceLogging === 'debug') {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -398,12 +398,28 @@ export class Fan {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
debugWarnLog(...log: any[]): void {
|
|
402
|
+
if (this.enablingDeviceLogging()) {
|
|
403
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
404
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
401
409
|
errorLog(...log: any[]): void {
|
|
402
410
|
if (this.enablingDeviceLogging()) {
|
|
403
411
|
this.platform.log.error(String(...log));
|
|
404
412
|
}
|
|
405
413
|
}
|
|
406
414
|
|
|
415
|
+
debugErrorLog(...log: any[]): void {
|
|
416
|
+
if (this.enablingDeviceLogging()) {
|
|
417
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
418
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
407
423
|
debugLog(...log: any[]): void {
|
|
408
424
|
if (this.enablingDeviceLogging()) {
|
|
409
425
|
if (this.deviceLogging === 'debug') {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -285,12 +285,28 @@ export class Light {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
debugWarnLog(...log: any[]): void {
|
|
289
|
+
if (this.enablingDeviceLogging()) {
|
|
290
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
291
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
288
296
|
errorLog(...log: any[]): void {
|
|
289
297
|
if (this.enablingDeviceLogging()) {
|
|
290
298
|
this.platform.log.error(String(...log));
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
|
|
302
|
+
debugErrorLog(...log: any[]): void {
|
|
303
|
+
if (this.enablingDeviceLogging()) {
|
|
304
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
305
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
294
310
|
debugLog(...log: any[]): void {
|
|
295
311
|
if (this.enablingDeviceLogging()) {
|
|
296
312
|
if (this.deviceLogging === 'debug') {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -309,12 +309,28 @@ export class Others {
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
debugWarnLog(...log: any[]): void {
|
|
313
|
+
if (this.enablingDeviceLogging()) {
|
|
314
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
315
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
312
320
|
errorLog(...log: any[]): void {
|
|
313
321
|
if (this.enablingDeviceLogging()) {
|
|
314
322
|
this.platform.log.error(String(...log));
|
|
315
323
|
}
|
|
316
324
|
}
|
|
317
325
|
|
|
326
|
+
debugErrorLog(...log: any[]): void {
|
|
327
|
+
if (this.enablingDeviceLogging()) {
|
|
328
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
329
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
318
334
|
debugLog(...log: any[]): void {
|
|
319
335
|
if (this.enablingDeviceLogging()) {
|
|
320
336
|
if (this.deviceLogging === 'debug') {
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -500,12 +500,28 @@ export class TV {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
debugWarnLog(...log: any[]): void {
|
|
504
|
+
if (this.enablingDeviceLogging()) {
|
|
505
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
506
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
503
511
|
errorLog(...log: any[]): void {
|
|
504
512
|
if (this.enablingDeviceLogging()) {
|
|
505
513
|
this.platform.log.error(String(...log));
|
|
506
514
|
}
|
|
507
515
|
}
|
|
508
516
|
|
|
517
|
+
debugErrorLog(...log: any[]): void {
|
|
518
|
+
if (this.enablingDeviceLogging()) {
|
|
519
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
520
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
509
525
|
debugLog(...log: any[]): void {
|
|
510
526
|
if (this.enablingDeviceLogging()) {
|
|
511
527
|
if (this.deviceLogging === 'debug') {
|