@switchbot/homebridge-switchbot 3.5.0-beta.6 → 3.5.0-beta.60
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/.vscode/settings.json +4 -1
- package/CHANGELOG.md +4 -1
- package/config.schema.json +120 -17
- package/dist/device/blindtilt.d.ts +23 -96
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +408 -779
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +26 -72
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +696 -822
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +14 -68
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +237 -606
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +14 -75
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +279 -658
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +15 -66
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +242 -544
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +19 -88
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +402 -805
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +59 -0
- package/dist/device/device.d.ts.map +1 -0
- package/dist/device/device.js +684 -0
- package/dist/device/device.js.map +1 -0
- package/dist/device/fan.d.ts +51 -0
- package/dist/device/fan.d.ts.map +1 -0
- package/dist/device/fan.js +535 -0
- package/dist/device/fan.js.map +1 -0
- package/dist/device/hub.d.ts +16 -60
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +246 -613
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +11 -66
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +232 -593
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +11 -64
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +185 -600
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +11 -69
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +277 -586
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +16 -63
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +241 -560
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +14 -64
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +181 -593
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +14 -65
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +170 -593
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +13 -69
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +178 -531
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +9 -57
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +92 -458
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +12 -63
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +197 -521
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +10 -65
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +139 -495
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +22 -16
- package/dist/homebridge-ui/server.js +1 -1
- package/dist/homebridge-ui/server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +9 -49
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +309 -419
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +8 -39
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +72 -304
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +7 -36
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +34 -278
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +10 -43
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +100 -338
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +40 -0
- package/dist/irdevice/irdevice.d.ts.map +1 -0
- package/dist/irdevice/irdevice.js +330 -0
- package/dist/irdevice/irdevice.js.map +1 -0
- package/dist/irdevice/light.d.ts +12 -45
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +87 -357
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +19 -48
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +352 -546
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +8 -40
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +82 -321
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +7 -36
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +41 -284
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +7 -36
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +42 -287
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +19 -6
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +310 -169
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +62 -19
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +16 -552
- package/dist/settings.js.map +1 -1
- package/dist/utils.d.ts +77 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +638 -1
- package/dist/utils.js.map +1 -1
- package/eslint.config.js +96 -0
- package/package.json +19 -15
- package/src/custom.d.ts +2 -1
- package/src/device/blindtilt.ts +442 -814
- package/src/device/bot.ts +754 -915
- package/src/device/ceilinglight.ts +255 -633
- package/src/device/colorbulb.ts +294 -685
- package/src/device/contact.ts +277 -571
- package/src/device/curtain.ts +431 -835
- package/src/device/device.ts +709 -0
- package/src/device/fan.ts +591 -0
- package/src/device/hub.ts +286 -644
- package/src/device/humidifier.ts +266 -646
- package/src/device/iosensor.ts +220 -625
- package/src/device/lightstrip.ts +305 -620
- package/src/device/lock.ts +280 -600
- package/src/device/meter.ts +216 -617
- package/src/device/meterplus.ts +205 -619
- package/src/device/motion.ts +206 -556
- package/src/device/plug.ts +107 -490
- package/src/device/robotvacuumcleaner.ts +223 -550
- package/src/device/waterdetector.ts +160 -519
- package/src/homebridge-ui/public/index.html +22 -16
- package/src/homebridge-ui/server.ts +1 -1
- package/src/index.ts +4 -3
- package/src/irdevice/airconditioner.ts +333 -447
- package/src/irdevice/airpurifier.ts +92 -322
- package/src/irdevice/camera.ts +45 -294
- package/src/irdevice/fan.ts +115 -353
- package/src/irdevice/irdevice.ts +346 -0
- package/src/irdevice/light.ts +110 -385
- package/src/irdevice/other.ts +399 -616
- package/src/irdevice/tv.ts +103 -340
- package/src/irdevice/vacuumcleaner.ts +52 -306
- package/src/irdevice/waterheater.ts +53 -311
- package/src/platform.ts +355 -216
- package/src/settings.ts +116 -611
- package/src/utils.ts +642 -1
- package/src/device/waterdetector.json +0 -11
package/src/irdevice/other.ts
CHANGED
|
@@ -1,67 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
/* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* other.ts: @switchbot/homebridge-switchbot.
|
|
4
|
+
*/
|
|
2
5
|
import { request } from 'undici';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
6
|
+
import { Devices } from '../settings.js';
|
|
7
|
+
import { irdeviceBase } from './irdevice.js';
|
|
8
|
+
|
|
9
|
+
import type { SwitchBotPlatform } from '../platform.js';
|
|
10
|
+
import type { irDevicesConfig, irdevice } from '../settings.js';
|
|
11
|
+
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* Platform Accessory
|
|
8
15
|
* An instance of this class is created for each accessory your platform registers
|
|
9
16
|
* Each accessory may expose multiple services of different service types.
|
|
10
17
|
*/
|
|
11
|
-
export class Others {
|
|
12
|
-
public readonly api: API;
|
|
13
|
-
public readonly log: Logging;
|
|
14
|
-
public readonly config!: SwitchBotPlatformConfig;
|
|
15
|
-
protected readonly hap: HAP;
|
|
18
|
+
export class Others extends irdeviceBase {
|
|
16
19
|
// Services
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
private Switch?: {
|
|
21
|
+
Service: Service;
|
|
22
|
+
On: CharacteristicValue;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
private GarageDoor?: {
|
|
26
|
+
Service: Service;
|
|
27
|
+
On: CharacteristicValue;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
private Door?: {
|
|
31
|
+
Service: Service;
|
|
32
|
+
On: CharacteristicValue;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
private Window?: {
|
|
36
|
+
Service: Service;
|
|
37
|
+
On: CharacteristicValue;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
private WindowCovering?: {
|
|
41
|
+
Service: Service;
|
|
42
|
+
On: CharacteristicValue;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
private Lock?: {
|
|
46
|
+
Service: Service;
|
|
47
|
+
On: CharacteristicValue;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
private Faucet?: {
|
|
51
|
+
Service: Service;
|
|
52
|
+
On: CharacteristicValue;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
private Fan?: {
|
|
56
|
+
Service: Service;
|
|
57
|
+
On: CharacteristicValue;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
private StatefulProgrammableSwitch?: {
|
|
61
|
+
Service: Service;
|
|
62
|
+
On: CharacteristicValue;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
private Outlet?: {
|
|
66
|
+
Service: Service;
|
|
67
|
+
On: CharacteristicValue;
|
|
68
|
+
};
|
|
31
69
|
|
|
32
70
|
// Config
|
|
33
|
-
deviceLogging!: string;
|
|
34
|
-
disablePushOn?: boolean;
|
|
35
71
|
otherDeviceType?: string;
|
|
36
|
-
disablePushOff?: boolean;
|
|
37
72
|
|
|
38
73
|
constructor(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
74
|
+
readonly platform: SwitchBotPlatform,
|
|
75
|
+
accessory: PlatformAccessory,
|
|
76
|
+
device: irdevice & irDevicesConfig,
|
|
42
77
|
) {
|
|
43
|
-
|
|
44
|
-
this.log = this.platform.log;
|
|
45
|
-
this.config = this.platform.config;
|
|
46
|
-
this.hap = this.api.hap;
|
|
47
|
-
// default placeholders
|
|
48
|
-
this.deviceLogs(device);
|
|
49
|
-
this.deviceType(device);
|
|
50
|
-
this.deviceContext();
|
|
51
|
-
this.disablePushOnChanges(device);
|
|
52
|
-
this.disablePushOffChanges(device);
|
|
53
|
-
this.deviceConfig(device);
|
|
78
|
+
super(platform, accessory, device);
|
|
54
79
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
.getService(this.hap.Service.AccessoryInformation)!
|
|
58
|
-
.setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
|
|
59
|
-
.setCharacteristic(this.hap.Characteristic.Model, device.remoteType)
|
|
60
|
-
.setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId)
|
|
61
|
-
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
80
|
+
// default placeholders
|
|
81
|
+
this.getOtherConfigSettings(device);
|
|
62
82
|
|
|
63
83
|
// deviceType
|
|
64
84
|
if (this.otherDeviceType === 'switch') {
|
|
85
|
+
// Initialize Switch property
|
|
86
|
+
this.Switch = {
|
|
87
|
+
Service: accessory.getService(this.hap.Service.Switch) as Service,
|
|
88
|
+
On: accessory.context.On || false,
|
|
89
|
+
};
|
|
65
90
|
this.removeFanService(accessory);
|
|
66
91
|
this.removeLockService(accessory);
|
|
67
92
|
this.removeDoorService(accessory);
|
|
@@ -72,18 +97,20 @@ export class Others {
|
|
|
72
97
|
this.removeWindowCoveringService(accessory);
|
|
73
98
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
74
99
|
|
|
75
|
-
// Add
|
|
76
|
-
const
|
|
77
|
-
(this.
|
|
78
|
-
|| accessory.addService(this.hap.Service.Switch)),
|
|
100
|
+
// Add Switch Service
|
|
101
|
+
const SwitchService = `${accessory.displayName} Switch`;
|
|
102
|
+
(this.Switch!.Service = accessory.getService(this.hap.Service.Switch) as Service
|
|
103
|
+
|| accessory.addService(this.hap.Service.Switch)), SwitchService;
|
|
79
104
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Switch`);
|
|
80
105
|
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
this.switchService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
84
|
-
}
|
|
85
|
-
this.switchService.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
106
|
+
this.Switch!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
107
|
+
this.Switch!.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
86
108
|
} else if (this.otherDeviceType === 'garagedoor') {
|
|
109
|
+
// Initialize Garage Door property
|
|
110
|
+
this.GarageDoor = {
|
|
111
|
+
Service: accessory.getService(this.hap.Service.GarageDoorOpener) as Service,
|
|
112
|
+
On: accessory.context.On || false,
|
|
113
|
+
};
|
|
87
114
|
this.removeFanService(accessory);
|
|
88
115
|
this.removeLockService(accessory);
|
|
89
116
|
this.removeDoorService(accessory);
|
|
@@ -94,19 +121,21 @@ export class Others {
|
|
|
94
121
|
this.removeWindowCoveringService(accessory);
|
|
95
122
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
96
123
|
|
|
97
|
-
// Add
|
|
98
|
-
const
|
|
99
|
-
(this.
|
|
100
|
-
|| accessory.addService(this.hap.Service.GarageDoorOpener)),
|
|
124
|
+
// Add GarageDoor Service
|
|
125
|
+
const GarageDoorService = `${accessory.displayName} Garage Door Opener`;
|
|
126
|
+
(this.GarageDoor!.Service = accessory.getService(this.hap.Service.GarageDoorOpener) as Service
|
|
127
|
+
|| accessory.addService(this.hap.Service.GarageDoorOpener)), GarageDoorService;
|
|
101
128
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Garage Door Opener`);
|
|
102
129
|
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
this.garageDoorService.getCharacteristic(this.hap.Characteristic.TargetDoorState).onSet(this.OnSet.bind(this));
|
|
108
|
-
this.garageDoorService.setCharacteristic(this.hap.Characteristic.ObstructionDetected, false);
|
|
130
|
+
this.GarageDoor!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
131
|
+
this.GarageDoor!.Service.getCharacteristic(this.hap.Characteristic.TargetDoorState).onSet(this.OnSet.bind(this));
|
|
132
|
+
this.GarageDoor!.Service.setCharacteristic(this.hap.Characteristic.ObstructionDetected, false);
|
|
109
133
|
} else if (this.otherDeviceType === 'door') {
|
|
134
|
+
// Initialize Door property
|
|
135
|
+
this.Door = {
|
|
136
|
+
Service: accessory.getService(this.hap.Service.Door) as Service,
|
|
137
|
+
On: accessory.context.On || false,
|
|
138
|
+
};
|
|
110
139
|
this.removeFanService(accessory);
|
|
111
140
|
this.removeLockService(accessory);
|
|
112
141
|
this.removeOutletService(accessory);
|
|
@@ -117,17 +146,14 @@ export class Others {
|
|
|
117
146
|
this.removeWindowCoveringService(accessory);
|
|
118
147
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
119
148
|
|
|
120
|
-
// Add
|
|
121
|
-
const
|
|
122
|
-
(this.
|
|
123
|
-
|| accessory.addService(this.hap.Service.Door)),
|
|
149
|
+
// Add Door Service
|
|
150
|
+
const DoorService = `${accessory.displayName} Door`;
|
|
151
|
+
(this.Door!.Service = accessory.getService(this.hap.Service.Door) as Service
|
|
152
|
+
|| accessory.addService(this.hap.Service.Door)), DoorService;
|
|
124
153
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Door`);
|
|
125
154
|
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
this.doorService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
129
|
-
}
|
|
130
|
-
this.doorService
|
|
155
|
+
this.Door!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
156
|
+
this.Door!.Service
|
|
131
157
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
132
158
|
.setProps({
|
|
133
159
|
validValues: [0, 100],
|
|
@@ -136,8 +162,13 @@ export class Others {
|
|
|
136
162
|
minStep: 100,
|
|
137
163
|
})
|
|
138
164
|
.onSet(this.OnSet.bind(this));
|
|
139
|
-
this.
|
|
165
|
+
this.Door!.Service.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
140
166
|
} else if (this.otherDeviceType === 'window') {
|
|
167
|
+
// Initialize Window property
|
|
168
|
+
this.Window = {
|
|
169
|
+
Service: accessory.getService(this.hap.Service.Window) as Service,
|
|
170
|
+
On: accessory.context.On || false,
|
|
171
|
+
};
|
|
141
172
|
this.removeFanService(accessory);
|
|
142
173
|
this.removeLockService(accessory);
|
|
143
174
|
this.removeDoorService(accessory);
|
|
@@ -148,17 +179,14 @@ export class Others {
|
|
|
148
179
|
this.removeWindowCoveringService(accessory);
|
|
149
180
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
150
181
|
|
|
151
|
-
// Add
|
|
152
|
-
const
|
|
153
|
-
(this.
|
|
154
|
-
|| accessory.addService(this.hap.Service.Window)),
|
|
182
|
+
// Add Window Service
|
|
183
|
+
const WindowService = `${accessory.displayName} Window`;
|
|
184
|
+
(this.Window!.Service = accessory.getService(this.hap.Service.Window) as Service
|
|
185
|
+
|| accessory.addService(this.hap.Service.Window)), WindowService;
|
|
155
186
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window`);
|
|
156
187
|
|
|
157
|
-
this.
|
|
158
|
-
|
|
159
|
-
this.windowService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
160
|
-
}
|
|
161
|
-
this.windowService
|
|
188
|
+
this.Window!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
189
|
+
this.Window!.Service
|
|
162
190
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
163
191
|
.setProps({
|
|
164
192
|
validValues: [0, 100],
|
|
@@ -167,8 +195,13 @@ export class Others {
|
|
|
167
195
|
minStep: 100,
|
|
168
196
|
})
|
|
169
197
|
.onSet(this.OnSet.bind(this));
|
|
170
|
-
this.
|
|
198
|
+
this.Window!.Service.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
171
199
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
200
|
+
// Initialize WindowCovering property
|
|
201
|
+
this.WindowCovering = {
|
|
202
|
+
Service: accessory.getService(this.hap.Service.WindowCovering) as Service,
|
|
203
|
+
On: accessory.context.On || false,
|
|
204
|
+
};
|
|
172
205
|
this.removeFanService(accessory);
|
|
173
206
|
this.removeLockService(accessory);
|
|
174
207
|
this.removeDoorService(accessory);
|
|
@@ -179,17 +212,14 @@ export class Others {
|
|
|
179
212
|
this.removeGarageDoorService(accessory);
|
|
180
213
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
181
214
|
|
|
182
|
-
// Add
|
|
183
|
-
const
|
|
184
|
-
(this.
|
|
185
|
-
|| accessory.addService(this.hap.Service.WindowCovering)),
|
|
215
|
+
// Add WindowCovering Service
|
|
216
|
+
const WindowCoveringService = `${accessory.displayName} Window Covering`;
|
|
217
|
+
(this.WindowCovering!.Service = accessory.getService(this.hap.Service.WindowCovering) as Service
|
|
218
|
+
|| accessory.addService(this.hap.Service.WindowCovering)), WindowCoveringService;
|
|
186
219
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window Covering`);
|
|
187
220
|
|
|
188
|
-
this.
|
|
189
|
-
|
|
190
|
-
this.windowCoveringService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
191
|
-
}
|
|
192
|
-
this.windowCoveringService
|
|
221
|
+
this.WindowCovering!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
222
|
+
this.WindowCovering!.Service
|
|
193
223
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
194
224
|
.setProps({
|
|
195
225
|
validValues: [0, 100],
|
|
@@ -198,8 +228,13 @@ export class Others {
|
|
|
198
228
|
minStep: 100,
|
|
199
229
|
})
|
|
200
230
|
.onSet(this.OnSet.bind(this));
|
|
201
|
-
this.
|
|
231
|
+
this.WindowCovering!.Service.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
202
232
|
} else if (this.otherDeviceType === 'lock') {
|
|
233
|
+
// Initialize Lock property
|
|
234
|
+
this.Lock = {
|
|
235
|
+
Service: accessory.getService(this.hap.Service.LockMechanism) as Service,
|
|
236
|
+
On: accessory.context.On || false,
|
|
237
|
+
};
|
|
203
238
|
this.removeFanService(accessory);
|
|
204
239
|
this.removeDoorService(accessory);
|
|
205
240
|
this.removeOutletService(accessory);
|
|
@@ -210,18 +245,20 @@ export class Others {
|
|
|
210
245
|
this.removeWindowCoveringService(accessory);
|
|
211
246
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
212
247
|
|
|
213
|
-
// Add
|
|
214
|
-
const
|
|
215
|
-
(this.
|
|
216
|
-
|| accessory.addService(this.hap.Service.LockMechanism)),
|
|
248
|
+
// Add Lock Service
|
|
249
|
+
const LockService = `${accessory.displayName} Lock`;
|
|
250
|
+
(this.Lock!.Service = accessory.getService(this.hap.Service.LockMechanism) as Service
|
|
251
|
+
|| accessory.addService(this.hap.Service.LockMechanism)), LockService;
|
|
217
252
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Lock`);
|
|
218
253
|
|
|
219
|
-
this.
|
|
220
|
-
|
|
221
|
-
this.lockService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
222
|
-
}
|
|
223
|
-
this.lockService.getCharacteristic(this.hap.Characteristic.LockTargetState).onSet(this.OnSet.bind(this));
|
|
254
|
+
this.Lock!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
255
|
+
this.Lock!.Service.getCharacteristic(this.hap.Characteristic.LockTargetState).onSet(this.OnSet.bind(this));
|
|
224
256
|
} else if (this.otherDeviceType === 'faucet') {
|
|
257
|
+
// Initialize Faucet property
|
|
258
|
+
this.Faucet = {
|
|
259
|
+
Service: accessory.getService(this.hap.Service.Faucet) as Service,
|
|
260
|
+
On: accessory.context.On || false,
|
|
261
|
+
};
|
|
225
262
|
this.removeFanService(accessory);
|
|
226
263
|
this.removeLockService(accessory);
|
|
227
264
|
this.removeDoorService(accessory);
|
|
@@ -232,18 +269,20 @@ export class Others {
|
|
|
232
269
|
this.removeWindowCoveringService(accessory);
|
|
233
270
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
234
271
|
|
|
235
|
-
// Add
|
|
236
|
-
const
|
|
237
|
-
(this.
|
|
238
|
-
|| accessory.addService(this.hap.Service.Faucet)),
|
|
272
|
+
// Add Faucet Service
|
|
273
|
+
const FaucetService = `${accessory.displayName} Faucet`;
|
|
274
|
+
(this.Faucet!.Service = accessory.getService(this.hap.Service.Faucet) as Service
|
|
275
|
+
|| accessory.addService(this.hap.Service.Faucet)), FaucetService;
|
|
239
276
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Faucet`);
|
|
240
277
|
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
this.faucetService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
244
|
-
}
|
|
245
|
-
this.faucetService.getCharacteristic(this.hap.Characteristic.Active).onSet(this.OnSet.bind(this));
|
|
278
|
+
this.Faucet!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
279
|
+
this.Faucet!.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.OnSet.bind(this));
|
|
246
280
|
} else if (this.otherDeviceType === 'fan') {
|
|
281
|
+
// Initialize Fan property
|
|
282
|
+
this.Fan = {
|
|
283
|
+
Service: accessory.getService(this.hap.Service.Fanv2) as Service,
|
|
284
|
+
On: accessory.context.On || false,
|
|
285
|
+
};
|
|
247
286
|
this.removeLockService(accessory);
|
|
248
287
|
this.removeDoorService(accessory);
|
|
249
288
|
this.removeFaucetService(accessory);
|
|
@@ -254,18 +293,20 @@ export class Others {
|
|
|
254
293
|
this.removeWindowCoveringService(accessory);
|
|
255
294
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
256
295
|
|
|
257
|
-
// Add
|
|
258
|
-
const
|
|
259
|
-
(this.
|
|
260
|
-
|| accessory.addService(this.hap.Service.
|
|
296
|
+
// Add Fan Service
|
|
297
|
+
const FanService = `${accessory.displayName} Fan`;
|
|
298
|
+
(this.Fan!.Service = accessory.getService(this.hap.Service.Fanv2) as Service
|
|
299
|
+
|| accessory.addService(this.hap.Service.Fanv2)), FanService;
|
|
261
300
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Fan`);
|
|
262
301
|
|
|
263
|
-
this.
|
|
264
|
-
|
|
265
|
-
this.fanService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
266
|
-
}
|
|
267
|
-
this.fanService.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
302
|
+
this.Fan!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
303
|
+
this.Fan!.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
268
304
|
} else if (this.otherDeviceType === 'stateful') {
|
|
305
|
+
// Initialize StatefulProgrammableSwitch property
|
|
306
|
+
this.StatefulProgrammableSwitch = {
|
|
307
|
+
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service,
|
|
308
|
+
On: accessory.context.On || false,
|
|
309
|
+
};
|
|
269
310
|
this.removeFanService(accessory);
|
|
270
311
|
this.removeLockService(accessory);
|
|
271
312
|
this.removeDoorService(accessory);
|
|
@@ -276,20 +317,22 @@ export class Others {
|
|
|
276
317
|
this.removeGarageDoorService(accessory);
|
|
277
318
|
this.removeWindowCoveringService(accessory);
|
|
278
319
|
|
|
279
|
-
// Add
|
|
280
|
-
const
|
|
281
|
-
(this.
|
|
282
|
-
|| accessory.addService(this.hap.Service.StatefulProgrammableSwitch)),
|
|
320
|
+
// Add StatefulProgrammableSwitch.Service
|
|
321
|
+
const StatefulProgrammableSwitchService = `${accessory.displayName} Stateful Programmable Switch`;
|
|
322
|
+
(this.StatefulProgrammableSwitch!.Service = accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service
|
|
323
|
+
|| accessory.addService(this.hap.Service.StatefulProgrammableSwitch)), StatefulProgrammableSwitchService;
|
|
283
324
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
|
|
284
325
|
|
|
285
|
-
this.
|
|
286
|
-
|
|
287
|
-
this.statefulProgrammableSwitchService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
288
|
-
}
|
|
289
|
-
this.statefulProgrammableSwitchService
|
|
326
|
+
this.StatefulProgrammableSwitch!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
327
|
+
this.StatefulProgrammableSwitch!.Service
|
|
290
328
|
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState)
|
|
291
329
|
.onSet(this.OnSet.bind(this));
|
|
292
330
|
} else {
|
|
331
|
+
// Initialize Outlet property
|
|
332
|
+
this.Outlet = {
|
|
333
|
+
Service: accessory.getService(this.hap.Service.Outlet) as Service,
|
|
334
|
+
On: accessory.context.On || false,
|
|
335
|
+
};
|
|
293
336
|
this.removeFanService(accessory);
|
|
294
337
|
this.removeLockService(accessory);
|
|
295
338
|
this.removeDoorService(accessory);
|
|
@@ -300,17 +343,14 @@ export class Others {
|
|
|
300
343
|
this.removeWindowCoveringService(accessory);
|
|
301
344
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
302
345
|
|
|
303
|
-
// Add
|
|
304
|
-
const
|
|
305
|
-
(this.
|
|
306
|
-
|| accessory.addService(this.hap.Service.Outlet)),
|
|
346
|
+
// Add Outlet.Service
|
|
347
|
+
const OutletService = `${accessory.displayName} Outlet`;
|
|
348
|
+
(this.Outlet!.Service = accessory.getService(this.hap.Service.Outlet) as Service
|
|
349
|
+
|| accessory.addService(this.hap.Service.Outlet)), OutletService;
|
|
307
350
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Outlet`);
|
|
308
351
|
|
|
309
|
-
this.
|
|
310
|
-
|
|
311
|
-
this.outletService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
312
|
-
}
|
|
313
|
-
this.outletService.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
352
|
+
this.Outlet!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
353
|
+
this.Outlet!.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
314
354
|
}
|
|
315
355
|
}
|
|
316
356
|
|
|
@@ -318,55 +358,75 @@ export class Others {
|
|
|
318
358
|
* Handle requests to set the "On" characteristic
|
|
319
359
|
*/
|
|
320
360
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
361
|
+
let On: boolean;
|
|
321
362
|
if (this.otherDeviceType === 'garagedoor') {
|
|
322
363
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetDoorState: ${value}`);
|
|
323
364
|
if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
|
|
324
|
-
this.On = false;
|
|
365
|
+
this.GarageDoor!.On = false;
|
|
366
|
+
} else {
|
|
367
|
+
this.GarageDoor!.On = true;
|
|
368
|
+
}
|
|
369
|
+
On = this.GarageDoor!.On;
|
|
370
|
+
} else if (this.otherDeviceType === 'door') {
|
|
371
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
|
|
372
|
+
if (value === 0) {
|
|
373
|
+
this.Door!.On = false;
|
|
325
374
|
} else {
|
|
326
|
-
this.On = true;
|
|
375
|
+
this.Door!.On = true;
|
|
327
376
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
this.otherDeviceType === 'window' ||
|
|
331
|
-
this.otherDeviceType === 'windowcovering'
|
|
332
|
-
) {
|
|
377
|
+
On = this.Door!.On;
|
|
378
|
+
} else if (this.otherDeviceType === 'window') {
|
|
333
379
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
|
|
334
380
|
if (value === 0) {
|
|
335
|
-
this.On = false;
|
|
381
|
+
this.Window!.On = false;
|
|
336
382
|
} else {
|
|
337
|
-
this.On = true;
|
|
383
|
+
this.Window!.On = true;
|
|
338
384
|
}
|
|
385
|
+
On = this.Window!.On;
|
|
386
|
+
} else if (this.otherDeviceType === 'windowcovering') {
|
|
387
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
|
|
388
|
+
if (value === 0) {
|
|
389
|
+
this.WindowCovering!.On = false;
|
|
390
|
+
} else {
|
|
391
|
+
this.WindowCovering!.On = true;
|
|
392
|
+
}
|
|
393
|
+
On = this.WindowCovering!.On;
|
|
339
394
|
} else if (this.otherDeviceType === 'lock') {
|
|
340
395
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set LockTargetState: ${value}`);
|
|
341
396
|
if (value === this.hap.Characteristic.LockTargetState.SECURED) {
|
|
342
|
-
this.On = false;
|
|
397
|
+
this.Lock!.On = false;
|
|
343
398
|
} else {
|
|
344
|
-
this.On = true;
|
|
399
|
+
this.Lock!.On = true;
|
|
345
400
|
}
|
|
401
|
+
On = this.Lock!.On;
|
|
346
402
|
} else if (this.otherDeviceType === 'faucet') {
|
|
347
403
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
|
|
348
404
|
if (value === this.hap.Characteristic.Active.INACTIVE) {
|
|
349
|
-
this.On = false;
|
|
405
|
+
this.Faucet!.On = false;
|
|
350
406
|
} else {
|
|
351
|
-
this.On = true;
|
|
407
|
+
this.Faucet!.On = true;
|
|
352
408
|
}
|
|
409
|
+
On = this.Faucet!.On;
|
|
353
410
|
} else if (this.otherDeviceType === 'stateful') {
|
|
354
411
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ProgrammableSwitchOutputState: ${value}`);
|
|
355
412
|
if (value === 0) {
|
|
356
|
-
this.On = false;
|
|
413
|
+
this.StatefulProgrammableSwitch!.On = false;
|
|
357
414
|
} else {
|
|
358
|
-
this.On = true;
|
|
415
|
+
this.StatefulProgrammableSwitch!.On = true;
|
|
359
416
|
}
|
|
417
|
+
|
|
418
|
+
On = this.StatefulProgrammableSwitch!.On;
|
|
360
419
|
} else {
|
|
361
420
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set On: ${value}`);
|
|
362
|
-
this.On = value;
|
|
421
|
+
this.Outlet!.On = value;
|
|
422
|
+
On = this.Outlet!.On ? true : false;
|
|
363
423
|
}
|
|
364
424
|
|
|
365
425
|
//pushChanges
|
|
366
|
-
if (
|
|
367
|
-
await this.pushOnChanges();
|
|
426
|
+
if (On === true) {
|
|
427
|
+
await this.pushOnChanges(On);
|
|
368
428
|
} else {
|
|
369
|
-
await this.pushOffChanges();
|
|
429
|
+
await this.pushOffChanges(On);
|
|
370
430
|
}
|
|
371
431
|
}
|
|
372
432
|
|
|
@@ -380,13 +440,11 @@ export class Others {
|
|
|
380
440
|
* Other - "command" "channelAdd" "default" = next channel
|
|
381
441
|
* Other - "command" "channelSub" "default" = previous channel
|
|
382
442
|
*/
|
|
383
|
-
async pushOnChanges(): Promise<void> {
|
|
384
|
-
this.debugLog(
|
|
385
|
-
|
|
386
|
-
` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`,
|
|
387
|
-
);
|
|
443
|
+
async pushOnChanges(On: boolean): Promise<void> {
|
|
444
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${On},`
|
|
445
|
+
+ ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
|
|
388
446
|
if (this.device.customize) {
|
|
389
|
-
if (
|
|
447
|
+
if (On === true && !this.disablePushOn) {
|
|
390
448
|
const commandType: string = await this.commandType();
|
|
391
449
|
const command: string = await this.commandOn();
|
|
392
450
|
const bodyChange = JSON.stringify({
|
|
@@ -401,13 +459,11 @@ export class Others {
|
|
|
401
459
|
}
|
|
402
460
|
}
|
|
403
461
|
|
|
404
|
-
async pushOffChanges(): Promise<void> {
|
|
405
|
-
this.debugLog(
|
|
406
|
-
|
|
407
|
-
` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`,
|
|
408
|
-
);
|
|
462
|
+
async pushOffChanges(On: boolean): Promise<void> {
|
|
463
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${On},`
|
|
464
|
+
+ ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
|
|
409
465
|
if (this.device.customize) {
|
|
410
|
-
if (
|
|
466
|
+
if (On === false && !this.disablePushOff) {
|
|
411
467
|
const commandType: string = await this.commandType();
|
|
412
468
|
const command: string = await this.commandOff();
|
|
413
469
|
const bodyChange = JSON.stringify({
|
|
@@ -437,8 +493,10 @@ export class Others {
|
|
|
437
493
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
438
494
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
439
495
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
440
|
-
this.
|
|
496
|
+
this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
441
497
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
498
|
+
this.successLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
499
|
+
+ ` request to SwitchBot API, body: ${JSON.stringify(bodyChange)} sent successfully`);
|
|
442
500
|
this.updateHomeKitCharacteristics();
|
|
443
501
|
} else {
|
|
444
502
|
this.statusCode(statusCode);
|
|
@@ -446,456 +504,294 @@ export class Others {
|
|
|
446
504
|
}
|
|
447
505
|
} catch (e: any) {
|
|
448
506
|
this.apiError(e);
|
|
449
|
-
this.errorLog(
|
|
450
|
-
|
|
451
|
-
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
452
|
-
);
|
|
507
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType}`
|
|
508
|
+
+ ` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
453
509
|
}
|
|
454
510
|
} else {
|
|
455
|
-
this.warnLog(
|
|
456
|
-
|
|
457
|
-
` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`,
|
|
458
|
-
);
|
|
511
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
512
|
+
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
459
513
|
}
|
|
460
514
|
}
|
|
461
515
|
|
|
462
516
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
463
517
|
if (this.otherDeviceType === 'garagedoor') {
|
|
464
|
-
if (this.On === undefined) {
|
|
465
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
518
|
+
if (this.GarageDoor!.On === undefined) {
|
|
519
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.GarageDoor!.On}`);
|
|
466
520
|
} else {
|
|
467
|
-
if (this.On) {
|
|
468
|
-
this.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.garageDoorService?.updateCharacteristic(
|
|
473
|
-
this.hap.Characteristic.CurrentDoorState,
|
|
474
|
-
this.hap.Characteristic.CurrentDoorState.OPEN,
|
|
475
|
-
);
|
|
476
|
-
this.debugLog(
|
|
477
|
-
`${this.device.remoteType}: ` + `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open`,
|
|
478
|
-
);
|
|
521
|
+
if (this.GarageDoor!.On) {
|
|
522
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
|
|
523
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
|
|
524
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
525
|
+
+ ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor!.On})`);
|
|
479
526
|
} else {
|
|
480
|
-
this.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
this.garageDoorService?.updateCharacteristic(
|
|
485
|
-
this.hap.Characteristic.CurrentDoorState,
|
|
486
|
-
this.hap.Characteristic.CurrentDoorState.CLOSED,
|
|
487
|
-
);
|
|
488
|
-
this.debugLog(
|
|
489
|
-
`${this.device.remoteType}: ` + `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open`,
|
|
490
|
-
);
|
|
527
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
|
|
528
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
|
|
529
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
530
|
+
+ ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor!.On})`);
|
|
491
531
|
}
|
|
492
532
|
}
|
|
493
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Garage Door On: ${this.On}`);
|
|
533
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Garage Door On: ${this.GarageDoor!.On}`);
|
|
494
534
|
} else if (this.otherDeviceType === 'door') {
|
|
495
|
-
if (this.On === undefined) {
|
|
496
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
535
|
+
if (this.Door!.On === undefined) {
|
|
536
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Door!.On}`);
|
|
497
537
|
} else {
|
|
498
|
-
if (this.On) {
|
|
499
|
-
this.
|
|
500
|
-
this.
|
|
501
|
-
this.
|
|
502
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic
|
|
538
|
+
if (this.Door!.On) {
|
|
539
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
540
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
541
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
542
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
543
|
+
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Door!.On})`);
|
|
503
544
|
} else {
|
|
504
|
-
this.
|
|
505
|
-
this.
|
|
506
|
-
this.
|
|
507
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic
|
|
545
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
546
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
547
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
548
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
549
|
+
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Door!.On})`);
|
|
508
550
|
}
|
|
509
551
|
}
|
|
510
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Door On: ${this.On}`);
|
|
552
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Door On: ${this.Door!.On}`);
|
|
511
553
|
} else if (this.otherDeviceType === 'window') {
|
|
512
|
-
if (this.On === undefined) {
|
|
513
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
554
|
+
if (this.Window!.On === undefined) {
|
|
555
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Window!.On}`);
|
|
514
556
|
} else {
|
|
515
|
-
if (this.On) {
|
|
516
|
-
this.
|
|
517
|
-
this.
|
|
518
|
-
this.
|
|
519
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic
|
|
557
|
+
if (this.Window!.On) {
|
|
558
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
559
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
560
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
561
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
562
|
+
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Window!.On})`);
|
|
520
563
|
} else {
|
|
521
|
-
this.
|
|
522
|
-
this.
|
|
523
|
-
this.
|
|
524
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic
|
|
564
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
565
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
566
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
567
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
568
|
+
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Window!.On})`);
|
|
525
569
|
}
|
|
526
570
|
}
|
|
527
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window On: ${this.On}`);
|
|
571
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window On: ${this.Window!.On}`);
|
|
528
572
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
529
|
-
if (this.On === undefined) {
|
|
530
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
573
|
+
if (this.WindowCovering!.On === undefined) {
|
|
574
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.WindowCovering!.On}`);
|
|
531
575
|
} else {
|
|
532
|
-
if (this.On) {
|
|
533
|
-
this.
|
|
534
|
-
this.
|
|
535
|
-
this.
|
|
536
|
-
|
|
537
|
-
this.
|
|
538
|
-
);
|
|
539
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic TargetPosition: 100, CurrentPosition: 100`);
|
|
576
|
+
if (this.WindowCovering!.On) {
|
|
577
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
578
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
579
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
580
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
581
|
+
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering!.On})`);
|
|
540
582
|
} else {
|
|
541
|
-
this.
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
544
|
-
|
|
545
|
-
this.
|
|
546
|
-
);
|
|
547
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic TargetPosition: 0, CurrentPosition: 0`);
|
|
583
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
584
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
585
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
586
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
587
|
+
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering!.On})`);
|
|
548
588
|
}
|
|
549
589
|
}
|
|
550
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window Covering On: ${this.On}`);
|
|
590
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window Covering On: ${this.WindowCovering!.On}`);
|
|
551
591
|
} else if (this.otherDeviceType === 'lock') {
|
|
552
|
-
if (this.On === undefined) {
|
|
553
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
592
|
+
if (this.Lock!.On === undefined) {
|
|
593
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Lock!.On}`);
|
|
554
594
|
} else {
|
|
555
|
-
if (this.On) {
|
|
556
|
-
this.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
this.lockService?.updateCharacteristic(
|
|
561
|
-
this.hap.Characteristic.LockCurrentState,
|
|
562
|
-
this.hap.Characteristic.LockCurrentState.UNSECURED,
|
|
563
|
-
);
|
|
564
|
-
this.debugLog(
|
|
565
|
-
`${this.device.remoteType}: ` +
|
|
566
|
-
`${this.accessory.displayName} updateCharacteristic LockTargetState: UNSECURED, LockCurrentState: UNSECURED`,
|
|
567
|
-
);
|
|
595
|
+
if (this.Lock!.On) {
|
|
596
|
+
this.Lock!.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED);
|
|
597
|
+
this.Lock!.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED);
|
|
598
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
599
|
+
+ ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.Lock!.On})`);
|
|
568
600
|
} else {
|
|
569
|
-
this.
|
|
570
|
-
this.
|
|
571
|
-
|
|
572
|
-
this.
|
|
573
|
-
);
|
|
574
|
-
this.debugLog(
|
|
575
|
-
`${this.device.remoteType}: ` + `${this.accessory.displayName} updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED`,
|
|
576
|
-
);
|
|
601
|
+
this.Lock!.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED);
|
|
602
|
+
this.Lock!.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED);
|
|
603
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
604
|
+
+ ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.Lock!.On})`);
|
|
577
605
|
}
|
|
578
606
|
}
|
|
579
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Lock On: ${this.On}`);
|
|
607
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Lock On: ${this.Lock!.On}`);
|
|
580
608
|
} else if (this.otherDeviceType === 'faucet') {
|
|
581
|
-
if (this.On === undefined) {
|
|
582
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
609
|
+
if (this.Faucet!.On === undefined) {
|
|
610
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Faucet!.On}`);
|
|
583
611
|
} else {
|
|
584
|
-
if (this.On) {
|
|
585
|
-
this.
|
|
586
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.On}`);
|
|
612
|
+
if (this.Faucet!.On) {
|
|
613
|
+
this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
614
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet!.On}`);
|
|
587
615
|
} else {
|
|
588
|
-
this.
|
|
589
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.On}`);
|
|
616
|
+
this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
617
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet!.On}`);
|
|
590
618
|
}
|
|
591
619
|
}
|
|
592
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Faucet On: ${this.On}`);
|
|
620
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Faucet On: ${this.Faucet!.On}`);
|
|
593
621
|
} else if (this.otherDeviceType === 'fan') {
|
|
594
|
-
if (this.On === undefined) {
|
|
595
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
622
|
+
if (this.Fan!.On === undefined) {
|
|
623
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Fan!.On}`);
|
|
596
624
|
} else {
|
|
597
|
-
if (this.On) {
|
|
598
|
-
this.
|
|
599
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
625
|
+
if (this.Fan!.On) {
|
|
626
|
+
this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
|
|
627
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan!.On}`);
|
|
600
628
|
} else {
|
|
601
|
-
this.
|
|
602
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
629
|
+
this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan!.On);
|
|
630
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan!.On}`);
|
|
603
631
|
}
|
|
604
632
|
}
|
|
605
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Fan On: ${this.On}`);
|
|
633
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Fan On: ${this.Fan!.On}`);
|
|
606
634
|
} else if (this.otherDeviceType === 'stateful') {
|
|
607
|
-
if (this.On === undefined) {
|
|
608
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
635
|
+
if (this.StatefulProgrammableSwitch!.On === undefined) {
|
|
636
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.StatefulProgrammableSwitch!.On}`);
|
|
609
637
|
} else {
|
|
610
|
-
if (this.On) {
|
|
611
|
-
this.
|
|
612
|
-
this.hap.Characteristic.ProgrammableSwitchEvent
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
this.debugLog(
|
|
617
|
-
`${this.device.remoteType}: ` +
|
|
618
|
-
`${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1`,
|
|
619
|
-
);
|
|
638
|
+
if (this.StatefulProgrammableSwitch!.On) {
|
|
639
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
|
|
640
|
+
this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
641
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
642
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
643
|
+
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch!.On})`);
|
|
620
644
|
} else {
|
|
621
|
-
this.
|
|
622
|
-
this.hap.Characteristic.ProgrammableSwitchEvent
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
this.debugLog(
|
|
627
|
-
`${this.device.remoteType}: ` +
|
|
628
|
-
`${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0`,
|
|
629
|
-
);
|
|
645
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent,
|
|
646
|
+
this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
647
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
648
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
649
|
+
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch!.On})`);
|
|
630
650
|
}
|
|
631
651
|
}
|
|
632
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.On}`);
|
|
652
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch!.On}`);
|
|
633
653
|
} else if (this.otherDeviceType === 'switch') {
|
|
634
|
-
if (this.On === undefined) {
|
|
635
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
654
|
+
if (this.Switch!.On === undefined) {
|
|
655
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Switch!.On}`);
|
|
636
656
|
} else {
|
|
637
|
-
this.
|
|
638
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
657
|
+
this.Switch!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch!.On);
|
|
658
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch!.On}`);
|
|
639
659
|
}
|
|
640
660
|
} else {
|
|
641
|
-
if (this.On === undefined) {
|
|
642
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
661
|
+
if (this.Outlet!.On === undefined) {
|
|
662
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Outlet!.On}`);
|
|
643
663
|
} else {
|
|
644
|
-
this.
|
|
645
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
664
|
+
this.Outlet!.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet!.On);
|
|
665
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Outlet!.On}`);
|
|
646
666
|
}
|
|
647
667
|
}
|
|
648
668
|
}
|
|
649
669
|
|
|
650
|
-
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
651
|
-
if (device.disablePushOn === undefined) {
|
|
652
|
-
this.disablePushOn = false;
|
|
653
|
-
} else {
|
|
654
|
-
this.disablePushOn = device.disablePushOn;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
659
|
-
if (device.disablePushOff === undefined) {
|
|
660
|
-
this.disablePushOff = false;
|
|
661
|
-
} else {
|
|
662
|
-
this.disablePushOff = device.disablePushOff;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
async commandType(): Promise<string> {
|
|
667
|
-
let commandType: string;
|
|
668
|
-
if (this.device.commandType && this.device.customize) {
|
|
669
|
-
commandType = this.device.commandType;
|
|
670
|
-
} else if (this.device.customize) {
|
|
671
|
-
commandType = 'customize';
|
|
672
|
-
} else {
|
|
673
|
-
commandType = 'command';
|
|
674
|
-
}
|
|
675
|
-
return commandType;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
async commandOn(): Promise<string> {
|
|
679
|
-
let command: string;
|
|
680
|
-
if (this.device.customize && this.device.customOn) {
|
|
681
|
-
command = this.device.customOn;
|
|
682
|
-
} else {
|
|
683
|
-
command = 'turnOn';
|
|
684
|
-
}
|
|
685
|
-
return command;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
async commandOff(): Promise<string> {
|
|
689
|
-
let command: string;
|
|
690
|
-
if (this.device.customize && this.device.customOff) {
|
|
691
|
-
command = this.device.customOff;
|
|
692
|
-
} else {
|
|
693
|
-
command = 'turnOff';
|
|
694
|
-
}
|
|
695
|
-
return command;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
async statusCode(statusCode: number): Promise<void> {
|
|
699
|
-
switch (statusCode) {
|
|
700
|
-
case 151:
|
|
701
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
|
|
702
|
-
break;
|
|
703
|
-
case 152:
|
|
704
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
|
|
705
|
-
break;
|
|
706
|
-
case 160:
|
|
707
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
|
|
708
|
-
break;
|
|
709
|
-
case 161:
|
|
710
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
|
|
711
|
-
break;
|
|
712
|
-
case 171:
|
|
713
|
-
this.errorLog(
|
|
714
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
715
|
-
`Hub: ${this.device.hubDeviceId}`,
|
|
716
|
-
);
|
|
717
|
-
break;
|
|
718
|
-
case 190:
|
|
719
|
-
this.errorLog(
|
|
720
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
|
|
721
|
-
` Or command format is invalid, statusCode: ${statusCode}`,
|
|
722
|
-
);
|
|
723
|
-
break;
|
|
724
|
-
case 100:
|
|
725
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
|
|
726
|
-
break;
|
|
727
|
-
case 200:
|
|
728
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
729
|
-
break;
|
|
730
|
-
case 400:
|
|
731
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
|
|
732
|
-
+ `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
|
|
733
|
-
break;
|
|
734
|
-
case 401:
|
|
735
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
|
|
736
|
-
+ `but the request has not been authenticated, statusCode: ${statusCode}`);
|
|
737
|
-
break;
|
|
738
|
-
case 403:
|
|
739
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
|
|
740
|
-
+ `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
|
|
741
|
-
break;
|
|
742
|
-
case 404:
|
|
743
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
|
|
744
|
-
+ `statusCode: ${statusCode}`);
|
|
745
|
-
break;
|
|
746
|
-
case 406:
|
|
747
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
|
|
748
|
-
+ `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
|
|
749
|
-
break;
|
|
750
|
-
case 415:
|
|
751
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
|
|
752
|
-
+ `header that is not supported by the server, statusCode: ${statusCode}`);
|
|
753
|
-
break;
|
|
754
|
-
case 422:
|
|
755
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, but `
|
|
756
|
-
+ `the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
|
|
757
|
-
break;
|
|
758
|
-
case 429:
|
|
759
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
|
|
760
|
-
+ `requests allowed for a given time window, statusCode: ${statusCode}`);
|
|
761
|
-
break;
|
|
762
|
-
case 500:
|
|
763
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
|
|
764
|
-
+ `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
|
|
765
|
-
break;
|
|
766
|
-
default:
|
|
767
|
-
this.infoLog(
|
|
768
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: ` +
|
|
769
|
-
`${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`,
|
|
770
|
-
);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
670
|
async apiError(e: any): Promise<void> {
|
|
775
671
|
if (this.otherDeviceType === 'garagedoor') {
|
|
776
|
-
this.
|
|
777
|
-
this.
|
|
778
|
-
this.
|
|
672
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, e);
|
|
673
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, e);
|
|
674
|
+
this.GarageDoor!.Service.updateCharacteristic(this.hap.Characteristic.ObstructionDetected, e);
|
|
779
675
|
} else if (this.otherDeviceType === 'door') {
|
|
780
|
-
this.
|
|
781
|
-
this.
|
|
782
|
-
this.
|
|
676
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
677
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
678
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
783
679
|
} else if (this.otherDeviceType === 'window') {
|
|
784
|
-
this.
|
|
785
|
-
this.
|
|
786
|
-
this.
|
|
680
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
681
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
682
|
+
this.Window!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
787
683
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
788
|
-
this.
|
|
789
|
-
this.
|
|
790
|
-
this.
|
|
684
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
685
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
686
|
+
this.WindowCovering!.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
791
687
|
} else if (this.otherDeviceType === 'lock') {
|
|
792
|
-
this.
|
|
793
|
-
this.
|
|
688
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, e);
|
|
689
|
+
this.Door!.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, e);
|
|
794
690
|
} else if (this.otherDeviceType === 'faucet') {
|
|
795
|
-
this.
|
|
691
|
+
this.Faucet!.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
796
692
|
} else if (this.otherDeviceType === 'fan') {
|
|
797
|
-
this.
|
|
693
|
+
this.Fan!.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
798
694
|
} else if (this.otherDeviceType === 'stateful') {
|
|
799
|
-
this.
|
|
800
|
-
this.
|
|
695
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, e);
|
|
696
|
+
this.StatefulProgrammableSwitch!.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, e);
|
|
801
697
|
} else if (this.otherDeviceType === 'switch') {
|
|
802
|
-
this.
|
|
698
|
+
this.Switch!.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
803
699
|
} else {
|
|
804
|
-
this.
|
|
700
|
+
this.Outlet!.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
805
701
|
}
|
|
806
702
|
}
|
|
807
703
|
|
|
808
704
|
async removeOutletService(accessory: PlatformAccessory): Promise<void> {
|
|
809
|
-
// If
|
|
810
|
-
|
|
811
|
-
|
|
705
|
+
// If Outlet.Service still present, then remove first
|
|
706
|
+
if (this.Outlet?.Service) {
|
|
707
|
+
this.Outlet!.Service = this.accessory.getService(this.hap.Service.Outlet) as Service;
|
|
812
708
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Outlet Service`);
|
|
709
|
+
accessory.removeService(this.Outlet!.Service);
|
|
813
710
|
}
|
|
814
|
-
accessory.removeService(this.outletService!);
|
|
815
711
|
}
|
|
816
712
|
|
|
817
713
|
async removeGarageDoorService(accessory: PlatformAccessory): Promise<void> {
|
|
818
|
-
// If
|
|
819
|
-
|
|
820
|
-
|
|
714
|
+
// If GarageDoor.Service still present, then remove first
|
|
715
|
+
if (this.GarageDoor?.Service) {
|
|
716
|
+
this.GarageDoor!.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener) as Service;
|
|
821
717
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Garage Door Service`);
|
|
718
|
+
accessory.removeService(this.GarageDoor!.Service);
|
|
822
719
|
}
|
|
823
|
-
accessory.removeService(this.garageDoorService!);
|
|
824
720
|
}
|
|
825
721
|
|
|
826
722
|
async removeDoorService(accessory: PlatformAccessory): Promise<void> {
|
|
827
|
-
// If
|
|
828
|
-
|
|
829
|
-
|
|
723
|
+
// If Door.Service still present, then remove first
|
|
724
|
+
if (this.Door?.Service) {
|
|
725
|
+
this.Door!.Service = this.accessory.getService(this.hap.Service.Door) as Service;
|
|
830
726
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Door Service`);
|
|
727
|
+
accessory.removeService(this.Door!.Service);
|
|
831
728
|
}
|
|
832
|
-
accessory.removeService(this.doorService!);
|
|
833
729
|
}
|
|
834
730
|
|
|
835
731
|
async removeLockService(accessory: PlatformAccessory): Promise<void> {
|
|
836
|
-
// If
|
|
837
|
-
|
|
838
|
-
|
|
732
|
+
// If Lock.Service still present, then remove first
|
|
733
|
+
if (this.Lock?.Service) {
|
|
734
|
+
this.Lock!.Service = this.accessory.getService(this.hap.Service.LockMechanism) as Service;
|
|
839
735
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Lock Service`);
|
|
736
|
+
accessory.removeService(this.Lock!.Service);
|
|
840
737
|
}
|
|
841
|
-
accessory.removeService(this.lockService!);
|
|
842
738
|
}
|
|
843
739
|
|
|
844
740
|
async removeFaucetService(accessory: PlatformAccessory): Promise<void> {
|
|
845
|
-
// If
|
|
846
|
-
|
|
847
|
-
|
|
741
|
+
// If Faucet.Service still present, then remove first
|
|
742
|
+
if (this.Faucet?.Service) {
|
|
743
|
+
this.Faucet!.Service = this.accessory.getService(this.hap.Service.Faucet) as Service;
|
|
848
744
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Faucet Service`);
|
|
745
|
+
accessory.removeService(this.Faucet!.Service);
|
|
849
746
|
}
|
|
850
|
-
accessory.removeService(this.faucetService!);
|
|
851
747
|
}
|
|
852
748
|
|
|
853
749
|
async removeFanService(accessory: PlatformAccessory): Promise<void> {
|
|
854
|
-
// If
|
|
855
|
-
|
|
856
|
-
|
|
750
|
+
// If Fan Service still present, then remove first
|
|
751
|
+
if (this.Fan?.Service) {
|
|
752
|
+
this.Fan!.Service = this.accessory.getService(this.hap.Service.Fan) as Service;
|
|
857
753
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Fan Service`);
|
|
754
|
+
accessory.removeService(this.Fan!.Service);
|
|
858
755
|
}
|
|
859
|
-
accessory.removeService(this.fanService!);
|
|
860
756
|
}
|
|
861
757
|
|
|
862
758
|
async removeWindowService(accessory: PlatformAccessory): Promise<void> {
|
|
863
|
-
// If
|
|
864
|
-
|
|
865
|
-
|
|
759
|
+
// If Window.Service still present, then remove first
|
|
760
|
+
if (this.Window?.Service) {
|
|
761
|
+
this.Window!.Service = this.accessory.getService(this.hap.Service.Window) as Service;
|
|
866
762
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Service`);
|
|
763
|
+
accessory.removeService(this.Window!.Service);
|
|
867
764
|
}
|
|
868
|
-
accessory.removeService(this.windowService!);
|
|
869
765
|
}
|
|
870
766
|
|
|
871
767
|
async removeWindowCoveringService(accessory: PlatformAccessory): Promise<void> {
|
|
872
|
-
// If
|
|
873
|
-
|
|
874
|
-
|
|
768
|
+
// If WindowCovering.Service still present, then remove first
|
|
769
|
+
if (this.WindowCovering?.Service) {
|
|
770
|
+
this.WindowCovering!.Service = this.accessory.getService(this.hap.Service.WindowCovering) as Service;
|
|
875
771
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Covering Service`);
|
|
772
|
+
accessory.removeService(this.WindowCovering!.Service);
|
|
876
773
|
}
|
|
877
|
-
accessory.removeService(this.windowCoveringService!);
|
|
878
774
|
}
|
|
879
775
|
|
|
880
776
|
async removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): Promise<void> {
|
|
881
|
-
// If
|
|
882
|
-
|
|
883
|
-
|
|
777
|
+
// If StatefulProgrammableSwitch.Service still present, then remove first
|
|
778
|
+
if (this.StatefulProgrammableSwitch?.Service) {
|
|
779
|
+
this.StatefulProgrammableSwitch!.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service;
|
|
884
780
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Stateful Programmable Switch Service`);
|
|
781
|
+
accessory.removeService(this.StatefulProgrammableSwitch!.Service);
|
|
885
782
|
}
|
|
886
|
-
accessory.removeService(this.statefulProgrammableSwitchService!);
|
|
887
783
|
}
|
|
888
784
|
|
|
889
785
|
async removeSwitchService(accessory: PlatformAccessory): Promise<void> {
|
|
890
|
-
// If
|
|
891
|
-
|
|
892
|
-
|
|
786
|
+
// If Switch.Service still present, then remove first
|
|
787
|
+
if (this.Switch?.Service) {
|
|
788
|
+
this.Switch!.Service = this.accessory.getService(this.hap.Service.Switch) as Service;
|
|
893
789
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Switch Service`);
|
|
790
|
+
accessory.removeService(this.Switch!.Service);
|
|
894
791
|
}
|
|
895
|
-
accessory.removeService(this.switchService!);
|
|
896
792
|
}
|
|
897
793
|
|
|
898
|
-
async
|
|
794
|
+
async getOtherConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
|
|
899
795
|
if (!device.other?.deviceType && this.accessory.context.deviceType) {
|
|
900
796
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
901
797
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
|
|
@@ -909,117 +805,4 @@ export class Others {
|
|
|
909
805
|
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} no deviceType set, using default deviceType: ${this.otherDeviceType}`);
|
|
910
806
|
}
|
|
911
807
|
}
|
|
912
|
-
|
|
913
|
-
async deviceContext() {
|
|
914
|
-
if (this.On === undefined) {
|
|
915
|
-
this.On = true;
|
|
916
|
-
} else {
|
|
917
|
-
this.On = this.accessory.context.On;
|
|
918
|
-
}
|
|
919
|
-
if (this.FirmwareRevision === undefined) {
|
|
920
|
-
this.FirmwareRevision = this.platform.version;
|
|
921
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
async deviceConfig(device: irdevice & irDevicesConfig): Promise<void> {
|
|
926
|
-
let config = {};
|
|
927
|
-
if (device.other) {
|
|
928
|
-
config = device.other;
|
|
929
|
-
}
|
|
930
|
-
if (device.logging !== undefined) {
|
|
931
|
-
config['logging'] = device.logging;
|
|
932
|
-
}
|
|
933
|
-
if (device.connectionType !== undefined) {
|
|
934
|
-
config['connectionType'] = device.connectionType;
|
|
935
|
-
}
|
|
936
|
-
if (device.external !== undefined) {
|
|
937
|
-
config['external'] = device.external;
|
|
938
|
-
}
|
|
939
|
-
if (device.customOn !== undefined) {
|
|
940
|
-
config['customOn'] = device.customOn;
|
|
941
|
-
}
|
|
942
|
-
if (device.customOff !== undefined) {
|
|
943
|
-
config['customOff'] = device.customOff;
|
|
944
|
-
}
|
|
945
|
-
if (device.customize !== undefined) {
|
|
946
|
-
config['customize'] = device.customize;
|
|
947
|
-
}
|
|
948
|
-
if (device.disablePushOn !== undefined) {
|
|
949
|
-
config['disablePushOn'] = device.disablePushOn;
|
|
950
|
-
}
|
|
951
|
-
if (device.disablePushOff !== undefined) {
|
|
952
|
-
config['disablePushOff'] = device.disablePushOff;
|
|
953
|
-
}
|
|
954
|
-
if (Object.entries(config).length !== 0) {
|
|
955
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
async deviceLogs(device: irdevice & irDevicesConfig): Promise<void> {
|
|
960
|
-
if (this.platform.debugMode) {
|
|
961
|
-
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
962
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
963
|
-
} else if (device.logging) {
|
|
964
|
-
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
965
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
966
|
-
} else if (this.platform.config.options?.logging) {
|
|
967
|
-
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
968
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
969
|
-
} else {
|
|
970
|
-
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
971
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Logging for Device
|
|
977
|
-
*/
|
|
978
|
-
infoLog(...log: any[]): void {
|
|
979
|
-
if (this.enablingDeviceLogging()) {
|
|
980
|
-
this.platform.log.info(String(...log));
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
warnLog(...log: any[]): void {
|
|
985
|
-
if (this.enablingDeviceLogging()) {
|
|
986
|
-
this.platform.log.warn(String(...log));
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
debugWarnLog(...log: any[]): void {
|
|
991
|
-
if (this.enablingDeviceLogging()) {
|
|
992
|
-
if (this.deviceLogging?.includes('debug')) {
|
|
993
|
-
this.platform.log.warn('[DEBUG]', String(...log));
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
errorLog(...log: any[]): void {
|
|
999
|
-
if (this.enablingDeviceLogging()) {
|
|
1000
|
-
this.platform.log.error(String(...log));
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
debugErrorLog(...log: any[]): void {
|
|
1005
|
-
if (this.enablingDeviceLogging()) {
|
|
1006
|
-
if (this.deviceLogging?.includes('debug')) {
|
|
1007
|
-
this.platform.log.error('[DEBUG]', String(...log));
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
debugLog(...log: any[]): void {
|
|
1013
|
-
if (this.enablingDeviceLogging()) {
|
|
1014
|
-
if (this.deviceLogging === 'debug') {
|
|
1015
|
-
this.platform.log.info('[DEBUG]', String(...log));
|
|
1016
|
-
} else {
|
|
1017
|
-
this.platform.log.debug(String(...log));
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
enablingDeviceLogging(): boolean {
|
|
1023
|
-
return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
|
|
1024
|
-
}
|
|
1025
808
|
}
|