@switchbot/homebridge-switchbot 2.8.0-beta.0 → 2.8.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +1 -1
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +10 -0
- package/config.schema.json +8 -0
- package/dist/device/blindtilt.d.ts +1 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +58 -65
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +52 -55
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -0
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +68 -68
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +76 -75
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -0
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +67 -59
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +81 -94
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +9 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +197 -30
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +58 -62
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -0
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +28 -26
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -0
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +68 -67
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +51 -47
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +5 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +75 -74
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +4 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +74 -74
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +2 -0
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +66 -54
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +39 -39
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -0
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +74 -53
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +64 -66
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +32 -34
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +20 -23
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -2
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +30 -32
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +26 -29
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +22 -23
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +2 -2
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +47 -50
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +20 -23
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +22 -23
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +46 -44
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +114 -78
- package/src/device/bot.ts +102 -63
- package/src/device/ceilinglight.ts +113 -73
- package/src/device/colorbulb.ts +144 -87
- package/src/device/contact.ts +98 -63
- package/src/device/curtain.ts +160 -134
- package/src/device/hub.ts +228 -39
- package/src/device/humidifier.ts +136 -85
- package/src/device/iosensor.ts +52 -32
- package/src/device/lightstrip.ts +118 -72
- package/src/device/lock.ts +85 -50
- package/src/device/meter.ts +104 -80
- package/src/device/meterplus.ts +103 -80
- package/src/device/motion.ts +95 -59
- package/src/device/plug.ts +70 -44
- package/src/device/robotvacuumcleaner.ts +107 -56
- package/src/irdevice/airconditioner.ts +116 -86
- package/src/irdevice/airpurifier.ts +60 -39
- package/src/irdevice/camera.ts +40 -28
- package/src/irdevice/fan.ts +52 -38
- package/src/irdevice/light.ts +48 -34
- package/src/irdevice/other.ts +44 -28
- package/src/irdevice/tv.ts +70 -56
- package/src/irdevice/vacuumcleaner.ts +40 -28
- package/src/irdevice/waterheater.ts +48 -32
- package/src/platform.ts +87 -56
- package/src/settings.ts +41 -40
- package/src/utils.ts +1 -1
package/.prettierrc
CHANGED
package/.vscode/settings.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
10
|
},
|
|
11
11
|
"[typescript]": {
|
|
12
|
-
"editor.defaultFormatter": "
|
|
12
|
+
"editor.defaultFormatter": "vscode.typescript-language-features"
|
|
13
13
|
},
|
|
14
14
|
"typescript.format.enable": true,
|
|
15
15
|
"editor.rulers": [
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
|
|
4
4
|
|
|
5
|
+
## [Version 2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.0) (2023-XX-XX)
|
|
6
|
+
|
|
7
|
+
## What's Changed
|
|
8
|
+
|
|
9
|
+
- Add Hub 2 Light-Level Support. [#776](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/776)
|
|
10
|
+
- Enable Meter Battery Level for OpenAPI, Thanks [@mrlt8](https://github.com/mrlt8) [#782](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/782)
|
|
11
|
+
- Housekeeping and updated dependencies.
|
|
12
|
+
|
|
13
|
+
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.0....v2.7.1
|
|
14
|
+
|
|
5
15
|
## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29)
|
|
6
16
|
|
|
7
17
|
## What's Changed
|
package/config.schema.json
CHANGED
|
@@ -224,6 +224,13 @@
|
|
|
224
224
|
"condition": {
|
|
225
225
|
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Hub 2') && model.options.devices[arrayIndices].deviceId);"
|
|
226
226
|
}
|
|
227
|
+
},
|
|
228
|
+
"hide_lightsensor": {
|
|
229
|
+
"title": "Hide Hub 2's Light Sensor",
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"condition": {
|
|
232
|
+
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Hub 2') && model.options.devices[arrayIndices].deviceId);"
|
|
233
|
+
}
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
},
|
|
@@ -1224,6 +1231,7 @@
|
|
|
1224
1231
|
"options.devices[].connectionType",
|
|
1225
1232
|
"options.devices[].hidHub.hide_temperature",
|
|
1226
1233
|
"options.devices[].hidHub.hide_humidity",
|
|
1234
|
+
"options.devices[].hidHub.hide_lightsensor",
|
|
1227
1235
|
"options.devices[].scanDuration",
|
|
1228
1236
|
"options.devices[].disableCaching",
|
|
1229
1237
|
"options.devices[].maxRetry",
|
|
@@ -28,6 +28,7 @@ export declare class BlindTilt {
|
|
|
28
28
|
StatusLowBattery?: CharacteristicValue;
|
|
29
29
|
CurrentHorizontalTiltAngle: CharacteristicValue;
|
|
30
30
|
TargetHorizontalTiltAngle: CharacteristicValue;
|
|
31
|
+
Version: deviceStatus['version'];
|
|
31
32
|
deviceStatus: any;
|
|
32
33
|
slidePosition: deviceStatus['slidePosition'];
|
|
33
34
|
direction: deviceStatus['direction'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blindtilt.d.ts","sourceRoot":"","sources":["../../src/device/blindtilt.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EA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,MAAM,EAAE,MAAM,CAAC;IA0D7F,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCrD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD;;OAEG;IACH,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,YAAY,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAQjC,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7B,aAAa,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAQlC,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAU7B,qBAAqB,IAAI,OAAO;CAGjC"}
|
package/dist/device/blindtilt.js
CHANGED
|
@@ -24,15 +24,15 @@ class BlindTilt {
|
|
|
24
24
|
//MQTT stuff
|
|
25
25
|
this.mqttClient = null;
|
|
26
26
|
// Connection
|
|
27
|
-
this.BLE =
|
|
28
|
-
this.OpenAPI =
|
|
27
|
+
this.BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
|
|
28
|
+
this.OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
|
|
29
29
|
// default placeholders
|
|
30
30
|
this.logs(device);
|
|
31
31
|
this.refreshRate(device);
|
|
32
32
|
this.scan(device);
|
|
33
|
-
this.config(device);
|
|
34
33
|
this.setupMqtt(device);
|
|
35
34
|
this.context();
|
|
35
|
+
this.config(device);
|
|
36
36
|
this.mappingMode = device.blindTilt?.mode ?? BlindTiltMappingMode.OnlyUp;
|
|
37
37
|
this.debugLog(`Mapping mode: ${this.mappingMode}`);
|
|
38
38
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
@@ -159,8 +159,8 @@ class BlindTilt {
|
|
|
159
159
|
}
|
|
160
160
|
catch (e) {
|
|
161
161
|
this.apiError(e);
|
|
162
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
|
|
163
|
-
|
|
162
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,` +
|
|
163
|
+
` Error Message: ${JSON.stringify(e.message)}`);
|
|
164
164
|
}
|
|
165
165
|
this.blindTiltUpdateInProgress = false;
|
|
166
166
|
});
|
|
@@ -180,8 +180,7 @@ class BlindTilt {
|
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
182
|
await this.offlineOff();
|
|
183
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
184
|
-
+ ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
183
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, parseStatus will not happen.`);
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
async BLEparseStatus() {
|
|
@@ -270,8 +269,8 @@ class BlindTilt {
|
|
|
270
269
|
this.CurrentAmbientLightLevel = this.set_maxLux;
|
|
271
270
|
this.debugLog();
|
|
272
271
|
}
|
|
273
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel},`
|
|
274
|
-
|
|
272
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel},` +
|
|
273
|
+
` CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
275
274
|
}
|
|
276
275
|
// Battery
|
|
277
276
|
this.BatteryLevel = Number(this.battery);
|
|
@@ -281,8 +280,7 @@ class BlindTilt {
|
|
|
281
280
|
else {
|
|
282
281
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
283
282
|
}
|
|
284
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
285
|
-
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
283
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` + ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
286
284
|
}
|
|
287
285
|
async openAPIparseStatus() {
|
|
288
286
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
@@ -301,7 +299,7 @@ class BlindTilt {
|
|
|
301
299
|
}
|
|
302
300
|
if (this.setNewTarget && this.moving) {
|
|
303
301
|
await this.setMinMax();
|
|
304
|
-
if (this.TargetPosition > this.CurrentPosition || (homekitTiltAngle &&
|
|
302
|
+
if (this.TargetPosition > this.CurrentPosition || (homekitTiltAngle && this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle)) {
|
|
305
303
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition} `);
|
|
306
304
|
this.PositionState = this.platform.Characteristic.PositionState.INCREASING;
|
|
307
305
|
this.windowCoveringService.getCharacteristic(this.platform.Characteristic.PositionState).updateValue(this.PositionState);
|
|
@@ -314,16 +312,14 @@ class BlindTilt {
|
|
|
314
312
|
this.debugLog(`${this.device.deviceType}: ${this.CurrentPosition} DECREASING PositionState: ${this.PositionState}`);
|
|
315
313
|
}
|
|
316
314
|
else {
|
|
317
|
-
this.debugLog(`${this.device.deviceType}: ${this.CurrentPosition} Standby because reached position,` +
|
|
318
|
-
` CurrentPosition: ${this.CurrentPosition}`);
|
|
315
|
+
this.debugLog(`${this.device.deviceType}: ${this.CurrentPosition} Standby because reached position,` + ` CurrentPosition: ${this.CurrentPosition}`);
|
|
319
316
|
this.PositionState = this.platform.Characteristic.PositionState.STOPPED;
|
|
320
317
|
this.windowCoveringService.getCharacteristic(this.platform.Characteristic.PositionState).updateValue(this.PositionState);
|
|
321
318
|
this.debugLog(`${this.device.deviceType}: ${this.CurrentPosition} STOPPED PositionState: ${this.PositionState}`);
|
|
322
319
|
}
|
|
323
320
|
}
|
|
324
321
|
else {
|
|
325
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Standby because device not moving,` +
|
|
326
|
-
` CurrentPosition: ${this.CurrentPosition}`);
|
|
322
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Standby because device not moving,` + ` CurrentPosition: ${this.CurrentPosition}`);
|
|
327
323
|
this.TargetPosition = this.CurrentPosition;
|
|
328
324
|
if (homekitTiltAngle) {
|
|
329
325
|
this.TargetHorizontalTiltAngle = this.CurrentHorizontalTiltAngle;
|
|
@@ -360,8 +356,8 @@ class BlindTilt {
|
|
|
360
356
|
}
|
|
361
357
|
else {
|
|
362
358
|
await this.offlineOff();
|
|
363
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
364
|
-
|
|
359
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` +
|
|
360
|
+
` ${this.device.connectionType}, refreshStatus will not happen.`);
|
|
365
361
|
}
|
|
366
362
|
}
|
|
367
363
|
async BLERefreshStatus() {
|
|
@@ -385,8 +381,8 @@ class BlindTilt {
|
|
|
385
381
|
// Set an event hander
|
|
386
382
|
switchbot.onadvertisement = async (ad) => {
|
|
387
383
|
this.address = ad.address;
|
|
388
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
|
|
389
|
-
|
|
384
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
385
|
+
` BLE Address Found: ${this.address}`);
|
|
390
386
|
this.serviceData = ad.serviceData;
|
|
391
387
|
this.calibration = ad.serviceData.calibration;
|
|
392
388
|
this.battery = ad.serviceData.battery;
|
|
@@ -416,8 +412,8 @@ class BlindTilt {
|
|
|
416
412
|
})
|
|
417
413
|
.catch(async (e) => {
|
|
418
414
|
this.apiError(e);
|
|
419
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
420
|
-
|
|
415
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}` +
|
|
416
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
421
417
|
await this.BLERefreshConnection(switchbot);
|
|
422
418
|
});
|
|
423
419
|
}
|
|
@@ -445,8 +441,8 @@ class BlindTilt {
|
|
|
445
441
|
}
|
|
446
442
|
catch (e) {
|
|
447
443
|
this.apiError(e);
|
|
448
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}`
|
|
449
|
-
|
|
444
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}` +
|
|
445
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
450
446
|
}
|
|
451
447
|
}
|
|
452
448
|
async pushChanges() {
|
|
@@ -461,8 +457,7 @@ class BlindTilt {
|
|
|
461
457
|
}
|
|
462
458
|
else {
|
|
463
459
|
await this.offlineOff();
|
|
464
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
|
|
465
|
-
+ ` ${this.device.connectionType}, pushChanges will not happen.`);
|
|
460
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, pushChanges will not happen.`);
|
|
466
461
|
}
|
|
467
462
|
// Refresh the status from the API
|
|
468
463
|
(0, rxjs_1.interval)(15000)
|
|
@@ -505,8 +500,8 @@ class BlindTilt {
|
|
|
505
500
|
})
|
|
506
501
|
.catch(async (e) => {
|
|
507
502
|
this.apiError(e);
|
|
508
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
509
|
-
|
|
503
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}` +
|
|
504
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
510
505
|
await this.BLEPushConnection();
|
|
511
506
|
});
|
|
512
507
|
}
|
|
@@ -541,30 +536,29 @@ class BlindTilt {
|
|
|
541
536
|
}
|
|
542
537
|
async openAPIpushChanges() {
|
|
543
538
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
|
|
544
|
-
const hasDifferentAndRelevantHorizontalTiltAngle =
|
|
545
|
-
|
|
546
|
-
if ((this.TargetPosition !== this.CurrentPosition) || hasDifferentAndRelevantHorizontalTiltAngle || this.device.disableCaching) {
|
|
539
|
+
const hasDifferentAndRelevantHorizontalTiltAngle = this.mappingMode === BlindTiltMappingMode.UseTiltForDirection && this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle;
|
|
540
|
+
if (this.TargetPosition !== this.CurrentPosition || hasDifferentAndRelevantHorizontalTiltAngle || this.device.disableCaching) {
|
|
547
541
|
const [direction, position] = this.mapHomekitValuesToDeviceValues(Number(this.TargetPosition), Number(this.TargetHorizontalTiltAngle));
|
|
548
542
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing ${this.TargetPosition} (device = ${direction};${position})`);
|
|
549
543
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Mode: ${this.Mode}`);
|
|
550
544
|
let bodyChange = '';
|
|
551
545
|
if (position === 100) {
|
|
552
546
|
bodyChange = JSON.stringify({
|
|
553
|
-
|
|
554
|
-
|
|
547
|
+
command: 'fullyOpen',
|
|
548
|
+
commandType: 'command',
|
|
555
549
|
});
|
|
556
550
|
}
|
|
557
551
|
else if (position === 0) {
|
|
558
552
|
bodyChange = JSON.stringify({
|
|
559
|
-
|
|
560
|
-
|
|
553
|
+
command: direction === 'up' ? 'closeUp' : 'closeDown',
|
|
554
|
+
commandType: 'command',
|
|
561
555
|
});
|
|
562
556
|
}
|
|
563
557
|
else {
|
|
564
558
|
bodyChange = JSON.stringify({
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
559
|
+
command: 'setPosition',
|
|
560
|
+
parameter: `${direction};${position}`,
|
|
561
|
+
commandType: 'command',
|
|
568
562
|
});
|
|
569
563
|
}
|
|
570
564
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
@@ -581,14 +575,14 @@ class BlindTilt {
|
|
|
581
575
|
}
|
|
582
576
|
catch (e) {
|
|
583
577
|
this.apiError(e);
|
|
584
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}`
|
|
585
|
-
|
|
578
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}` +
|
|
579
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`);
|
|
586
580
|
}
|
|
587
581
|
}
|
|
588
582
|
else {
|
|
589
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.`
|
|
590
|
-
|
|
591
|
-
|
|
583
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.` +
|
|
584
|
+
` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}` +
|
|
585
|
+
` CurrentHorizontalTiltAngle: ${this.CurrentHorizontalTiltAngle}, TargetPosition ${this.TargetHorizontalTiltAngle}`);
|
|
592
586
|
}
|
|
593
587
|
}
|
|
594
588
|
/**
|
|
@@ -627,23 +621,20 @@ class BlindTilt {
|
|
|
627
621
|
async startUpdatingBlindTiltIfNeeded() {
|
|
628
622
|
await this.setMinMax();
|
|
629
623
|
this.debugLog('setMinMax');
|
|
630
|
-
if (this.TargetPosition > this.CurrentPosition ||
|
|
624
|
+
if (this.TargetPosition > this.CurrentPosition || this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle) {
|
|
631
625
|
this.PositionState = this.platform.Characteristic.PositionState.INCREASING;
|
|
632
626
|
this.setNewTarget = true;
|
|
633
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` +
|
|
634
|
-
` CurrentPosition: ${this.CurrentPosition}`);
|
|
627
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` + ` CurrentPosition: ${this.CurrentPosition}`);
|
|
635
628
|
}
|
|
636
629
|
else if (this.TargetPosition < this.CurrentPosition) {
|
|
637
630
|
this.PositionState = this.platform.Characteristic.PositionState.DECREASING;
|
|
638
631
|
this.setNewTarget = true;
|
|
639
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` +
|
|
640
|
-
` CurrentPosition: ${this.CurrentPosition}`);
|
|
632
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` + ` CurrentPosition: ${this.CurrentPosition}`);
|
|
641
633
|
}
|
|
642
634
|
else {
|
|
643
635
|
this.PositionState = this.platform.Characteristic.PositionState.STOPPED;
|
|
644
636
|
this.setNewTarget = false;
|
|
645
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` +
|
|
646
|
-
` CurrentPosition: ${this.CurrentPosition}`);
|
|
637
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${this.CurrentPosition},` + ` CurrentPosition: ${this.CurrentPosition}`);
|
|
647
638
|
}
|
|
648
639
|
this.windowCoveringService.setCharacteristic(this.platform.Characteristic.PositionState, this.PositionState);
|
|
649
640
|
this.windowCoveringService.getCharacteristic(this.platform.Characteristic.PositionState).updateValue(this.PositionState);
|
|
@@ -720,8 +711,8 @@ class BlindTilt {
|
|
|
720
711
|
}
|
|
721
712
|
this.accessory.context.CurrentAmbientLightLevel = this.CurrentAmbientLightLevel;
|
|
722
713
|
this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
|
|
723
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
724
|
-
|
|
714
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` +
|
|
715
|
+
` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
725
716
|
}
|
|
726
717
|
}
|
|
727
718
|
if (this.BLE) {
|
|
@@ -889,8 +880,8 @@ class BlindTilt {
|
|
|
889
880
|
if (this.updateRate > device.scanDuration) {
|
|
890
881
|
this.scanDuration = this.updateRate;
|
|
891
882
|
if (this.BLE) {
|
|
892
|
-
this.warnLog(`${this.device.deviceType}: `
|
|
893
|
-
|
|
883
|
+
this.warnLog(`${this.device.deviceType}: ` +
|
|
884
|
+
`${this.accessory.displayName} scanDuration is less than updateRate, overriding scanDuration with updateRate`);
|
|
894
885
|
}
|
|
895
886
|
}
|
|
896
887
|
else {
|
|
@@ -928,8 +919,8 @@ class BlindTilt {
|
|
|
928
919
|
this.offlineOff();
|
|
929
920
|
break;
|
|
930
921
|
case 171:
|
|
931
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. `
|
|
932
|
-
|
|
922
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
923
|
+
`Hub: ${this.device.hubDeviceId}`);
|
|
933
924
|
this.offlineOff();
|
|
934
925
|
break;
|
|
935
926
|
case 190:
|
|
@@ -943,8 +934,8 @@ class BlindTilt {
|
|
|
943
934
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
944
935
|
break;
|
|
945
936
|
default:
|
|
946
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: `
|
|
947
|
-
|
|
937
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: ` +
|
|
938
|
+
`${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
948
939
|
}
|
|
949
940
|
}
|
|
950
941
|
async offlineOff() {
|
|
@@ -968,16 +959,18 @@ class BlindTilt {
|
|
|
968
959
|
}
|
|
969
960
|
FirmwareRevision(accessory, device) {
|
|
970
961
|
let FirmwareRevision;
|
|
971
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
972
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
962
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
973
963
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
974
964
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
975
|
-
if (
|
|
976
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
977
|
-
}
|
|
978
|
-
else if (device.firmware) {
|
|
965
|
+
if (device.firmware) {
|
|
979
966
|
FirmwareRevision = device.firmware;
|
|
980
967
|
}
|
|
968
|
+
else if (device.version) {
|
|
969
|
+
FirmwareRevision = JSON.stringify(device.version);
|
|
970
|
+
}
|
|
971
|
+
else if (accessory.context.FirmwareRevision) {
|
|
972
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
973
|
+
}
|
|
981
974
|
else {
|
|
982
975
|
FirmwareRevision = this.platform.version;
|
|
983
976
|
}
|
|
@@ -1170,7 +1163,7 @@ class BlindTilt {
|
|
|
1170
1163
|
config['mode'] = device.blindTilt?.mode;
|
|
1171
1164
|
}
|
|
1172
1165
|
if (Object.entries(config).length !== 0) {
|
|
1173
|
-
this.
|
|
1166
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
1174
1167
|
}
|
|
1175
1168
|
}
|
|
1176
1169
|
async logs(device) {
|