@switchbot/homebridge-switchbot 4.1.1-beta.0 → 4.1.1-beta.10
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 +14 -0
- package/config.schema.json +2 -2
- package/dist/device/blindtilt.js +104 -104
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +86 -86
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +98 -98
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +140 -140
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +47 -47
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +95 -93
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +13 -13
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +46 -46
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +96 -96
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +46 -46
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +85 -87
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +44 -44
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +119 -119
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +75 -75
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +44 -44
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +42 -42
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.js +42 -42
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.js +44 -44
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +60 -60
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +74 -74
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +54 -56
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.js +31 -31
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js +10 -10
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.js +11 -11
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.js +11 -11
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.js +9 -9
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +93 -93
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +33 -33
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.js +228 -228
- package/dist/platform.js.map +1 -1
- package/docs/functions/default.html +1 -1
- package/package.json +9 -9
- package/src/device/blindtilt.ts +104 -104
- package/src/device/bot.ts +86 -86
- package/src/device/ceilinglight.ts +98 -98
- package/src/device/colorbulb.ts +140 -140
- package/src/device/contact.ts +47 -47
- package/src/device/curtain.ts +95 -93
- package/src/device/device.ts +46 -46
- package/src/device/fan.ts +96 -96
- package/src/device/hub.ts +46 -46
- package/src/device/humidifier.ts +85 -87
- package/src/device/iosensor.ts +44 -44
- package/src/device/lightstrip.ts +119 -119
- package/src/device/lock.ts +75 -75
- package/src/device/meter.ts +44 -44
- package/src/device/meterplus.ts +42 -42
- package/src/device/meterpro.ts +42 -42
- package/src/device/motion.ts +44 -44
- package/src/device/plug.ts +62 -62
- package/src/device/robotvacuumcleaner.ts +74 -74
- package/src/device/waterdetector.ts +54 -55
- package/src/irdevice/airconditioner.ts +31 -31
- package/src/irdevice/airpurifier.ts +10 -10
- package/src/irdevice/camera.ts +9 -9
- package/src/irdevice/fan.ts +11 -11
- package/src/irdevice/irdevice.ts +11 -11
- package/src/irdevice/light.ts +9 -9
- package/src/irdevice/other.ts +93 -93
- package/src/irdevice/tv.ts +33 -33
- package/src/irdevice/vacuumcleaner.ts +9 -9
- package/src/irdevice/waterheater.ts +9 -9
- package/src/platform.ts +228 -228
package/src/irdevice/other.ts
CHANGED
|
@@ -83,7 +83,7 @@ export class Others extends irdeviceBase {
|
|
|
83
83
|
this.getOtherConfigSettings(accessory, device)
|
|
84
84
|
|
|
85
85
|
// deviceType
|
|
86
|
-
if (this.otherDeviceType === '
|
|
86
|
+
if (this.otherDeviceType === 'Switch') {
|
|
87
87
|
// Set category
|
|
88
88
|
accessory.category = this.hap.Categories.SWITCH
|
|
89
89
|
// Initialize Switch Service
|
|
@@ -106,7 +106,7 @@ export class Others extends irdeviceBase {
|
|
|
106
106
|
this.removeGarageDoorService(accessory)
|
|
107
107
|
this.removeWindowCoveringService(accessory)
|
|
108
108
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
109
|
-
} else if (this.otherDeviceType === '
|
|
109
|
+
} else if (this.otherDeviceType === 'GarageDoor') {
|
|
110
110
|
// Set category
|
|
111
111
|
accessory.category = this.hap.Categories.GARAGE_DOOR_OPENER
|
|
112
112
|
// Initialize GarageDoor Service
|
|
@@ -134,7 +134,7 @@ export class Others extends irdeviceBase {
|
|
|
134
134
|
this.removeWindowService(accessory)
|
|
135
135
|
this.removeWindowCoveringService(accessory)
|
|
136
136
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
137
|
-
} else if (this.otherDeviceType === '
|
|
137
|
+
} else if (this.otherDeviceType === 'Door') {
|
|
138
138
|
// Set category
|
|
139
139
|
accessory.category = this.hap.Categories.DOOR
|
|
140
140
|
// Initialize Door Service
|
|
@@ -162,7 +162,7 @@ export class Others extends irdeviceBase {
|
|
|
162
162
|
this.removeGarageDoorService(accessory)
|
|
163
163
|
this.removeWindowCoveringService(accessory)
|
|
164
164
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
165
|
-
} else if (this.otherDeviceType === '
|
|
165
|
+
} else if (this.otherDeviceType === 'Window') {
|
|
166
166
|
// Set category
|
|
167
167
|
accessory.category = this.hap.Categories.WINDOW
|
|
168
168
|
// Initialize Window Service
|
|
@@ -190,7 +190,7 @@ export class Others extends irdeviceBase {
|
|
|
190
190
|
this.removeGarageDoorService(accessory)
|
|
191
191
|
this.removeWindowCoveringService(accessory)
|
|
192
192
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
193
|
-
} else if (this.otherDeviceType === '
|
|
193
|
+
} else if (this.otherDeviceType === 'WindowCovering') {
|
|
194
194
|
// Set category
|
|
195
195
|
accessory.category = this.hap.Categories.WINDOW_COVERING
|
|
196
196
|
// Initialize WindowCovering Service
|
|
@@ -218,7 +218,7 @@ export class Others extends irdeviceBase {
|
|
|
218
218
|
this.removeWindowService(accessory)
|
|
219
219
|
this.removeGarageDoorService(accessory)
|
|
220
220
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
221
|
-
} else if (this.otherDeviceType === '
|
|
221
|
+
} else if (this.otherDeviceType === 'Lock') {
|
|
222
222
|
// Set category
|
|
223
223
|
accessory.category = this.hap.Categories.DOOR_LOCK
|
|
224
224
|
// Initialize Lock Service
|
|
@@ -241,7 +241,7 @@ export class Others extends irdeviceBase {
|
|
|
241
241
|
this.removeGarageDoorService(accessory)
|
|
242
242
|
this.removeWindowCoveringService(accessory)
|
|
243
243
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
244
|
-
} else if (this.otherDeviceType === '
|
|
244
|
+
} else if (this.otherDeviceType === 'Faucet') {
|
|
245
245
|
// Set category
|
|
246
246
|
accessory.category = this.hap.Categories.FAUCET
|
|
247
247
|
// Initialize Faucet Service
|
|
@@ -264,7 +264,7 @@ export class Others extends irdeviceBase {
|
|
|
264
264
|
this.removeGarageDoorService(accessory)
|
|
265
265
|
this.removeWindowCoveringService(accessory)
|
|
266
266
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
267
|
-
} else if (this.otherDeviceType === '
|
|
267
|
+
} else if (this.otherDeviceType === 'Fan') {
|
|
268
268
|
// Set category
|
|
269
269
|
accessory.category = this.hap.Categories.FAN
|
|
270
270
|
// Initialize Fan Service
|
|
@@ -287,7 +287,7 @@ export class Others extends irdeviceBase {
|
|
|
287
287
|
this.removeGarageDoorService(accessory)
|
|
288
288
|
this.removeWindowCoveringService(accessory)
|
|
289
289
|
this.removeStatefulProgrammableSwitchService(accessory)
|
|
290
|
-
} else if (this.otherDeviceType === '
|
|
290
|
+
} else if (this.otherDeviceType === 'Stateful') {
|
|
291
291
|
// Set category
|
|
292
292
|
accessory.category = this.hap.Categories.PROGRAMMABLE_SWITCH
|
|
293
293
|
// Initialize StatefulProgrammableSwitch Service
|
|
@@ -310,7 +310,7 @@ export class Others extends irdeviceBase {
|
|
|
310
310
|
this.removeWindowService(accessory)
|
|
311
311
|
this.removeGarageDoorService(accessory)
|
|
312
312
|
this.removeWindowCoveringService(accessory)
|
|
313
|
-
} else if (this.otherDeviceType === '
|
|
313
|
+
} else if (this.otherDeviceType === 'Outlet') {
|
|
314
314
|
// Set category
|
|
315
315
|
accessory.category = this.hap.Categories.OUTLET
|
|
316
316
|
// Initialize Switch property
|
|
@@ -342,49 +342,49 @@ export class Others extends irdeviceBase {
|
|
|
342
342
|
* Handle requests to set the "On" characteristic
|
|
343
343
|
*/
|
|
344
344
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
345
|
-
if (this.otherDeviceType === '
|
|
345
|
+
if (this.otherDeviceType === 'Switch') {
|
|
346
346
|
if (this.Switch) {
|
|
347
|
-
|
|
347
|
+
this.debugLog(`Set On: ${value}`)
|
|
348
348
|
this.On = value !== false
|
|
349
349
|
}
|
|
350
|
-
} else if (this.otherDeviceType === '
|
|
350
|
+
} else if (this.otherDeviceType === 'GarageDoor') {
|
|
351
351
|
if (this.GarageDoor) {
|
|
352
|
-
|
|
352
|
+
this.debugLog(`Set TargetDoorState: ${value}`)
|
|
353
353
|
this.On = value !== this.hap.Characteristic.TargetDoorState.CLOSED
|
|
354
354
|
}
|
|
355
|
-
} else if (this.otherDeviceType === '
|
|
355
|
+
} else if (this.otherDeviceType === 'Door') {
|
|
356
356
|
if (this.Door) {
|
|
357
|
-
|
|
357
|
+
this.debugLog(`Set TargetPosition: ${value}`)
|
|
358
358
|
this.On = value !== 0
|
|
359
359
|
}
|
|
360
|
-
} else if (this.otherDeviceType === '
|
|
360
|
+
} else if (this.otherDeviceType === 'Window') {
|
|
361
361
|
if (this.Window) {
|
|
362
|
-
|
|
362
|
+
this.debugLog(`Set TargetPosition: ${value}`)
|
|
363
363
|
this.On = value !== 0
|
|
364
364
|
}
|
|
365
|
-
} else if (this.otherDeviceType === '
|
|
365
|
+
} else if (this.otherDeviceType === 'WindowCovering') {
|
|
366
366
|
if (this.WindowCovering) {
|
|
367
|
-
|
|
367
|
+
this.debugLog(`Set TargetPosition: ${value}`)
|
|
368
368
|
this.On = value !== 0
|
|
369
369
|
}
|
|
370
|
-
} else if (this.otherDeviceType === '
|
|
370
|
+
} else if (this.otherDeviceType === 'Lock') {
|
|
371
371
|
if (this.LockMechanism) {
|
|
372
|
-
|
|
372
|
+
this.debugLog(`Set LockTargetState: ${value}`)
|
|
373
373
|
this.On = value !== this.hap.Characteristic.LockTargetState.SECURED
|
|
374
374
|
}
|
|
375
|
-
} else if (this.otherDeviceType === '
|
|
375
|
+
} else if (this.otherDeviceType === 'Faucet') {
|
|
376
376
|
if (this.Faucet) {
|
|
377
|
-
|
|
377
|
+
this.debugLog(`Set Active: ${value}`)
|
|
378
378
|
this.On = value !== this.hap.Characteristic.Active.INACTIVE
|
|
379
379
|
}
|
|
380
|
-
} else if (this.otherDeviceType === '
|
|
380
|
+
} else if (this.otherDeviceType === 'Stateful') {
|
|
381
381
|
if (this.StatefulProgrammableSwitch) {
|
|
382
|
-
|
|
382
|
+
this.debugLog(`Set ProgrammableSwitchOutputState: ${value}`)
|
|
383
383
|
this.On = value !== 0
|
|
384
384
|
}
|
|
385
385
|
} else {
|
|
386
386
|
if (this.Outlet) {
|
|
387
|
-
|
|
387
|
+
this.debugLog(`Set On: ${value}`)
|
|
388
388
|
this.On = value !== false
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -407,7 +407,7 @@ export class Others extends irdeviceBase {
|
|
|
407
407
|
* Other - "command" "channelSub" "default" = previous channel
|
|
408
408
|
*/
|
|
409
409
|
async pushOnChanges(On: boolean): Promise<void> {
|
|
410
|
-
|
|
410
|
+
this.debugLog(`pushOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`)
|
|
411
411
|
if (this.device.customize) {
|
|
412
412
|
if (On === true && !this.disablePushOn) {
|
|
413
413
|
const commandType: string = await this.commandType()
|
|
@@ -425,7 +425,7 @@ export class Others extends irdeviceBase {
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
async pushOffChanges(On: boolean): Promise<void> {
|
|
428
|
-
|
|
428
|
+
this.debugLog(`pushOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`)
|
|
429
429
|
if (this.device.customize) {
|
|
430
430
|
if (On === false && !this.disablePushOff) {
|
|
431
431
|
const commandType: string = await this.commandType()
|
|
@@ -443,12 +443,12 @@ export class Others extends irdeviceBase {
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
446
|
-
|
|
446
|
+
this.debugLog('pushChanges')
|
|
447
447
|
if (this.device.connectionType === 'OpenAPI') {
|
|
448
|
-
|
|
448
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
449
449
|
try {
|
|
450
|
-
const
|
|
451
|
-
const deviceStatus: any =
|
|
450
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
451
|
+
const deviceStatus: any = response.body
|
|
452
452
|
await this.pushStatusCodes(deviceStatus)
|
|
453
453
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
454
454
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -461,198 +461,198 @@ export class Others extends irdeviceBase {
|
|
|
461
461
|
await this.pushChangeError(e)
|
|
462
462
|
}
|
|
463
463
|
} else {
|
|
464
|
-
|
|
464
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
469
|
-
|
|
469
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
470
470
|
// State
|
|
471
|
-
if (this.otherDeviceType === '
|
|
471
|
+
if (this.otherDeviceType === 'Switch' && this.Switch) {
|
|
472
472
|
if (this.On === undefined) {
|
|
473
|
-
|
|
473
|
+
this.debugLog(`On: ${this.On}`)
|
|
474
474
|
} else {
|
|
475
475
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.On)
|
|
476
|
-
|
|
476
|
+
this.debugLog(`updateCharacteristic On: ${this.On}`)
|
|
477
477
|
}
|
|
478
|
-
} else if (this.otherDeviceType === '
|
|
478
|
+
} else if (this.otherDeviceType === 'GarageDoor' && this.GarageDoor) {
|
|
479
479
|
if (this.On === undefined) {
|
|
480
|
-
|
|
480
|
+
this.debugLog(`On: ${this.On}`)
|
|
481
481
|
} else {
|
|
482
482
|
if (this.On) {
|
|
483
483
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN)
|
|
484
484
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN)
|
|
485
|
-
|
|
485
|
+
this.debugLog(`updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open (${this.On})`)
|
|
486
486
|
} else {
|
|
487
487
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED)
|
|
488
488
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED)
|
|
489
|
-
|
|
489
|
+
this.debugLog(`updateCharacteristicc TargetDoorState: Closed, CurrentDoorState: Closed (${this.On})`)
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
|
|
493
|
-
} else if (this.otherDeviceType === '
|
|
492
|
+
this.debugLog(`Garage Door On: ${this.On}`)
|
|
493
|
+
} else if (this.otherDeviceType === 'Door' && this.Door) {
|
|
494
494
|
if (this.On === undefined) {
|
|
495
|
-
|
|
495
|
+
this.debugLog(`On: ${this.On}`)
|
|
496
496
|
} else {
|
|
497
497
|
if (this.On) {
|
|
498
498
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
|
|
499
499
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
|
|
500
500
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
501
|
-
|
|
501
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
|
|
502
502
|
} else {
|
|
503
503
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
|
|
504
504
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
|
|
505
505
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
506
|
-
|
|
506
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
|
|
510
|
-
} else if (this.otherDeviceType === '
|
|
509
|
+
this.debugLog(`Door On: ${this.On}`)
|
|
510
|
+
} else if (this.otherDeviceType === 'Window' && this.Window) {
|
|
511
511
|
if (this.On === undefined) {
|
|
512
|
-
|
|
512
|
+
this.debugLog(`On: ${this.On}`)
|
|
513
513
|
} else {
|
|
514
514
|
if (this.On) {
|
|
515
515
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
|
|
516
516
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
|
|
517
517
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
518
|
-
|
|
518
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
|
|
519
519
|
} else {
|
|
520
520
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
|
|
521
521
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
|
|
522
522
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
523
|
-
|
|
523
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
|
|
527
|
-
} else if (this.otherDeviceType === '
|
|
526
|
+
this.debugLog(`Window On: ${this.On}`)
|
|
527
|
+
} else if (this.otherDeviceType === 'WindowCovering' && this.WindowCovering) {
|
|
528
528
|
if (this.On === undefined) {
|
|
529
|
-
|
|
529
|
+
this.debugLog(`On: ${this.On}`)
|
|
530
530
|
} else {
|
|
531
531
|
if (this.On) {
|
|
532
532
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
|
|
533
533
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
|
|
534
534
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
535
|
-
|
|
535
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
|
|
536
536
|
} else {
|
|
537
537
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
|
|
538
538
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
|
|
539
539
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
540
|
-
|
|
540
|
+
this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
|
|
544
|
-
} else if (this.otherDeviceType === '
|
|
543
|
+
this.debugLog(`Window Covering On: ${this.On}`)
|
|
544
|
+
} else if (this.otherDeviceType === 'Lock' && this.LockMechanism) {
|
|
545
545
|
if (this.On === undefined) {
|
|
546
|
-
|
|
546
|
+
this.debugLog(`On: ${this.On}`)
|
|
547
547
|
} else {
|
|
548
548
|
if (this.On) {
|
|
549
549
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED)
|
|
550
550
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED)
|
|
551
|
-
|
|
551
|
+
this.debugLog(`updateCharacteristicc LockTargetState: UNSECURED, LockCurrentState: UNSECURED (${this.On})`)
|
|
552
552
|
} else {
|
|
553
553
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED)
|
|
554
554
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED)
|
|
555
|
-
|
|
555
|
+
this.debugLog(`updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED (${this.On})`)
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
|
|
559
|
-
} else if (this.otherDeviceType === '
|
|
558
|
+
this.debugLog(`Lock On: ${this.On}`)
|
|
559
|
+
} else if (this.otherDeviceType === 'Faucet' && this.Faucet) {
|
|
560
560
|
if (this.On === undefined) {
|
|
561
|
-
|
|
561
|
+
this.debugLog(`On: ${this.On}`)
|
|
562
562
|
} else {
|
|
563
563
|
if (this.On) {
|
|
564
564
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
|
|
565
|
-
|
|
565
|
+
this.debugLog(`updateCharacteristic Active: ${this.On}`)
|
|
566
566
|
} else {
|
|
567
567
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE)
|
|
568
|
-
|
|
568
|
+
this.debugLog(`updateCharacteristic Active: ${this.On}`)
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
|
|
572
|
-
} else if (this.otherDeviceType === '
|
|
571
|
+
this.debugLog(`Faucet On: ${this.On}`)
|
|
572
|
+
} else if (this.otherDeviceType === 'Fan' && this.Fan) {
|
|
573
573
|
if (this.On === undefined) {
|
|
574
|
-
|
|
574
|
+
this.debugLog(`On: ${this.On}`)
|
|
575
575
|
} else {
|
|
576
576
|
if (this.On) {
|
|
577
577
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
|
|
578
|
-
|
|
578
|
+
this.debugLog(`updateCharacteristic Active: ${this.On}`)
|
|
579
579
|
} else {
|
|
580
580
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE)
|
|
581
|
-
|
|
581
|
+
this.debugLog(`updateCharacteristic Active: ${this.On}`)
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
|
|
585
|
-
} else if (this.otherDeviceType === '
|
|
584
|
+
this.debugLog(`Fan On: ${this.On}`)
|
|
585
|
+
} else if (this.otherDeviceType === 'Stateful' && this.StatefulProgrammableSwitch) {
|
|
586
586
|
if (this.On === undefined) {
|
|
587
|
-
|
|
587
|
+
this.debugLog(`On: ${this.On}`)
|
|
588
588
|
} else {
|
|
589
589
|
if (this.On) {
|
|
590
590
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)
|
|
591
591
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1)
|
|
592
|
-
|
|
592
|
+
this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
|
|
593
593
|
} else {
|
|
594
594
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)
|
|
595
595
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0)
|
|
596
|
-
|
|
596
|
+
this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
} else if (this.otherDeviceType === '
|
|
599
|
+
this.debugLog(`StatefulProgrammableSwitch On: ${this.On}`)
|
|
600
|
+
} else if (this.otherDeviceType === 'Outlet' && this.Outlet) {
|
|
601
601
|
if (this.On === undefined) {
|
|
602
|
-
|
|
602
|
+
this.debugLog(`On: ${this.On}`)
|
|
603
603
|
} else {
|
|
604
604
|
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.On)
|
|
605
|
-
|
|
605
|
+
this.debugLog(`updateCharacteristic On: ${this.On}`)
|
|
606
606
|
}
|
|
607
607
|
} else {
|
|
608
|
-
|
|
608
|
+
this.errorLog(`otherDeviceType: ${this.otherDeviceType}, On: ${this.On}`)
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
async apiError(e: any): Promise<void> {
|
|
613
|
-
if (this.otherDeviceType === '
|
|
613
|
+
if (this.otherDeviceType === 'GarageDoor') {
|
|
614
614
|
if (this.GarageDoor) {
|
|
615
615
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, e)
|
|
616
616
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, e)
|
|
617
617
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.ObstructionDetected, e)
|
|
618
618
|
}
|
|
619
|
-
} else if (this.otherDeviceType === '
|
|
619
|
+
} else if (this.otherDeviceType === 'Door') {
|
|
620
620
|
if (this.Door) {
|
|
621
621
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e)
|
|
622
622
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e)
|
|
623
623
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e)
|
|
624
624
|
}
|
|
625
|
-
} else if (this.otherDeviceType === '
|
|
625
|
+
} else if (this.otherDeviceType === 'Window') {
|
|
626
626
|
if (this.Window) {
|
|
627
627
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e)
|
|
628
628
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e)
|
|
629
629
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e)
|
|
630
630
|
}
|
|
631
|
-
} else if (this.otherDeviceType === '
|
|
631
|
+
} else if (this.otherDeviceType === 'WindowCovering') {
|
|
632
632
|
if (this.WindowCovering) {
|
|
633
633
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e)
|
|
634
634
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e)
|
|
635
635
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e)
|
|
636
636
|
}
|
|
637
|
-
} else if (this.otherDeviceType === '
|
|
637
|
+
} else if (this.otherDeviceType === 'Lock') {
|
|
638
638
|
if (this.LockMechanism) {
|
|
639
639
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, e)
|
|
640
640
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, e)
|
|
641
641
|
}
|
|
642
|
-
} else if (this.otherDeviceType === '
|
|
642
|
+
} else if (this.otherDeviceType === 'Faucet') {
|
|
643
643
|
if (this.Faucet) {
|
|
644
644
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, e)
|
|
645
645
|
}
|
|
646
|
-
} else if (this.otherDeviceType === '
|
|
646
|
+
} else if (this.otherDeviceType === 'Fan') {
|
|
647
647
|
if (this.Fan) {
|
|
648
648
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, e)
|
|
649
649
|
}
|
|
650
|
-
} else if (this.otherDeviceType === '
|
|
650
|
+
} else if (this.otherDeviceType === 'Stateful') {
|
|
651
651
|
if (this.StatefulProgrammableSwitch) {
|
|
652
652
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, e)
|
|
653
653
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, e)
|
|
654
654
|
}
|
|
655
|
-
} else if (this.otherDeviceType === '
|
|
655
|
+
} else if (this.otherDeviceType === 'Switch') {
|
|
656
656
|
if (this.Switch) {
|
|
657
657
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, e)
|
|
658
658
|
}
|
|
@@ -784,8 +784,8 @@ export class Others extends irdeviceBase {
|
|
|
784
784
|
}
|
|
785
785
|
|
|
786
786
|
async getOtherConfigSettings(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
|
|
787
|
-
this.otherDeviceType = (device as irOtherConfig).type ?? '
|
|
787
|
+
this.otherDeviceType = (device as irOtherConfig).type ?? 'Outlet'
|
|
788
788
|
const deviceType = (device as irOtherConfig).type ? 'Device Config' : 'Default'
|
|
789
|
-
|
|
789
|
+
this.debugLog(`Use ${deviceType} Device Type: ${this.otherDeviceType}`)
|
|
790
790
|
}
|
|
791
791
|
}
|