@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/dist/irdevice/other.js
CHANGED
|
@@ -38,7 +38,7 @@ export class Others extends irdeviceBase {
|
|
|
38
38
|
On: accessory.context.On ?? false,
|
|
39
39
|
};
|
|
40
40
|
accessory.context.Switch = this.Switch;
|
|
41
|
-
this.debugWarnLog(
|
|
41
|
+
this.debugWarnLog('Displaying as Switch');
|
|
42
42
|
this.Switch.Service
|
|
43
43
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
44
44
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -66,7 +66,7 @@ export class Others extends irdeviceBase {
|
|
|
66
66
|
On: accessory.context.On ?? false,
|
|
67
67
|
};
|
|
68
68
|
accessory.context.GarageDoor = this.GarageDoor;
|
|
69
|
-
this.debugWarnLog(
|
|
69
|
+
this.debugWarnLog('Displaying as Garage Door Opener');
|
|
70
70
|
this.GarageDoor.Service
|
|
71
71
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
72
72
|
.setCharacteristic(this.hap.Characteristic.ObstructionDetected, false)
|
|
@@ -95,7 +95,7 @@ export class Others extends irdeviceBase {
|
|
|
95
95
|
On: accessory.context.On ?? false,
|
|
96
96
|
};
|
|
97
97
|
accessory.context.Door = this.Door;
|
|
98
|
-
this.debugWarnLog(
|
|
98
|
+
this.debugWarnLog('Displaying as Door');
|
|
99
99
|
this.Door.Service
|
|
100
100
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
101
101
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
@@ -130,7 +130,7 @@ export class Others extends irdeviceBase {
|
|
|
130
130
|
On: accessory.context.On ?? false,
|
|
131
131
|
};
|
|
132
132
|
accessory.context.Window = this.Window;
|
|
133
|
-
this.debugWarnLog(
|
|
133
|
+
this.debugWarnLog('Displaying as Window');
|
|
134
134
|
this.Window.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
135
135
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
136
136
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
@@ -164,7 +164,7 @@ export class Others extends irdeviceBase {
|
|
|
164
164
|
On: accessory.context.On ?? false,
|
|
165
165
|
};
|
|
166
166
|
accessory.context.WindowCovering = this.WindowCovering;
|
|
167
|
-
this.debugWarnLog(
|
|
167
|
+
this.debugWarnLog('Displaying as Window Covering');
|
|
168
168
|
this.WindowCovering.Service
|
|
169
169
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
170
170
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
@@ -199,7 +199,7 @@ export class Others extends irdeviceBase {
|
|
|
199
199
|
On: accessory.context.On ?? false,
|
|
200
200
|
};
|
|
201
201
|
accessory.context.LockMechanism = this.LockMechanism;
|
|
202
|
-
this.debugWarnLog(
|
|
202
|
+
this.debugWarnLog('Displaying as Lock');
|
|
203
203
|
this.LockMechanism.Service
|
|
204
204
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
205
205
|
.getCharacteristic(this.hap.Characteristic.LockTargetState)
|
|
@@ -227,7 +227,7 @@ export class Others extends irdeviceBase {
|
|
|
227
227
|
On: accessory.context.On ?? false,
|
|
228
228
|
};
|
|
229
229
|
accessory.context.Faucet = this.Faucet;
|
|
230
|
-
this.debugWarnLog(
|
|
230
|
+
this.debugWarnLog('Displaying as Faucet');
|
|
231
231
|
this.Faucet.Service
|
|
232
232
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
233
233
|
.getCharacteristic(this.hap.Characteristic.Active)
|
|
@@ -255,7 +255,7 @@ export class Others extends irdeviceBase {
|
|
|
255
255
|
On: accessory.context.On ?? false,
|
|
256
256
|
};
|
|
257
257
|
accessory.context.Fan = this.Fan;
|
|
258
|
-
this.debugWarnLog(
|
|
258
|
+
this.debugWarnLog('Displaying as Fan');
|
|
259
259
|
this.Fan.Service
|
|
260
260
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
261
261
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -284,7 +284,7 @@ export class Others extends irdeviceBase {
|
|
|
284
284
|
On: accessory.context.On ?? false,
|
|
285
285
|
};
|
|
286
286
|
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
|
|
287
|
-
this.debugWarnLog(
|
|
287
|
+
this.debugWarnLog('Displaying as Stateful Programmable Switch');
|
|
288
288
|
this.StatefulProgrammableSwitch.Service
|
|
289
289
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
290
290
|
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState)
|
|
@@ -312,7 +312,7 @@ export class Others extends irdeviceBase {
|
|
|
312
312
|
On: accessory.context.On ?? false,
|
|
313
313
|
};
|
|
314
314
|
accessory.context.Outlet = this.Outlet;
|
|
315
|
-
this.debugWarnLog(
|
|
315
|
+
this.debugWarnLog('Displaying as Outlet');
|
|
316
316
|
this.Outlet.Service
|
|
317
317
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
318
318
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -338,7 +338,7 @@ export class Others extends irdeviceBase {
|
|
|
338
338
|
async OnSet(value) {
|
|
339
339
|
let On;
|
|
340
340
|
if (this.otherDeviceType === 'garagedoor') {
|
|
341
|
-
this.infoLog(
|
|
341
|
+
this.infoLog(`Set TargetDoorState: ${value}`);
|
|
342
342
|
if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
|
|
343
343
|
this.GarageDoor.On = false;
|
|
344
344
|
}
|
|
@@ -348,7 +348,7 @@ export class Others extends irdeviceBase {
|
|
|
348
348
|
On = this.GarageDoor.On;
|
|
349
349
|
}
|
|
350
350
|
else if (this.otherDeviceType === 'door') {
|
|
351
|
-
this.infoLog(
|
|
351
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
352
352
|
if (value === 0) {
|
|
353
353
|
this.Door.On = false;
|
|
354
354
|
}
|
|
@@ -358,7 +358,7 @@ export class Others extends irdeviceBase {
|
|
|
358
358
|
On = this.Door.On;
|
|
359
359
|
}
|
|
360
360
|
else if (this.otherDeviceType === 'window') {
|
|
361
|
-
this.infoLog(
|
|
361
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
362
362
|
if (value === 0) {
|
|
363
363
|
this.Window.On = false;
|
|
364
364
|
}
|
|
@@ -368,7 +368,7 @@ export class Others extends irdeviceBase {
|
|
|
368
368
|
On = this.Window.On;
|
|
369
369
|
}
|
|
370
370
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
371
|
-
this.infoLog(
|
|
371
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
372
372
|
if (value === 0) {
|
|
373
373
|
this.WindowCovering.On = false;
|
|
374
374
|
}
|
|
@@ -378,7 +378,7 @@ export class Others extends irdeviceBase {
|
|
|
378
378
|
On = this.WindowCovering.On;
|
|
379
379
|
}
|
|
380
380
|
else if (this.otherDeviceType === 'lock') {
|
|
381
|
-
this.infoLog(
|
|
381
|
+
this.infoLog(`Set LockTargetState: ${value}`);
|
|
382
382
|
if (value === this.hap.Characteristic.LockTargetState.SECURED) {
|
|
383
383
|
this.LockMechanism.On = false;
|
|
384
384
|
}
|
|
@@ -388,7 +388,7 @@ export class Others extends irdeviceBase {
|
|
|
388
388
|
On = this.LockMechanism.On;
|
|
389
389
|
}
|
|
390
390
|
else if (this.otherDeviceType === 'faucet') {
|
|
391
|
-
this.infoLog(
|
|
391
|
+
this.infoLog(`Set Active: ${value}`);
|
|
392
392
|
if (value === this.hap.Characteristic.Active.INACTIVE) {
|
|
393
393
|
this.Faucet.On = false;
|
|
394
394
|
}
|
|
@@ -398,7 +398,7 @@ export class Others extends irdeviceBase {
|
|
|
398
398
|
On = this.Faucet.On;
|
|
399
399
|
}
|
|
400
400
|
else if (this.otherDeviceType === 'stateful') {
|
|
401
|
-
this.infoLog(
|
|
401
|
+
this.infoLog(`Set ProgrammableSwitchOutputState: ${value}`);
|
|
402
402
|
if (value === 0) {
|
|
403
403
|
this.StatefulProgrammableSwitch.On = false;
|
|
404
404
|
}
|
|
@@ -408,7 +408,7 @@ export class Others extends irdeviceBase {
|
|
|
408
408
|
On = this.StatefulProgrammableSwitch.On;
|
|
409
409
|
}
|
|
410
410
|
else {
|
|
411
|
-
this.infoLog(
|
|
411
|
+
this.infoLog(`Set On: ${value}`);
|
|
412
412
|
this.Outlet.On = value;
|
|
413
413
|
On = this.Outlet.On ? true : false;
|
|
414
414
|
}
|
|
@@ -431,7 +431,7 @@ export class Others extends irdeviceBase {
|
|
|
431
431
|
* Other - "command" "channelSub" "default" = previous channel
|
|
432
432
|
*/
|
|
433
433
|
async pushOnChanges(On) {
|
|
434
|
-
this.debugLog(
|
|
434
|
+
await this.debugLog(`pushOnChanges On: ${On},`
|
|
435
435
|
+ ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
|
|
436
436
|
if (this.device.customize) {
|
|
437
437
|
if (On === true && !this.disablePushOn) {
|
|
@@ -446,11 +446,11 @@ export class Others extends irdeviceBase {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
else {
|
|
449
|
-
this.errorLog(
|
|
449
|
+
this.errorLog('On Command not set');
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
async pushOffChanges(On) {
|
|
453
|
-
this.debugLog(
|
|
453
|
+
await this.debugLog(`pushOffChanges On: ${On},`
|
|
454
454
|
+ ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
|
|
455
455
|
if (this.device.customize) {
|
|
456
456
|
if (On === false && !this.disablePushOff) {
|
|
@@ -465,13 +465,13 @@ export class Others extends irdeviceBase {
|
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
else {
|
|
468
|
-
this.errorLog(
|
|
468
|
+
this.errorLog('Off Command not set.');
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
async pushChanges(bodyChange) {
|
|
472
|
-
this.debugLog(
|
|
472
|
+
await this.debugLog('pushChanges');
|
|
473
473
|
if (this.device.connectionType === 'OpenAPI') {
|
|
474
|
-
this.infoLog(
|
|
474
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
475
475
|
try {
|
|
476
476
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
477
477
|
const deviceStatus = await body.json();
|
|
@@ -491,185 +491,185 @@ export class Others extends irdeviceBase {
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
else {
|
|
494
|
-
this.warnLog(
|
|
495
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
494
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
496
495
|
}
|
|
497
496
|
}
|
|
498
497
|
async updateHomeKitCharacteristics() {
|
|
498
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
499
499
|
if (this.otherDeviceType === 'garagedoor') {
|
|
500
500
|
if (this.GarageDoor.On === undefined) {
|
|
501
|
-
this.debugLog(
|
|
501
|
+
await this.debugLog(`On: ${this.GarageDoor.On}`);
|
|
502
502
|
}
|
|
503
503
|
else {
|
|
504
504
|
if (this.GarageDoor.On) {
|
|
505
505
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
|
|
506
506
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
|
|
507
|
-
this.debugLog(
|
|
507
|
+
await this.debugLog('updateCharacteristic'
|
|
508
508
|
+ ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor.On})`);
|
|
509
509
|
}
|
|
510
510
|
else {
|
|
511
511
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
|
|
512
512
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
|
|
513
|
-
this.debugLog(
|
|
513
|
+
await this.debugLog('updateCharacteristic'
|
|
514
514
|
+ ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor.On})`);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
this.debugLog(
|
|
517
|
+
await this.debugLog(`Garage Door On: ${this.GarageDoor.On}`);
|
|
518
518
|
}
|
|
519
519
|
else if (this.otherDeviceType === 'door') {
|
|
520
520
|
if (this.Door.On === undefined) {
|
|
521
|
-
this.debugLog(
|
|
521
|
+
await this.debugLog(`On: ${this.Door.On}`);
|
|
522
522
|
}
|
|
523
523
|
else {
|
|
524
524
|
if (this.Door.On) {
|
|
525
525
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
526
526
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
527
527
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
528
|
-
this.debugLog(
|
|
528
|
+
await this.debugLog('updateCharacteristic'
|
|
529
529
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Door.On})`);
|
|
530
530
|
}
|
|
531
531
|
else {
|
|
532
532
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
533
533
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
534
534
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
535
|
-
this.debugLog(
|
|
535
|
+
await this.debugLog('updateCharacteristic'
|
|
536
536
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Door.On})`);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
this.debugLog(
|
|
539
|
+
await this.debugLog(`Door On: ${this.Door.On}`);
|
|
540
540
|
}
|
|
541
541
|
else if (this.otherDeviceType === 'window') {
|
|
542
542
|
if (this.Window.On === undefined) {
|
|
543
|
-
this.debugLog(
|
|
543
|
+
await this.debugLog(`On: ${this.Window.On}`);
|
|
544
544
|
}
|
|
545
545
|
else {
|
|
546
546
|
if (this.Window.On) {
|
|
547
547
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
548
548
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
549
549
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
550
|
-
this.debugLog(
|
|
550
|
+
await this.debugLog('updateCharacteristic'
|
|
551
551
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Window.On})`);
|
|
552
552
|
}
|
|
553
553
|
else {
|
|
554
554
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
555
555
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
556
556
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
557
|
-
this.debugLog(
|
|
557
|
+
await this.debugLog('updateCharacteristic'
|
|
558
558
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Window.On})`);
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
this.debugLog(
|
|
561
|
+
await this.debugLog(`Window On: ${this.Window.On}`);
|
|
562
562
|
}
|
|
563
563
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
564
564
|
if (this.WindowCovering.On === undefined) {
|
|
565
|
-
this.debugLog(
|
|
565
|
+
await this.debugLog(`On: ${this.WindowCovering.On}`);
|
|
566
566
|
}
|
|
567
567
|
else {
|
|
568
568
|
if (this.WindowCovering.On) {
|
|
569
569
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
570
570
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
571
571
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
572
|
-
this.debugLog(
|
|
572
|
+
await this.debugLog('updateCharacteristic'
|
|
573
573
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering.On})`);
|
|
574
574
|
}
|
|
575
575
|
else {
|
|
576
576
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
577
577
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
578
578
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
579
|
-
this.debugLog(
|
|
579
|
+
await this.debugLog('updateCharacteristic'
|
|
580
580
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering.On})`);
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
this.debugLog(
|
|
583
|
+
await this.debugLog(`Window Covering On: ${this.WindowCovering.On}`);
|
|
584
584
|
}
|
|
585
585
|
else if (this.otherDeviceType === 'lock') {
|
|
586
586
|
if (this.LockMechanism?.On === undefined) {
|
|
587
|
-
this.debugLog(
|
|
587
|
+
await this.debugLog(`On: ${this.LockMechanism?.On}`);
|
|
588
588
|
}
|
|
589
589
|
else {
|
|
590
590
|
if (this.LockMechanism.On) {
|
|
591
591
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED);
|
|
592
592
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED);
|
|
593
|
-
this.debugLog(
|
|
593
|
+
await this.debugLog('updateCharacteristic'
|
|
594
594
|
+ ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
|
|
595
595
|
}
|
|
596
596
|
else {
|
|
597
597
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED);
|
|
598
598
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED);
|
|
599
|
-
this.debugLog(
|
|
599
|
+
await this.debugLog('updateCharacteristic'
|
|
600
600
|
+ ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
this.debugLog(
|
|
603
|
+
await this.debugLog(`Lock On: ${this.LockMechanism?.On}`);
|
|
604
604
|
}
|
|
605
605
|
else if (this.otherDeviceType === 'faucet') {
|
|
606
606
|
if (this.Faucet.On === undefined) {
|
|
607
|
-
this.debugLog(
|
|
607
|
+
await this.debugLog(`On: ${this.Faucet.On}`);
|
|
608
608
|
}
|
|
609
609
|
else {
|
|
610
610
|
if (this.Faucet.On) {
|
|
611
611
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
612
|
-
this.debugLog(
|
|
612
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
|
|
613
613
|
}
|
|
614
614
|
else {
|
|
615
615
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
616
|
-
this.debugLog(
|
|
616
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
this.debugLog(
|
|
619
|
+
await this.debugLog(`Faucet On: ${this.Faucet.On}`);
|
|
620
620
|
}
|
|
621
621
|
else if (this.otherDeviceType === 'fan') {
|
|
622
622
|
if (this.Fan.On === undefined) {
|
|
623
|
-
this.debugLog(
|
|
623
|
+
await this.debugLog(`On: ${this.Fan.On}`);
|
|
624
624
|
}
|
|
625
625
|
else {
|
|
626
626
|
if (this.Fan.On) {
|
|
627
627
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
|
|
628
|
-
this.debugLog(
|
|
628
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
|
|
629
629
|
}
|
|
630
630
|
else {
|
|
631
631
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
|
|
632
|
-
this.debugLog(
|
|
632
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
this.debugLog(
|
|
635
|
+
await this.debugLog(`Fan On: ${this.Fan.On}`);
|
|
636
636
|
}
|
|
637
637
|
else if (this.otherDeviceType === 'stateful') {
|
|
638
638
|
if (this.StatefulProgrammableSwitch.On === undefined) {
|
|
639
|
-
this.debugLog(
|
|
639
|
+
await this.debugLog(`On: ${this.StatefulProgrammableSwitch.On}`);
|
|
640
640
|
}
|
|
641
641
|
else {
|
|
642
642
|
if (this.StatefulProgrammableSwitch.On) {
|
|
643
643
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
644
644
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
645
|
-
this.debugLog(
|
|
645
|
+
await this.debugLog('updateCharacteristic'
|
|
646
646
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch.On})`);
|
|
647
647
|
}
|
|
648
648
|
else {
|
|
649
649
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
650
650
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
651
|
-
this.debugLog(
|
|
651
|
+
await this.debugLog('updateCharacteristic'
|
|
652
652
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch.On})`);
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
-
this.debugLog(
|
|
655
|
+
await this.debugLog(`StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch.On}`);
|
|
656
656
|
}
|
|
657
657
|
else if (this.otherDeviceType === 'switch') {
|
|
658
658
|
if (this.Switch.On === undefined) {
|
|
659
|
-
this.debugLog(
|
|
659
|
+
await this.debugLog(`On: ${this.Switch.On}`);
|
|
660
660
|
}
|
|
661
661
|
else {
|
|
662
662
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
663
|
-
this.debugLog(
|
|
663
|
+
await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
else {
|
|
667
667
|
if (this.Outlet.On === undefined) {
|
|
668
|
-
this.debugLog(
|
|
668
|
+
await this.debugLog(`On: ${this.Outlet.On}`);
|
|
669
669
|
}
|
|
670
670
|
else {
|
|
671
671
|
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet.On);
|
|
672
|
-
this.debugLog(
|
|
672
|
+
await this.debugLog(`updateCharacteristic On: ${this.Outlet.On}`);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
}
|
|
@@ -739,7 +739,7 @@ export class Others extends irdeviceBase {
|
|
|
739
739
|
// If Outlet.Service still present, then remove first
|
|
740
740
|
if (this.Outlet?.Service) {
|
|
741
741
|
this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet);
|
|
742
|
-
this.warnLog(
|
|
742
|
+
this.warnLog('Removing Leftover Outlet Service');
|
|
743
743
|
accessory.removeService(this.Outlet.Service);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
@@ -747,7 +747,7 @@ export class Others extends irdeviceBase {
|
|
|
747
747
|
// If GarageDoor.Service still present, then remove first
|
|
748
748
|
if (this.GarageDoor?.Service) {
|
|
749
749
|
this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener);
|
|
750
|
-
this.warnLog(
|
|
750
|
+
this.warnLog('Removing Leftover Garage Door Service');
|
|
751
751
|
accessory.removeService(this.GarageDoor.Service);
|
|
752
752
|
}
|
|
753
753
|
}
|
|
@@ -755,7 +755,7 @@ export class Others extends irdeviceBase {
|
|
|
755
755
|
// If Door.Service still present, then remove first
|
|
756
756
|
if (this.Door?.Service) {
|
|
757
757
|
this.Door.Service = this.accessory.getService(this.hap.Service.Door);
|
|
758
|
-
this.warnLog(
|
|
758
|
+
this.warnLog('Removing Leftover Door Service');
|
|
759
759
|
accessory.removeService(this.Door.Service);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
@@ -763,7 +763,7 @@ export class Others extends irdeviceBase {
|
|
|
763
763
|
// If Lock.Service still present, then remove first
|
|
764
764
|
if (this.LockMechanism?.Service) {
|
|
765
765
|
this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism);
|
|
766
|
-
this.warnLog(
|
|
766
|
+
this.warnLog('Removing Leftover Lock Service');
|
|
767
767
|
accessory.removeService(this.LockMechanism.Service);
|
|
768
768
|
}
|
|
769
769
|
}
|
|
@@ -771,7 +771,7 @@ export class Others extends irdeviceBase {
|
|
|
771
771
|
// If Faucet.Service still present, then remove first
|
|
772
772
|
if (this.Faucet?.Service) {
|
|
773
773
|
this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet);
|
|
774
|
-
this.warnLog(
|
|
774
|
+
this.warnLog('Removing Leftover Faucet Service');
|
|
775
775
|
accessory.removeService(this.Faucet.Service);
|
|
776
776
|
}
|
|
777
777
|
}
|
|
@@ -779,7 +779,7 @@ export class Others extends irdeviceBase {
|
|
|
779
779
|
// If Fan Service still present, then remove first
|
|
780
780
|
if (this.Fan?.Service) {
|
|
781
781
|
this.Fan.Service = this.accessory.getService(this.hap.Service.Fan);
|
|
782
|
-
this.warnLog(
|
|
782
|
+
this.warnLog('Removing Leftover Fan Service');
|
|
783
783
|
accessory.removeService(this.Fan.Service);
|
|
784
784
|
}
|
|
785
785
|
}
|
|
@@ -787,7 +787,7 @@ export class Others extends irdeviceBase {
|
|
|
787
787
|
// If Window.Service still present, then remove first
|
|
788
788
|
if (this.Window?.Service) {
|
|
789
789
|
this.Window.Service = this.accessory.getService(this.hap.Service.Window);
|
|
790
|
-
this.warnLog(
|
|
790
|
+
this.warnLog('Removing Leftover Window Service');
|
|
791
791
|
accessory.removeService(this.Window.Service);
|
|
792
792
|
}
|
|
793
793
|
}
|
|
@@ -795,7 +795,7 @@ export class Others extends irdeviceBase {
|
|
|
795
795
|
// If WindowCovering.Service still present, then remove first
|
|
796
796
|
if (this.WindowCovering?.Service) {
|
|
797
797
|
this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering);
|
|
798
|
-
this.warnLog(
|
|
798
|
+
this.warnLog('Removing Leftover Window Covering Service');
|
|
799
799
|
accessory.removeService(this.WindowCovering.Service);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
@@ -803,7 +803,7 @@ export class Others extends irdeviceBase {
|
|
|
803
803
|
// If StatefulProgrammableSwitch.Service still present, then remove first
|
|
804
804
|
if (this.StatefulProgrammableSwitch?.Service) {
|
|
805
805
|
this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch);
|
|
806
|
-
this.warnLog(
|
|
806
|
+
this.warnLog('Removing Leftover Stateful Programmable Switch Service');
|
|
807
807
|
accessory.removeService(this.StatefulProgrammableSwitch.Service);
|
|
808
808
|
}
|
|
809
809
|
}
|
|
@@ -811,24 +811,24 @@ export class Others extends irdeviceBase {
|
|
|
811
811
|
// If Switch.Service still present, then remove first
|
|
812
812
|
if (this.Switch?.Service) {
|
|
813
813
|
this.Switch.Service = this.accessory.getService(this.hap.Service.Switch);
|
|
814
|
-
this.warnLog(
|
|
814
|
+
this.warnLog('Removing Leftover Switch Service');
|
|
815
815
|
accessory.removeService(this.Switch.Service);
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
async getOtherConfigSettings(device) {
|
|
819
819
|
if (!device.other?.deviceType && this.accessory.context.deviceType) {
|
|
820
820
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
821
|
-
this.debugWarnLog(
|
|
821
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
|
|
822
822
|
}
|
|
823
823
|
else if (device.other?.deviceType) {
|
|
824
824
|
this.accessory.context.deviceType = device.other.deviceType;
|
|
825
|
-
this.debugWarnLog(
|
|
825
|
+
await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
|
|
826
826
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
827
|
-
this.debugWarnLog(
|
|
827
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
|
|
828
828
|
}
|
|
829
829
|
else {
|
|
830
830
|
this.otherDeviceType = 'outlet';
|
|
831
|
-
this.warnLog(
|
|
831
|
+
this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
}
|