@switchbot/homebridge-switchbot 3.5.1-beta.10 → 3.5.1-beta.12
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/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +6 -9
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +7 -3
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -3
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +44 -103
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +0 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +18 -49
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +19 -19
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +22 -10
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +89 -67
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +15 -17
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +76 -76
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +35 -35
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +202 -201
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/ceilinglight.ts +6 -14
- package/src/device/colorbulb.ts +7 -10
- package/src/irdevice/airconditioner.ts +53 -97
- package/src/irdevice/airpurifier.ts +23 -45
- package/src/irdevice/camera.ts +9 -9
- package/src/irdevice/fan.ts +19 -19
- package/src/irdevice/irdevice.ts +92 -68
- package/src/irdevice/light.ts +15 -17
- package/src/irdevice/other.ts +76 -76
- package/src/irdevice/tv.ts +35 -35
- package/src/irdevice/vacuumcleaner.ts +9 -9
- package/src/irdevice/waterheater.ts +9 -9
- package/src/platform.ts +202 -201
package/src/irdevice/other.ts
CHANGED
|
@@ -99,7 +99,7 @@ export class Others extends irdeviceBase {
|
|
|
99
99
|
On: accessory.context.On ?? false,
|
|
100
100
|
};
|
|
101
101
|
accessory.context.Switch = this.Switch as object;
|
|
102
|
-
this.debugWarnLog(
|
|
102
|
+
this.debugWarnLog('Displaying as Switch');
|
|
103
103
|
|
|
104
104
|
this.Switch.Service
|
|
105
105
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -128,7 +128,7 @@ export class Others extends irdeviceBase {
|
|
|
128
128
|
On: accessory.context.On ?? false,
|
|
129
129
|
};
|
|
130
130
|
accessory.context.GarageDoor = this.GarageDoor as object;
|
|
131
|
-
this.debugWarnLog(
|
|
131
|
+
this.debugWarnLog('Displaying as Garage Door Opener');
|
|
132
132
|
|
|
133
133
|
this.GarageDoor.Service
|
|
134
134
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -158,7 +158,7 @@ export class Others extends irdeviceBase {
|
|
|
158
158
|
On: accessory.context.On ?? false,
|
|
159
159
|
};
|
|
160
160
|
accessory.context.Door = this.Door as object;
|
|
161
|
-
this.debugWarnLog(
|
|
161
|
+
this.debugWarnLog('Displaying as Door');
|
|
162
162
|
|
|
163
163
|
this.Door!.Service
|
|
164
164
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -194,7 +194,7 @@ export class Others extends irdeviceBase {
|
|
|
194
194
|
On: accessory.context.On ?? false,
|
|
195
195
|
};
|
|
196
196
|
accessory.context.Window = this.Window as object;
|
|
197
|
-
this.debugWarnLog(
|
|
197
|
+
this.debugWarnLog('Displaying as Window');
|
|
198
198
|
|
|
199
199
|
this.Window!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
200
200
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
@@ -229,7 +229,7 @@ export class Others extends irdeviceBase {
|
|
|
229
229
|
On: accessory.context.On ?? false,
|
|
230
230
|
};
|
|
231
231
|
accessory.context.WindowCovering = this.WindowCovering as object;
|
|
232
|
-
this.debugWarnLog(
|
|
232
|
+
this.debugWarnLog('Displaying as Window Covering');
|
|
233
233
|
|
|
234
234
|
this.WindowCovering.Service
|
|
235
235
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -265,7 +265,7 @@ export class Others extends irdeviceBase {
|
|
|
265
265
|
On: accessory.context.On ?? false,
|
|
266
266
|
};
|
|
267
267
|
accessory.context.LockMechanism = this.LockMechanism as object;
|
|
268
|
-
this.debugWarnLog(
|
|
268
|
+
this.debugWarnLog('Displaying as Lock');
|
|
269
269
|
|
|
270
270
|
this.LockMechanism.Service
|
|
271
271
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -294,7 +294,7 @@ export class Others extends irdeviceBase {
|
|
|
294
294
|
On: accessory.context.On ?? false,
|
|
295
295
|
};
|
|
296
296
|
accessory.context.Faucet = this.Faucet as object;
|
|
297
|
-
this.debugWarnLog(
|
|
297
|
+
this.debugWarnLog('Displaying as Faucet');
|
|
298
298
|
|
|
299
299
|
this.Faucet.Service
|
|
300
300
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -323,7 +323,7 @@ export class Others extends irdeviceBase {
|
|
|
323
323
|
On: accessory.context.On ?? false,
|
|
324
324
|
};
|
|
325
325
|
accessory.context.Fan = this.Fan as object;
|
|
326
|
-
this.debugWarnLog(
|
|
326
|
+
this.debugWarnLog('Displaying as Fan');
|
|
327
327
|
|
|
328
328
|
this.Fan.Service
|
|
329
329
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -353,7 +353,7 @@ export class Others extends irdeviceBase {
|
|
|
353
353
|
On: accessory.context.On ?? false,
|
|
354
354
|
};
|
|
355
355
|
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
|
|
356
|
-
this.debugWarnLog(
|
|
356
|
+
this.debugWarnLog('Displaying as Stateful Programmable Switch');
|
|
357
357
|
|
|
358
358
|
this.StatefulProgrammableSwitch.Service
|
|
359
359
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -382,7 +382,7 @@ export class Others extends irdeviceBase {
|
|
|
382
382
|
On: accessory.context.On ?? false,
|
|
383
383
|
};
|
|
384
384
|
accessory.context.Outlet = this.Outlet as object;
|
|
385
|
-
this.debugWarnLog(
|
|
385
|
+
this.debugWarnLog('Displaying as Outlet');
|
|
386
386
|
|
|
387
387
|
this.Outlet.Service
|
|
388
388
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -411,7 +411,7 @@ export class Others extends irdeviceBase {
|
|
|
411
411
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
412
412
|
let On: boolean;
|
|
413
413
|
if (this.otherDeviceType === 'garagedoor') {
|
|
414
|
-
this.infoLog(
|
|
414
|
+
this.infoLog(`Set TargetDoorState: ${value}`);
|
|
415
415
|
if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
|
|
416
416
|
this.GarageDoor!.On = false;
|
|
417
417
|
} else {
|
|
@@ -419,7 +419,7 @@ export class Others extends irdeviceBase {
|
|
|
419
419
|
}
|
|
420
420
|
On = this.GarageDoor!.On;
|
|
421
421
|
} else if (this.otherDeviceType === 'door') {
|
|
422
|
-
this.infoLog(
|
|
422
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
423
423
|
if (value === 0) {
|
|
424
424
|
this.Door!.On = false;
|
|
425
425
|
} else {
|
|
@@ -427,7 +427,7 @@ export class Others extends irdeviceBase {
|
|
|
427
427
|
}
|
|
428
428
|
On = this.Door!.On;
|
|
429
429
|
} else if (this.otherDeviceType === 'window') {
|
|
430
|
-
this.infoLog(
|
|
430
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
431
431
|
if (value === 0) {
|
|
432
432
|
this.Window!.On = false;
|
|
433
433
|
} else {
|
|
@@ -435,7 +435,7 @@ export class Others extends irdeviceBase {
|
|
|
435
435
|
}
|
|
436
436
|
On = this.Window!.On;
|
|
437
437
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
438
|
-
this.infoLog(
|
|
438
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
439
439
|
if (value === 0) {
|
|
440
440
|
this.WindowCovering!.On = false;
|
|
441
441
|
} else {
|
|
@@ -443,7 +443,7 @@ export class Others extends irdeviceBase {
|
|
|
443
443
|
}
|
|
444
444
|
On = this.WindowCovering!.On;
|
|
445
445
|
} else if (this.otherDeviceType === 'lock') {
|
|
446
|
-
this.infoLog(
|
|
446
|
+
this.infoLog(`Set LockTargetState: ${value}`);
|
|
447
447
|
if (value === this.hap.Characteristic.LockTargetState.SECURED) {
|
|
448
448
|
this.LockMechanism!.On = false;
|
|
449
449
|
} else {
|
|
@@ -451,7 +451,7 @@ export class Others extends irdeviceBase {
|
|
|
451
451
|
}
|
|
452
452
|
On = this.LockMechanism!.On;
|
|
453
453
|
} else if (this.otherDeviceType === 'faucet') {
|
|
454
|
-
this.infoLog(
|
|
454
|
+
this.infoLog(`Set Active: ${value}`);
|
|
455
455
|
if (value === this.hap.Characteristic.Active.INACTIVE) {
|
|
456
456
|
this.Faucet!.On = false;
|
|
457
457
|
} else {
|
|
@@ -459,7 +459,7 @@ export class Others extends irdeviceBase {
|
|
|
459
459
|
}
|
|
460
460
|
On = this.Faucet!.On;
|
|
461
461
|
} else if (this.otherDeviceType === 'stateful') {
|
|
462
|
-
this.infoLog(
|
|
462
|
+
this.infoLog(`Set ProgrammableSwitchOutputState: ${value}`);
|
|
463
463
|
if (value === 0) {
|
|
464
464
|
this.StatefulProgrammableSwitch!.On = false;
|
|
465
465
|
} else {
|
|
@@ -468,7 +468,7 @@ export class Others extends irdeviceBase {
|
|
|
468
468
|
|
|
469
469
|
On = this.StatefulProgrammableSwitch!.On;
|
|
470
470
|
} else {
|
|
471
|
-
this.infoLog(
|
|
471
|
+
this.infoLog(`Set On: ${value}`);
|
|
472
472
|
this.Outlet!.On = value;
|
|
473
473
|
On = this.Outlet!.On ? true : false;
|
|
474
474
|
}
|
|
@@ -492,7 +492,7 @@ export class Others extends irdeviceBase {
|
|
|
492
492
|
* Other - "command" "channelSub" "default" = previous channel
|
|
493
493
|
*/
|
|
494
494
|
async pushOnChanges(On: boolean): Promise<void> {
|
|
495
|
-
this.debugLog(
|
|
495
|
+
await this.debugLog(`pushOnChanges On: ${On},`
|
|
496
496
|
+ ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
|
|
497
497
|
if (this.device.customize) {
|
|
498
498
|
if (On === true && !this.disablePushOn) {
|
|
@@ -506,12 +506,12 @@ export class Others extends irdeviceBase {
|
|
|
506
506
|
await this.pushChanges(bodyChange);
|
|
507
507
|
}
|
|
508
508
|
} else {
|
|
509
|
-
this.errorLog(
|
|
509
|
+
this.errorLog('On Command not set');
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
async pushOffChanges(On: boolean): Promise<void> {
|
|
514
|
-
this.debugLog(
|
|
514
|
+
await this.debugLog(`pushOffChanges On: ${On},`
|
|
515
515
|
+ ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
|
|
516
516
|
if (this.device.customize) {
|
|
517
517
|
if (On === false && !this.disablePushOff) {
|
|
@@ -525,14 +525,14 @@ export class Others extends irdeviceBase {
|
|
|
525
525
|
await this.pushChanges(bodyChange);
|
|
526
526
|
}
|
|
527
527
|
} else {
|
|
528
|
-
this.errorLog(
|
|
528
|
+
this.errorLog('Off Command not set.');
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
533
|
-
this.debugLog(
|
|
533
|
+
await this.debugLog('pushChanges');
|
|
534
534
|
if (this.device.connectionType === 'OpenAPI') {
|
|
535
|
-
this.infoLog(
|
|
535
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
536
536
|
try {
|
|
537
537
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
538
538
|
const deviceStatus: any = await body.json();
|
|
@@ -549,165 +549,165 @@ export class Others extends irdeviceBase {
|
|
|
549
549
|
await this.pushChangeError(e);
|
|
550
550
|
}
|
|
551
551
|
} else {
|
|
552
|
-
this.warnLog(
|
|
553
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
552
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
554
553
|
}
|
|
555
554
|
}
|
|
556
555
|
|
|
557
556
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
557
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
558
558
|
if (this.otherDeviceType === 'garagedoor') {
|
|
559
559
|
if (this.GarageDoor!.On === undefined) {
|
|
560
|
-
this.debugLog(
|
|
560
|
+
await this.debugLog(`On: ${this.GarageDoor!.On}`);
|
|
561
561
|
} else {
|
|
562
562
|
if (this.GarageDoor!.On) {
|
|
563
563
|
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
|
|
564
564
|
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
|
|
565
|
-
this.debugLog(
|
|
565
|
+
await this.debugLog('updateCharacteristic'
|
|
566
566
|
+ ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor!.On})`);
|
|
567
567
|
} else {
|
|
568
568
|
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
|
|
569
569
|
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
|
|
570
|
-
this.debugLog(
|
|
570
|
+
await this.debugLog('updateCharacteristic'
|
|
571
571
|
+ ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor!.On})`);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
this.debugLog(
|
|
574
|
+
await this.debugLog(`Garage Door On: ${this.GarageDoor!.On}`);
|
|
575
575
|
} else if (this.otherDeviceType === 'door') {
|
|
576
576
|
if (this.Door!.On === undefined) {
|
|
577
|
-
this.debugLog(
|
|
577
|
+
await this.debugLog(`On: ${this.Door!.On}`);
|
|
578
578
|
} else {
|
|
579
579
|
if (this.Door!.On) {
|
|
580
580
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
581
581
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
582
582
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
583
|
-
this.debugLog(
|
|
583
|
+
await this.debugLog('updateCharacteristic'
|
|
584
584
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Door!.On})`);
|
|
585
585
|
} else {
|
|
586
586
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
587
587
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
588
588
|
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
589
|
-
this.debugLog(
|
|
589
|
+
await this.debugLog('updateCharacteristic'
|
|
590
590
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Door!.On})`);
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
this.debugLog(
|
|
593
|
+
await this.debugLog(`Door On: ${this.Door!.On}`);
|
|
594
594
|
} else if (this.otherDeviceType === 'window') {
|
|
595
595
|
if (this.Window!.On === undefined) {
|
|
596
|
-
this.debugLog(
|
|
596
|
+
await this.debugLog(`On: ${this.Window!.On}`);
|
|
597
597
|
} else {
|
|
598
598
|
if (this.Window!.On) {
|
|
599
599
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
600
600
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
601
601
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
602
|
-
this.debugLog(
|
|
602
|
+
await this.debugLog('updateCharacteristic'
|
|
603
603
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Window!.On})`);
|
|
604
604
|
} else {
|
|
605
605
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
606
606
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
607
607
|
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
608
|
-
this.debugLog(
|
|
608
|
+
await this.debugLog('updateCharacteristic'
|
|
609
609
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Window!.On})`);
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
this.debugLog(
|
|
612
|
+
await this.debugLog(`Window On: ${this.Window!.On}`);
|
|
613
613
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
614
614
|
if (this.WindowCovering!.On === undefined) {
|
|
615
|
-
this.debugLog(
|
|
615
|
+
await this.debugLog(`On: ${this.WindowCovering!.On}`);
|
|
616
616
|
} else {
|
|
617
617
|
if (this.WindowCovering!.On) {
|
|
618
618
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
619
619
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
620
620
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
621
|
-
this.debugLog(
|
|
621
|
+
await this.debugLog('updateCharacteristic'
|
|
622
622
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering!.On})`);
|
|
623
623
|
} else {
|
|
624
624
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
625
625
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
626
626
|
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
627
|
-
this.debugLog(
|
|
627
|
+
await this.debugLog('updateCharacteristic'
|
|
628
628
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering!.On})`);
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
this.debugLog(
|
|
631
|
+
await this.debugLog(`Window Covering On: ${this.WindowCovering!.On}`);
|
|
632
632
|
} else if (this.otherDeviceType === 'lock') {
|
|
633
633
|
if (this.LockMechanism?.On === undefined) {
|
|
634
|
-
this.debugLog(
|
|
634
|
+
await this.debugLog(`On: ${this.LockMechanism?.On}`);
|
|
635
635
|
} else {
|
|
636
636
|
if (this.LockMechanism.On) {
|
|
637
637
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState,
|
|
638
638
|
this.hap.Characteristic.LockTargetState.UNSECURED);
|
|
639
639
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState,
|
|
640
640
|
this.hap.Characteristic.LockCurrentState.UNSECURED);
|
|
641
|
-
this.debugLog(
|
|
641
|
+
await this.debugLog('updateCharacteristic'
|
|
642
642
|
+ ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
|
|
643
643
|
} else {
|
|
644
644
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState,
|
|
645
645
|
this.hap.Characteristic.LockTargetState.SECURED);
|
|
646
646
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState,
|
|
647
647
|
this.hap.Characteristic.LockCurrentState.SECURED);
|
|
648
|
-
this.debugLog(
|
|
648
|
+
await this.debugLog('updateCharacteristic'
|
|
649
649
|
+ ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
this.debugLog(
|
|
652
|
+
await this.debugLog(`Lock On: ${this.LockMechanism?.On}`);
|
|
653
653
|
} else if (this.otherDeviceType === 'faucet') {
|
|
654
654
|
if (this.Faucet!.On === undefined) {
|
|
655
|
-
this.debugLog(
|
|
655
|
+
await this.debugLog(`On: ${this.Faucet!.On}`);
|
|
656
656
|
} else {
|
|
657
657
|
if (this.Faucet!.On) {
|
|
658
658
|
this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
659
|
-
this.debugLog(
|
|
659
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet!.On}`);
|
|
660
660
|
} else {
|
|
661
661
|
this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
662
|
-
this.debugLog(
|
|
662
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet!.On}`);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
this.debugLog(
|
|
665
|
+
await this.debugLog(`Faucet On: ${this.Faucet!.On}`);
|
|
666
666
|
} else if (this.otherDeviceType === 'fan') {
|
|
667
667
|
if (this.Fan!.On === undefined) {
|
|
668
|
-
this.debugLog(
|
|
668
|
+
await this.debugLog(`On: ${this.Fan!.On}`);
|
|
669
669
|
} else {
|
|
670
670
|
if (this.Fan!.On) {
|
|
671
671
|
this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
|
|
672
|
-
this.debugLog(
|
|
672
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan!.On}`);
|
|
673
673
|
} else {
|
|
674
674
|
this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
|
|
675
|
-
this.debugLog(
|
|
675
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan!.On}`);
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
this.debugLog(
|
|
678
|
+
await this.debugLog(`Fan On: ${this.Fan!.On}`);
|
|
679
679
|
} else if (this.otherDeviceType === 'stateful') {
|
|
680
680
|
if (this.StatefulProgrammableSwitch!.On === undefined) {
|
|
681
|
-
this.debugLog(
|
|
681
|
+
await this.debugLog(`On: ${this.StatefulProgrammableSwitch!.On}`);
|
|
682
682
|
} else {
|
|
683
683
|
if (this.StatefulProgrammableSwitch!.On) {
|
|
684
684
|
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
|
|
685
685
|
this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
686
686
|
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
687
|
-
this.debugLog(
|
|
687
|
+
await this.debugLog('updateCharacteristic'
|
|
688
688
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch!.On})`);
|
|
689
689
|
} else {
|
|
690
690
|
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
|
|
691
691
|
this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
692
692
|
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
693
|
-
this.debugLog(
|
|
693
|
+
await this.debugLog('updateCharacteristic'
|
|
694
694
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch!.On})`);
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
|
-
this.debugLog(
|
|
697
|
+
await this.debugLog(`StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch!.On}`);
|
|
698
698
|
} else if (this.otherDeviceType === 'switch') {
|
|
699
699
|
if (this.Switch!.On === undefined) {
|
|
700
|
-
this.debugLog(
|
|
700
|
+
await this.debugLog(`On: ${this.Switch!.On}`);
|
|
701
701
|
} else {
|
|
702
702
|
this.Switch!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch!.On);
|
|
703
|
-
this.debugLog(
|
|
703
|
+
await this.debugLog(`updateCharacteristic On: ${this.Switch!.On}`);
|
|
704
704
|
}
|
|
705
705
|
} else {
|
|
706
706
|
if (this.Outlet!.On === undefined) {
|
|
707
|
-
this.debugLog(
|
|
707
|
+
await this.debugLog(`On: ${this.Outlet!.On}`);
|
|
708
708
|
} else {
|
|
709
709
|
this.Outlet!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet!.On);
|
|
710
|
-
this.debugLog(
|
|
710
|
+
await this.debugLog(`updateCharacteristic On: ${this.Outlet!.On}`);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
}
|
|
@@ -770,7 +770,7 @@ export class Others extends irdeviceBase {
|
|
|
770
770
|
// If Outlet.Service still present, then remove first
|
|
771
771
|
if (this.Outlet?.Service) {
|
|
772
772
|
this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet) as Service;
|
|
773
|
-
this.warnLog(
|
|
773
|
+
this.warnLog('Removing Leftover Outlet Service');
|
|
774
774
|
accessory.removeService(this.Outlet.Service);
|
|
775
775
|
}
|
|
776
776
|
}
|
|
@@ -779,7 +779,7 @@ export class Others extends irdeviceBase {
|
|
|
779
779
|
// If GarageDoor.Service still present, then remove first
|
|
780
780
|
if (this.GarageDoor?.Service) {
|
|
781
781
|
this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener) as Service;
|
|
782
|
-
this.warnLog(
|
|
782
|
+
this.warnLog('Removing Leftover Garage Door Service');
|
|
783
783
|
accessory.removeService(this.GarageDoor.Service);
|
|
784
784
|
}
|
|
785
785
|
}
|
|
@@ -788,7 +788,7 @@ export class Others extends irdeviceBase {
|
|
|
788
788
|
// If Door.Service still present, then remove first
|
|
789
789
|
if (this.Door?.Service) {
|
|
790
790
|
this.Door.Service = this.accessory.getService(this.hap.Service.Door) as Service;
|
|
791
|
-
this.warnLog(
|
|
791
|
+
this.warnLog('Removing Leftover Door Service');
|
|
792
792
|
accessory.removeService(this.Door.Service);
|
|
793
793
|
}
|
|
794
794
|
}
|
|
@@ -797,7 +797,7 @@ export class Others extends irdeviceBase {
|
|
|
797
797
|
// If Lock.Service still present, then remove first
|
|
798
798
|
if (this.LockMechanism?.Service) {
|
|
799
799
|
this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism) as Service;
|
|
800
|
-
this.warnLog(
|
|
800
|
+
this.warnLog('Removing Leftover Lock Service');
|
|
801
801
|
accessory.removeService(this.LockMechanism.Service);
|
|
802
802
|
}
|
|
803
803
|
}
|
|
@@ -806,7 +806,7 @@ export class Others extends irdeviceBase {
|
|
|
806
806
|
// If Faucet.Service still present, then remove first
|
|
807
807
|
if (this.Faucet?.Service) {
|
|
808
808
|
this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet) as Service;
|
|
809
|
-
this.warnLog(
|
|
809
|
+
this.warnLog('Removing Leftover Faucet Service');
|
|
810
810
|
accessory.removeService(this.Faucet.Service);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
@@ -815,7 +815,7 @@ export class Others extends irdeviceBase {
|
|
|
815
815
|
// If Fan Service still present, then remove first
|
|
816
816
|
if (this.Fan?.Service) {
|
|
817
817
|
this.Fan.Service = this.accessory.getService(this.hap.Service.Fan) as Service;
|
|
818
|
-
this.warnLog(
|
|
818
|
+
this.warnLog('Removing Leftover Fan Service');
|
|
819
819
|
accessory.removeService(this.Fan.Service);
|
|
820
820
|
}
|
|
821
821
|
}
|
|
@@ -824,7 +824,7 @@ export class Others extends irdeviceBase {
|
|
|
824
824
|
// If Window.Service still present, then remove first
|
|
825
825
|
if (this.Window?.Service) {
|
|
826
826
|
this.Window.Service = this.accessory.getService(this.hap.Service.Window) as Service;
|
|
827
|
-
this.warnLog(
|
|
827
|
+
this.warnLog('Removing Leftover Window Service');
|
|
828
828
|
accessory.removeService(this.Window.Service);
|
|
829
829
|
}
|
|
830
830
|
}
|
|
@@ -833,7 +833,7 @@ export class Others extends irdeviceBase {
|
|
|
833
833
|
// If WindowCovering.Service still present, then remove first
|
|
834
834
|
if (this.WindowCovering?.Service) {
|
|
835
835
|
this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering) as Service;
|
|
836
|
-
this.warnLog(
|
|
836
|
+
this.warnLog('Removing Leftover Window Covering Service');
|
|
837
837
|
accessory.removeService(this.WindowCovering.Service);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
@@ -842,7 +842,7 @@ export class Others extends irdeviceBase {
|
|
|
842
842
|
// If StatefulProgrammableSwitch.Service still present, then remove first
|
|
843
843
|
if (this.StatefulProgrammableSwitch?.Service) {
|
|
844
844
|
this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service;
|
|
845
|
-
this.warnLog(
|
|
845
|
+
this.warnLog('Removing Leftover Stateful Programmable Switch Service');
|
|
846
846
|
accessory.removeService(this.StatefulProgrammableSwitch.Service);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
@@ -851,7 +851,7 @@ export class Others extends irdeviceBase {
|
|
|
851
851
|
// If Switch.Service still present, then remove first
|
|
852
852
|
if (this.Switch?.Service) {
|
|
853
853
|
this.Switch.Service = this.accessory.getService(this.hap.Service.Switch) as Service;
|
|
854
|
-
this.warnLog(
|
|
854
|
+
this.warnLog('Removing Leftover Switch Service');
|
|
855
855
|
accessory.removeService(this.Switch.Service);
|
|
856
856
|
}
|
|
857
857
|
}
|
|
@@ -859,15 +859,15 @@ export class Others extends irdeviceBase {
|
|
|
859
859
|
async getOtherConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
|
|
860
860
|
if (!device.other?.deviceType && this.accessory.context.deviceType) {
|
|
861
861
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
862
|
-
this.debugWarnLog(
|
|
862
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
|
|
863
863
|
} else if (device.other?.deviceType) {
|
|
864
864
|
this.accessory.context.deviceType = device.other.deviceType;
|
|
865
|
-
this.debugWarnLog(
|
|
865
|
+
await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
|
|
866
866
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
867
|
-
this.debugWarnLog(
|
|
867
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
|
|
868
868
|
} else {
|
|
869
869
|
this.otherDeviceType = 'outlet';
|
|
870
|
-
this.warnLog(
|
|
870
|
+
this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
}
|