@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
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
export class irdeviceBase {
|
|
2
|
+
platform;
|
|
3
|
+
accessory;
|
|
4
|
+
device;
|
|
5
|
+
api;
|
|
6
|
+
log;
|
|
7
|
+
config;
|
|
8
|
+
hap;
|
|
9
|
+
// Config
|
|
10
|
+
deviceLogging;
|
|
11
|
+
disablePushOn;
|
|
12
|
+
disablePushOff;
|
|
13
|
+
disablePushDetail;
|
|
14
|
+
constructor(platform, accessory, device) {
|
|
15
|
+
this.platform = platform;
|
|
16
|
+
this.accessory = accessory;
|
|
17
|
+
this.device = device;
|
|
18
|
+
this.api = this.platform.api;
|
|
19
|
+
this.log = this.platform.log;
|
|
20
|
+
this.config = this.platform.config;
|
|
21
|
+
this.hap = this.api.hap;
|
|
22
|
+
this.getDeviceLogSettings(device);
|
|
23
|
+
this.getDeviceConfigSettings(device);
|
|
24
|
+
this.getDeviceContext(accessory, device);
|
|
25
|
+
this.disablePushOnChanges(device);
|
|
26
|
+
this.disablePushOffChanges(device);
|
|
27
|
+
// Set accessory information
|
|
28
|
+
accessory
|
|
29
|
+
.getService(this.hap.Service.AccessoryInformation)
|
|
30
|
+
.setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
|
|
31
|
+
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
32
|
+
.setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.context.name)
|
|
33
|
+
.setCharacteristic(this.hap.Characteristic.Model, accessory.context.model)
|
|
34
|
+
.setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId)
|
|
35
|
+
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.firmware)
|
|
36
|
+
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
37
|
+
.updateValue(accessory.context.firmware);
|
|
38
|
+
}
|
|
39
|
+
async getDeviceLogSettings(device) {
|
|
40
|
+
if (this.platform.debugMode) {
|
|
41
|
+
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
42
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
43
|
+
}
|
|
44
|
+
else if (device.logging) {
|
|
45
|
+
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
46
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
47
|
+
}
|
|
48
|
+
else if (this.config.logging) {
|
|
49
|
+
this.deviceLogging = this.accessory.context.logging = this.config.logging;
|
|
50
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
54
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async getDeviceConfigSettings(device) {
|
|
58
|
+
const deviceConfig = {};
|
|
59
|
+
if (device.logging !== 'standard') {
|
|
60
|
+
deviceConfig['logging'] = device.logging;
|
|
61
|
+
}
|
|
62
|
+
if (device.connectionType !== '') {
|
|
63
|
+
deviceConfig['connectionType'] = device.connectionType;
|
|
64
|
+
}
|
|
65
|
+
if (device.external === true) {
|
|
66
|
+
deviceConfig['external'] = device.external;
|
|
67
|
+
}
|
|
68
|
+
if (device.customize === true) {
|
|
69
|
+
deviceConfig['customize'] = device.customize;
|
|
70
|
+
}
|
|
71
|
+
if (device.commandType !== '') {
|
|
72
|
+
deviceConfig['commandType'] = device.commandType;
|
|
73
|
+
}
|
|
74
|
+
if (device.customOn !== '') {
|
|
75
|
+
deviceConfig['customOn'] = device.customOn;
|
|
76
|
+
}
|
|
77
|
+
if (device.customOff !== '') {
|
|
78
|
+
deviceConfig['customOff'] = device.customOff;
|
|
79
|
+
}
|
|
80
|
+
if (device.disablePushOn === true) {
|
|
81
|
+
deviceConfig['disablePushOn'] = device.disablePushOn;
|
|
82
|
+
}
|
|
83
|
+
if (device.disablePushOff === true) {
|
|
84
|
+
deviceConfig['disablePushOff'] = device.disablePushOff;
|
|
85
|
+
}
|
|
86
|
+
if (device.disablePushDetail === true) {
|
|
87
|
+
deviceConfig['disablePushDetail'] = device.disablePushDetail;
|
|
88
|
+
}
|
|
89
|
+
let irairConfig = {};
|
|
90
|
+
if (device.irair) {
|
|
91
|
+
irairConfig = device.irair;
|
|
92
|
+
}
|
|
93
|
+
let irpurConfig = {};
|
|
94
|
+
if (device.irpur) {
|
|
95
|
+
irpurConfig = device.irpur;
|
|
96
|
+
}
|
|
97
|
+
let ircamConfig = {};
|
|
98
|
+
if (device.ircam) {
|
|
99
|
+
ircamConfig = device.ircam;
|
|
100
|
+
}
|
|
101
|
+
let irfanConfig = {};
|
|
102
|
+
if (device.irfan) {
|
|
103
|
+
irfanConfig = device.irfan;
|
|
104
|
+
}
|
|
105
|
+
let irlightConfig = {};
|
|
106
|
+
if (device.irlight) {
|
|
107
|
+
irlightConfig = device.irlight;
|
|
108
|
+
}
|
|
109
|
+
let otherConfig = {};
|
|
110
|
+
if (device.other) {
|
|
111
|
+
otherConfig = device.other;
|
|
112
|
+
}
|
|
113
|
+
let irtvConfig = {};
|
|
114
|
+
if (device.irtv) {
|
|
115
|
+
irtvConfig = device.irtv;
|
|
116
|
+
}
|
|
117
|
+
let irvcConfig = {};
|
|
118
|
+
if (device.irvc) {
|
|
119
|
+
irvcConfig = device.irvc;
|
|
120
|
+
}
|
|
121
|
+
let irwhConfig = {};
|
|
122
|
+
if (device.irwh) {
|
|
123
|
+
irwhConfig = device.irwh;
|
|
124
|
+
}
|
|
125
|
+
const config = Object.assign({}, deviceConfig, irairConfig, irpurConfig, ircamConfig, irfanConfig, irlightConfig, otherConfig, irtvConfig, irvcConfig, irwhConfig);
|
|
126
|
+
if (Object.entries(config).length !== 0) {
|
|
127
|
+
this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async getDeviceContext(accessory, device) {
|
|
131
|
+
accessory.context.name = device.deviceName;
|
|
132
|
+
accessory.context.model = device.remoteType;
|
|
133
|
+
accessory.context.deviceId = device.deviceId;
|
|
134
|
+
accessory.context.remoteType = device.remoteType;
|
|
135
|
+
if (device.firmware) {
|
|
136
|
+
accessory.context.firmware = device.firmware;
|
|
137
|
+
}
|
|
138
|
+
else if (device.firmware === undefined || accessory.context.firmware === undefined) {
|
|
139
|
+
device.firmware = this.platform.version;
|
|
140
|
+
accessory.context.firmware = device.firmware;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
accessory.context.firmware = 'Unknown';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async disablePushOnChanges(device) {
|
|
147
|
+
if (device.disablePushOn === undefined) {
|
|
148
|
+
this.disablePushOn = false;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.disablePushOn = device.disablePushOn;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async disablePushOffChanges(device) {
|
|
155
|
+
if (device.disablePushOff === undefined) {
|
|
156
|
+
this.disablePushOff = false;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.disablePushOff = device.disablePushOff;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async disablePushDetailChanges(device) {
|
|
163
|
+
if (device.disablePushDetail === undefined) {
|
|
164
|
+
this.disablePushDetail = false;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
this.disablePushDetail = device.disablePushDetail;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async commandType() {
|
|
171
|
+
let commandType;
|
|
172
|
+
if (this.device.commandType && this.device.customize) {
|
|
173
|
+
commandType = this.device.commandType;
|
|
174
|
+
}
|
|
175
|
+
else if (this.device.customize) {
|
|
176
|
+
commandType = 'customize';
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
commandType = 'command';
|
|
180
|
+
}
|
|
181
|
+
return commandType;
|
|
182
|
+
}
|
|
183
|
+
async commandOn() {
|
|
184
|
+
let command;
|
|
185
|
+
if (this.device.customize && this.device.customOn) {
|
|
186
|
+
command = this.device.customOn;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
command = 'turnOn';
|
|
190
|
+
}
|
|
191
|
+
return command;
|
|
192
|
+
}
|
|
193
|
+
async commandOff() {
|
|
194
|
+
let command;
|
|
195
|
+
if (this.device.customize && this.device.customOff) {
|
|
196
|
+
command = this.device.customOff;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
command = 'turnOff';
|
|
200
|
+
}
|
|
201
|
+
return command;
|
|
202
|
+
}
|
|
203
|
+
async statusCode(statusCode) {
|
|
204
|
+
switch (statusCode) {
|
|
205
|
+
case 151:
|
|
206
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
|
|
207
|
+
break;
|
|
208
|
+
case 152:
|
|
209
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
|
|
210
|
+
break;
|
|
211
|
+
case 160:
|
|
212
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
|
|
213
|
+
break;
|
|
214
|
+
case 161:
|
|
215
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
|
|
216
|
+
break;
|
|
217
|
+
case 171:
|
|
218
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
219
|
+
`Hub: ${this.device.hubDeviceId}`);
|
|
220
|
+
break;
|
|
221
|
+
case 190:
|
|
222
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with` +
|
|
223
|
+
` server, Or command format is invalid, statusCode: ${statusCode}`);
|
|
224
|
+
break;
|
|
225
|
+
case 100:
|
|
226
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
|
|
227
|
+
break;
|
|
228
|
+
case 200:
|
|
229
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
230
|
+
break;
|
|
231
|
+
case 400:
|
|
232
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
|
|
233
|
+
+ `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
|
|
234
|
+
break;
|
|
235
|
+
case 401:
|
|
236
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
|
|
237
|
+
+ `but the request has not been authenticated, statusCode: ${statusCode}`);
|
|
238
|
+
break;
|
|
239
|
+
case 403:
|
|
240
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
|
|
241
|
+
+ `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
|
|
242
|
+
break;
|
|
243
|
+
case 404:
|
|
244
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
|
|
245
|
+
+ `statusCode: ${statusCode}`);
|
|
246
|
+
break;
|
|
247
|
+
case 406:
|
|
248
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
|
|
249
|
+
+ `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
|
|
250
|
+
break;
|
|
251
|
+
case 415:
|
|
252
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
|
|
253
|
+
+ `header that is not supported by the server, statusCode: ${statusCode}`);
|
|
254
|
+
break;
|
|
255
|
+
case 422:
|
|
256
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, `
|
|
257
|
+
+ `but the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
|
|
258
|
+
break;
|
|
259
|
+
case 429:
|
|
260
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
|
|
261
|
+
+ `requests allowed for a given time window, statusCode: ${statusCode}`);
|
|
262
|
+
break;
|
|
263
|
+
case 500:
|
|
264
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
|
|
265
|
+
+ `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: `
|
|
269
|
+
+ `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Logging for Device
|
|
274
|
+
*/
|
|
275
|
+
infoLog(...log) {
|
|
276
|
+
if (this.enablingDeviceLogging()) {
|
|
277
|
+
this.log.info(String(...log));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
successLog(...log) {
|
|
281
|
+
if (this.enablingDeviceLogging()) {
|
|
282
|
+
this.platform.log.success(String(...log));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
debugSuccessLog(...log) {
|
|
286
|
+
if (this.enablingDeviceLogging()) {
|
|
287
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
288
|
+
this.log.success('[DEBUG]', String(...log));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
warnLog(...log) {
|
|
293
|
+
if (this.enablingDeviceLogging()) {
|
|
294
|
+
this.log.warn(String(...log));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
debugWarnLog(...log) {
|
|
298
|
+
if (this.enablingDeviceLogging()) {
|
|
299
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
300
|
+
this.log.warn('[DEBUG]', String(...log));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
errorLog(...log) {
|
|
305
|
+
if (this.enablingDeviceLogging()) {
|
|
306
|
+
this.log.error(String(...log));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
debugErrorLog(...log) {
|
|
310
|
+
if (this.enablingDeviceLogging()) {
|
|
311
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
312
|
+
this.log.error('[DEBUG]', String(...log));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
debugLog(...log) {
|
|
317
|
+
if (this.enablingDeviceLogging()) {
|
|
318
|
+
if (this.deviceLogging === 'debug') {
|
|
319
|
+
this.log.info('[DEBUG]', String(...log));
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
this.log.debug(String(...log));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
enablingDeviceLogging() {
|
|
327
|
+
return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=irdevice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irdevice.js","sourceRoot":"","sources":["../../src/irdevice/irdevice.ts"],"names":[],"mappings":"AAQA,MAAM,OAAgB,YAAY;IAaX;IACT;IACA;IAdI,GAAG,CAAM;IACT,GAAG,CAAU;IACb,MAAM,CAA2B;IAC9B,GAAG,CAAM;IAE5B,SAAS;IACC,aAAa,CAAU;IACvB,aAAa,CAAW;IACxB,cAAc,CAAW;IACzB,iBAAiB,CAAW;IAEtC,YACqB,QAA2B,EACpC,SAA4B,EAC5B,MAAkC;QAFzB,aAAQ,GAAR,QAAQ,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAmB;QAC5B,WAAM,GAAN,MAAM,CAA4B;QAE5C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,G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SwitchBotPlatform } from '../platform.js';
|
|
3
|
-
import { irDevicesConfig, irdevice
|
|
1
|
+
import { irdeviceBase } from './irdevice.js';
|
|
2
|
+
import type { SwitchBotPlatform } from '../platform.js';
|
|
3
|
+
import type { irDevicesConfig, irdevice } from '../settings.js';
|
|
4
|
+
import type { CharacteristicValue, PlatformAccessory } from 'homebridge';
|
|
4
5
|
/**
|
|
5
6
|
* Platform Accessory
|
|
6
7
|
* An instance of this class is created for each accessory your platform registers
|
|
7
8
|
* Each accessory may expose multiple services of different service types.
|
|
8
9
|
*/
|
|
9
|
-
export declare class Light {
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly log: Logging;
|
|
15
|
-
readonly config: SwitchBotPlatformConfig;
|
|
16
|
-
protected readonly hap: HAP;
|
|
17
|
-
lightBulbService?: Service;
|
|
18
|
-
ProgrammableSwitchServiceOn?: Service;
|
|
19
|
-
ProgrammableSwitchServiceOff?: Service;
|
|
20
|
-
On: CharacteristicValue;
|
|
21
|
-
ProgrammableSwitchEventOn?: CharacteristicValue;
|
|
22
|
-
ProgrammableSwitchOutputStateOn?: CharacteristicValue;
|
|
23
|
-
ProgrammableSwitchEventOff?: CharacteristicValue;
|
|
24
|
-
ProgrammableSwitchOutputStateOff?: CharacteristicValue;
|
|
25
|
-
FirmwareRevision: CharacteristicValue;
|
|
26
|
-
deviceLogging: string;
|
|
27
|
-
disablePushOn?: boolean;
|
|
28
|
-
disablePushOff?: boolean;
|
|
10
|
+
export declare class Light extends irdeviceBase {
|
|
11
|
+
readonly platform: SwitchBotPlatform;
|
|
12
|
+
private LightBulb?;
|
|
13
|
+
private ProgrammableSwitchOn?;
|
|
14
|
+
private ProgrammableSwitchOff?;
|
|
29
15
|
constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: irdevice & irDevicesConfig);
|
|
30
16
|
OnSet(value: CharacteristicValue): Promise<void>;
|
|
31
17
|
ProgrammableSwitchOutputStateSetOn(value: CharacteristicValue): Promise<void>;
|
|
@@ -40,29 +26,10 @@ export declare class Light {
|
|
|
40
26
|
* Light - "command" "channelAdd" "default" = next channel
|
|
41
27
|
* Light - "command" "channelSub" "default" = previous channel
|
|
42
28
|
*/
|
|
43
|
-
pushLightOnChanges(): Promise<void>;
|
|
44
|
-
pushLightOffChanges(): Promise<void>;
|
|
45
|
-
pushChanges(bodyChange: any): Promise<void>;
|
|
29
|
+
pushLightOnChanges(On: boolean): Promise<void>;
|
|
30
|
+
pushLightOffChanges(On: boolean): Promise<void>;
|
|
31
|
+
pushChanges(bodyChange: any, On: boolean): Promise<void>;
|
|
46
32
|
updateHomeKitCharacteristics(): Promise<void>;
|
|
47
|
-
disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void>;
|
|
48
|
-
disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void>;
|
|
49
|
-
commandType(): Promise<string>;
|
|
50
|
-
commandOn(): Promise<string>;
|
|
51
|
-
commandOff(): Promise<string>;
|
|
52
|
-
statusCode(statusCode: number): Promise<void>;
|
|
53
33
|
apiError(e: any): Promise<void>;
|
|
54
|
-
deviceContext(): Promise<void>;
|
|
55
|
-
deviceConfig(device: irdevice & irDevicesConfig): Promise<void>;
|
|
56
|
-
deviceLogs(device: irdevice & irDevicesConfig): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Logging for Device
|
|
59
|
-
*/
|
|
60
|
-
infoLog(...log: any[]): void;
|
|
61
|
-
warnLog(...log: any[]): void;
|
|
62
|
-
debugWarnLog(...log: any[]): void;
|
|
63
|
-
errorLog(...log: any[]): void;
|
|
64
|
-
debugErrorLog(...log: any[]): void;
|
|
65
|
-
debugLog(...log: any[]): void;
|
|
66
|
-
enablingDeviceLogging(): boolean;
|
|
67
34
|
}
|
|
68
35
|
//# sourceMappingURL=light.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/irdevice/light.ts"],"names":[],"mapp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