@switchbot/homebridge-switchbot 3.5.0-beta.34 → 3.5.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +59 -43
- package/dist/device/device.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +162 -54
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/device.ts +62 -45
- package/src/platform.ts +162 -54
package/src/device/device.ts
CHANGED
|
@@ -179,91 +179,108 @@ export abstract class deviceBase {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
async getDeviceConfigSettings(device: device & devicesConfig): Promise<void> {
|
|
182
|
-
|
|
183
|
-
if (device.logging !==
|
|
184
|
-
|
|
182
|
+
const deviceConfig = {};
|
|
183
|
+
if (device.logging !== 'standard') {
|
|
184
|
+
deviceConfig['logging'] = device.logging;
|
|
185
185
|
}
|
|
186
|
-
if (device.refreshRate !==
|
|
187
|
-
|
|
186
|
+
if (device.refreshRate !== 0) {
|
|
187
|
+
deviceConfig['refreshRate'] = device.refreshRate;
|
|
188
188
|
}
|
|
189
|
-
if (device.updateRate !==
|
|
190
|
-
|
|
189
|
+
if (device.updateRate !== 0) {
|
|
190
|
+
deviceConfig['updateRate'] = device.updateRate;
|
|
191
191
|
}
|
|
192
|
-
if (device.scanDuration !==
|
|
193
|
-
|
|
192
|
+
if (device.scanDuration !== 0) {
|
|
193
|
+
deviceConfig['scanDuration'] = device.scanDuration;
|
|
194
194
|
}
|
|
195
|
-
if (device.offline
|
|
196
|
-
|
|
195
|
+
if (device.offline === true) {
|
|
196
|
+
deviceConfig['offline'] = device.offline;
|
|
197
197
|
}
|
|
198
|
-
if (device.maxRetry !== 0
|
|
199
|
-
|
|
198
|
+
if (device.maxRetry !== 0) {
|
|
199
|
+
deviceConfig['maxRetry'] = device.maxRetry;
|
|
200
200
|
}
|
|
201
201
|
if (device.webhook === true) {
|
|
202
|
-
|
|
202
|
+
deviceConfig['webhook'] = device.webhook;
|
|
203
203
|
}
|
|
204
|
-
if (device.connectionType) {
|
|
205
|
-
|
|
204
|
+
if (device.connectionType !== '') {
|
|
205
|
+
deviceConfig['connectionType'] = device.connectionType;
|
|
206
206
|
}
|
|
207
|
-
if (device.external
|
|
208
|
-
|
|
207
|
+
if (device.external === true) {
|
|
208
|
+
deviceConfig['external'] = device.external;
|
|
209
209
|
}
|
|
210
|
-
if (device.mqttURL !==
|
|
211
|
-
|
|
210
|
+
if (device.mqttURL !== '') {
|
|
211
|
+
deviceConfig['mqttURL'] = device.mqttURL;
|
|
212
212
|
}
|
|
213
|
-
if (device.maxRetries !==
|
|
214
|
-
|
|
213
|
+
if (device.maxRetries !== 0) {
|
|
214
|
+
deviceConfig['maxRetries'] = device.maxRetries;
|
|
215
215
|
}
|
|
216
|
-
if (device.delayBetweenRetries !==
|
|
217
|
-
|
|
216
|
+
if (device.delayBetweenRetries !== 0) {
|
|
217
|
+
deviceConfig['delayBetweenRetries'] = device.delayBetweenRetries;
|
|
218
218
|
}
|
|
219
|
+
let botConfig = {};
|
|
219
220
|
if (device.bot) {
|
|
220
|
-
|
|
221
|
+
botConfig = device.bot;
|
|
221
222
|
}
|
|
223
|
+
let lockConfig = {};
|
|
222
224
|
if (device.lock) {
|
|
223
|
-
|
|
225
|
+
lockConfig = device.lock;
|
|
224
226
|
}
|
|
227
|
+
let ceilinglightConfig = {};
|
|
225
228
|
if (device.ceilinglight) {
|
|
226
|
-
|
|
229
|
+
ceilinglightConfig = device.ceilinglight;
|
|
227
230
|
}
|
|
231
|
+
let colorbulbConfig = {};
|
|
228
232
|
if (device.colorbulb) {
|
|
229
|
-
|
|
233
|
+
colorbulbConfig = device.colorbulb;
|
|
230
234
|
}
|
|
235
|
+
let contactConfig = {};
|
|
231
236
|
if (device.contact) {
|
|
232
|
-
|
|
237
|
+
contactConfig = device.contact;
|
|
233
238
|
}
|
|
239
|
+
let motionConfig = {};
|
|
234
240
|
if (device.motion) {
|
|
235
|
-
|
|
241
|
+
motionConfig = device.motion;
|
|
236
242
|
}
|
|
243
|
+
let curtainConfig = {};
|
|
237
244
|
if (device.curtain) {
|
|
238
|
-
|
|
245
|
+
curtainConfig = device.curtain;
|
|
239
246
|
}
|
|
247
|
+
let hubConfig = {};
|
|
240
248
|
if (device.hub) {
|
|
241
|
-
|
|
249
|
+
hubConfig = device.hub;
|
|
242
250
|
}
|
|
251
|
+
let waterdetectorConfig = {};
|
|
243
252
|
if (device.waterdetector) {
|
|
244
|
-
|
|
253
|
+
waterdetectorConfig = device.waterdetector;
|
|
245
254
|
}
|
|
255
|
+
let humidifierConfig = {};
|
|
246
256
|
if (device.humidifier) {
|
|
247
|
-
|
|
257
|
+
humidifierConfig = device.humidifier;
|
|
248
258
|
}
|
|
259
|
+
let meterConfig = {};
|
|
249
260
|
if (device.meter) {
|
|
250
|
-
|
|
261
|
+
meterConfig = device.meter;
|
|
251
262
|
}
|
|
263
|
+
let iosensorConfig = {};
|
|
264
|
+
if (device.iosensor) {
|
|
265
|
+
iosensorConfig = device.iosensor;
|
|
266
|
+
}
|
|
267
|
+
let striplightConfig = {};
|
|
252
268
|
if (device.striplight) {
|
|
253
|
-
|
|
269
|
+
striplightConfig = device.striplight;
|
|
254
270
|
}
|
|
271
|
+
let plugConfig = {};
|
|
255
272
|
if (device.plug) {
|
|
256
|
-
|
|
273
|
+
plugConfig = device.plug;
|
|
257
274
|
}
|
|
275
|
+
let blindTiltConfig = {};
|
|
258
276
|
if (device.blindTilt) {
|
|
259
277
|
if (device.blindTilt?.mode === undefined) {
|
|
260
|
-
|
|
261
|
-
} else {
|
|
262
|
-
config['mode'] = device.blindTilt?.mode;
|
|
263
|
-
|
|
264
|
-
config = device.blindTilt;
|
|
278
|
+
blindTiltConfig['mode'] = BlindTiltMappingMode.OnlyUp;
|
|
265
279
|
}
|
|
280
|
+
blindTiltConfig = device.blindTilt;
|
|
266
281
|
}
|
|
282
|
+
const config = Object.assign({}, deviceConfig, botConfig, curtainConfig, waterdetectorConfig, striplightConfig, plugConfig, iosensorConfig,
|
|
283
|
+
meterConfig, humidifierConfig, hubConfig, lockConfig, ceilinglightConfig, colorbulbConfig, contactConfig, motionConfig, blindTiltConfig);
|
|
267
284
|
if (Object.entries(config).length !== 0) {
|
|
268
285
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
269
286
|
}
|
|
@@ -531,9 +548,9 @@ export abstract class deviceBase {
|
|
|
531
548
|
|
|
532
549
|
if (device.firmware) {
|
|
533
550
|
accessory.context.FirmwareRevision = device.firmware;
|
|
534
|
-
} else if (
|
|
551
|
+
} else if (device.firmware === undefined && device.version === undefined && accessory.context.FirmwareRevision === undefined) {
|
|
535
552
|
device.version = this.platform.version;
|
|
536
|
-
accessory.context.FirmwareRevision =
|
|
553
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
537
554
|
} else {
|
|
538
555
|
accessory.context.FirmwareRevision = device.version;
|
|
539
556
|
}
|
|
@@ -613,7 +630,7 @@ export abstract class deviceBase {
|
|
|
613
630
|
break;
|
|
614
631
|
default:
|
|
615
632
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: `
|
|
616
|
-
|
|
633
|
+
+ `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
617
634
|
}
|
|
618
635
|
}
|
|
619
636
|
|