@switchbot/homebridge-switchbot 2.8.0-beta.9 → 2.8.1-beta.0

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/README.md +1 -1
  3. package/dist/device/blindtilt.d.ts +21 -22
  4. package/dist/device/blindtilt.d.ts.map +1 -1
  5. package/dist/device/blindtilt.js +78 -77
  6. package/dist/device/blindtilt.js.map +1 -1
  7. package/dist/device/bot.d.ts +11 -13
  8. package/dist/device/bot.d.ts.map +1 -1
  9. package/dist/device/bot.js +93 -75
  10. package/dist/device/bot.js.map +1 -1
  11. package/dist/device/ceilinglight.d.ts +10 -13
  12. package/dist/device/ceilinglight.d.ts.map +1 -1
  13. package/dist/device/ceilinglight.js +40 -27
  14. package/dist/device/ceilinglight.js.map +1 -1
  15. package/dist/device/colorbulb.d.ts +16 -23
  16. package/dist/device/colorbulb.d.ts.map +1 -1
  17. package/dist/device/colorbulb.js +55 -46
  18. package/dist/device/colorbulb.js.map +1 -1
  19. package/dist/device/contact.d.ts +16 -22
  20. package/dist/device/contact.d.ts.map +1 -1
  21. package/dist/device/contact.js +82 -73
  22. package/dist/device/contact.js.map +1 -1
  23. package/dist/device/curtain.d.ts +21 -24
  24. package/dist/device/curtain.d.ts.map +1 -1
  25. package/dist/device/curtain.js +76 -77
  26. package/dist/device/curtain.js.map +1 -1
  27. package/dist/device/hub.d.ts +10 -8
  28. package/dist/device/hub.d.ts.map +1 -1
  29. package/dist/device/hub.js +50 -35
  30. package/dist/device/hub.js.map +1 -1
  31. package/dist/device/humidifier.d.ts +8 -10
  32. package/dist/device/humidifier.d.ts.map +1 -1
  33. package/dist/device/humidifier.js +34 -21
  34. package/dist/device/humidifier.js.map +1 -1
  35. package/dist/device/iosensor.d.ts +16 -20
  36. package/dist/device/iosensor.d.ts.map +1 -1
  37. package/dist/device/iosensor.js +42 -29
  38. package/dist/device/iosensor.js.map +1 -1
  39. package/dist/device/lightstrip.d.ts +2 -5
  40. package/dist/device/lightstrip.d.ts.map +1 -1
  41. package/dist/device/lightstrip.js +9 -8
  42. package/dist/device/lightstrip.js.map +1 -1
  43. package/dist/device/lock.d.ts +15 -19
  44. package/dist/device/lock.d.ts.map +1 -1
  45. package/dist/device/lock.js +71 -28
  46. package/dist/device/lock.js.map +1 -1
  47. package/dist/device/meter.d.ts +5 -9
  48. package/dist/device/meter.d.ts.map +1 -1
  49. package/dist/device/meter.js +16 -20
  50. package/dist/device/meter.js.map +1 -1
  51. package/dist/device/meterplus.d.ts +6 -10
  52. package/dist/device/meterplus.d.ts.map +1 -1
  53. package/dist/device/meterplus.js +16 -20
  54. package/dist/device/meterplus.js.map +1 -1
  55. package/dist/device/motion.d.ts +6 -8
  56. package/dist/device/motion.d.ts.map +1 -1
  57. package/dist/device/motion.js +49 -47
  58. package/dist/device/motion.js.map +1 -1
  59. package/dist/device/plug.d.ts +2 -5
  60. package/dist/device/plug.d.ts.map +1 -1
  61. package/dist/device/plug.js +9 -8
  62. package/dist/device/plug.js.map +1 -1
  63. package/dist/device/robotvacuumcleaner.d.ts +6 -8
  64. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  65. package/dist/device/robotvacuumcleaner.js +20 -4
  66. package/dist/device/robotvacuumcleaner.js.map +1 -1
  67. package/dist/irdevice/airconditioner.d.ts +2 -0
  68. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  69. package/dist/irdevice/airconditioner.js +67 -86
  70. package/dist/irdevice/airconditioner.js.map +1 -1
  71. package/dist/irdevice/airpurifier.js.map +1 -1
  72. package/dist/irdevice/camera.js.map +1 -1
  73. package/dist/irdevice/fan.d.ts +0 -1
  74. package/dist/irdevice/fan.d.ts.map +1 -1
  75. package/dist/irdevice/fan.js.map +1 -1
  76. package/dist/irdevice/light.js.map +1 -1
  77. package/dist/irdevice/other.js.map +1 -1
  78. package/dist/irdevice/tv.d.ts +0 -1
  79. package/dist/irdevice/tv.d.ts.map +1 -1
  80. package/dist/irdevice/tv.js.map +1 -1
  81. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  82. package/dist/irdevice/waterheater.js.map +1 -1
  83. package/dist/platform.d.ts.map +1 -1
  84. package/dist/platform.js +64 -63
  85. package/dist/platform.js.map +1 -1
  86. package/dist/settings.d.ts +3 -1
  87. package/dist/settings.d.ts.map +1 -1
  88. package/dist/settings.js.map +1 -1
  89. package/package.json +12 -12
  90. package/src/device/blindtilt.ts +103 -100
  91. package/src/device/bot.ts +105 -89
  92. package/src/device/ceilinglight.ts +56 -46
  93. package/src/device/colorbulb.ts +78 -76
  94. package/src/device/contact.ts +100 -94
  95. package/src/device/curtain.ts +101 -101
  96. package/src/device/hub.ts +61 -43
  97. package/src/device/humidifier.ts +42 -33
  98. package/src/device/iosensor.ts +59 -50
  99. package/src/device/lightstrip.ts +14 -17
  100. package/src/device/lock.ts +91 -50
  101. package/src/device/meter.ts +22 -30
  102. package/src/device/meterplus.ts +23 -32
  103. package/src/device/motion.ts +55 -53
  104. package/src/device/plug.ts +12 -15
  105. package/src/device/robotvacuumcleaner.ts +33 -16
  106. package/src/irdevice/airconditioner.ts +80 -94
  107. package/src/irdevice/airpurifier.ts +1 -1
  108. package/src/irdevice/camera.ts +1 -1
  109. package/src/irdevice/fan.ts +1 -4
  110. package/src/irdevice/light.ts +1 -1
  111. package/src/irdevice/other.ts +1 -1
  112. package/src/irdevice/tv.ts +1 -4
  113. package/src/irdevice/vacuumcleaner.ts +1 -1
  114. package/src/irdevice/waterheater.ts +1 -1
  115. package/src/platform.ts +73 -73
  116. package/src/settings.ts +6 -2
package/CHANGELOG.md CHANGED
@@ -2,15 +2,17 @@
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)
5
+ ## [Version 2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.0) (2023-08-19)
6
6
 
7
7
  ## What's Changed
8
8
 
9
9
  - Add Hub 2 Light-Level Support. [#776](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/776)
10
10
  - Enable Meter Battery Level for OpenAPI, Thanks [@mrlt8](https://github.com/mrlt8) [#782](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/782)
11
+ - Enable Meter Plus Battery Level for OpenAPI, Thanks [@mrlt8](https://github.com/mrlt8) [#787](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/787)
12
+ - Enable Battery Level and Version for OpenAPI for BlindTilt, Bot, Ceiling Lights, Color Bulb, Contact, Curtain, Hub, Humidifier, Indoor/Outdoor Sensor, Light Strip, Lock, Meter, Meter Plus, Motion , Plug, Plug Mini, & Robot Vacuum Cleaner
11
13
  - Housekeeping and updated dependencies.
12
14
 
13
- **Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.0....v2.7.1
15
+ **Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.1....v2.8.0
14
16
 
15
17
  ## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29)
16
18
 
package/README.md CHANGED
@@ -97,7 +97,7 @@
97
97
  - Must supply `deviceId` & `deviceName` to Device Config
98
98
  - Check `Enable Bluetooth Low Energy (BLE) Connection` on Device Config
99
99
  - [SwitchBot Blind Tilt](https://us.switch-bot.com/pages/switchbot-blind-tilt)
100
- - Supports OpenAPI Connection Only
100
+ - Supports OpenAPI Connection Only
101
101
  - If using OpenAPI:
102
102
  - [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
103
103
  - Enable Cloud Services for Device on SwitchBot App
@@ -5,7 +5,7 @@ import { MqttClient } from 'mqtt';
5
5
  import { Subject } from 'rxjs';
6
6
  import { SwitchBotPlatform } from '../platform';
7
7
  import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
8
- import { device, devicesConfig, serviceData, switchbot, deviceStatus, ad } from '../settings';
8
+ import { device, devicesConfig, serviceData, deviceStatus } from '../settings';
9
9
  declare enum BlindTiltMappingMode {
10
10
  OnlyUp = "only_up",
11
11
  OnlyDown = "only_down",
@@ -17,35 +17,34 @@ export declare class BlindTilt {
17
17
  private readonly platform;
18
18
  private accessory;
19
19
  device: device & devicesConfig;
20
- windowCoveringService: Service;
20
+ batteryService: Service;
21
21
  lightSensorService?: Service;
22
- batteryService?: Service;
23
- CurrentPosition: CharacteristicValue;
22
+ windowCoveringService: Service;
23
+ BatteryLevel: CharacteristicValue;
24
24
  PositionState: CharacteristicValue;
25
25
  TargetPosition: CharacteristicValue;
26
+ CurrentPosition: CharacteristicValue;
27
+ StatusLowBattery: CharacteristicValue;
26
28
  CurrentAmbientLightLevel?: CharacteristicValue;
27
- BatteryLevel?: CharacteristicValue;
28
- StatusLowBattery?: CharacteristicValue;
29
- CurrentHorizontalTiltAngle: CharacteristicValue;
30
29
  TargetHorizontalTiltAngle: CharacteristicValue;
31
- deviceStatus: any;
32
- slidePosition: deviceStatus['slidePosition'];
33
- direction: deviceStatus['direction'];
34
- moving: deviceStatus['moving'];
35
- brightness: deviceStatus['brightness'];
36
- setPositionMode?: string | number;
30
+ CurrentHorizontalTiltAngle: CharacteristicValue;
31
+ OpenAPI_InMotion: deviceStatus['moving'];
32
+ OpenAPI_BatteryLevel: serviceData['battery'];
33
+ OpenAPI_Direction: deviceStatus['direction'];
34
+ OpenAPI_Calibration: serviceData['calibration'];
35
+ OpenAPI_CurrentPosition: serviceData['position'];
36
+ OpenAPI_FirmwareRevision: deviceStatus['version'];
37
+ OpenAPI_CurrentAmbientLightLevel: deviceStatus['brightness'];
37
38
  Mode: string;
39
+ setPositionMode?: string | number;
38
40
  mappingMode: BlindTiltMappingMode;
39
- connected?: boolean;
40
- switchbot: switchbot;
41
- serviceData: serviceData;
41
+ BLE_InMotion: serviceData['inMotion'];
42
+ BLE_BatteryLevel: serviceData['battery'];
43
+ BLE_Calibration: serviceData['calibration'];
44
+ BLE_CurrentPosition: serviceData['position'];
45
+ BLE_CurrentAmbientLightLevel: serviceData['lightLevel'];
46
+ BLE_IsConnected?: boolean;
42
47
  spaceBetweenLevels: number;
43
- address: ad['address'];
44
- calibration: serviceData['calibration'];
45
- battery: serviceData['battery'];
46
- position: serviceData['position'];
47
- inMotion: serviceData['inMotion'];
48
- lightLevel: serviceData['lightLevel'];
49
48
  setNewTarget: boolean;
50
49
  setNewTargetTimer: NodeJS.Timeout;
51
50
  mqttClient: MqttClient | null;
@@ -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,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAW,MAAM,aAAa,CAAC;AAEvG,aAAK,oBAAoB;IACvB,MAAM,YAAY;IAClB,QAAQ,cAAc;IACtB,SAAS,gBAAgB;IACzB,SAAS,gBAAgB;IACzB,mBAAmB,2BAA2B;CAC/C;AAED,qBAAa,SAAS;IAmElB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,SAAS;IACV,MAAM,EAAE,MAAM,GAAG,aAAa;IAnEvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC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CAAC,SAAS,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,mBAAmB;IAmBtG,OAAO;IAoBb;;;;;;OAMG;IACH,8BAA8B,CAAC,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IAgD5H;;;;;;OAMG;IACH,8BAA8B,CAAC,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC,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"}
@@ -112,22 +112,11 @@ class BlindTilt {
112
112
  })
113
113
  .onSet(this.TargetHorizontalTiltAngleSet.bind(this));
114
114
  // Battery Service
115
- if (!this.BLE) {
116
- this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Battery Service`);
117
- this.batteryService = this.accessory.getService(this.platform.Service.Battery);
118
- accessory.removeService(this.batteryService);
119
- }
120
- else if (this.BLE && !this.batteryService) {
121
- this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Battery Service`);
122
- (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || this.accessory.addService(this.platform.Service.Battery)),
123
- `${accessory.displayName} Battery`;
124
- this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
125
- if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
126
- this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
127
- }
128
- }
129
- else {
130
- this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Battery Service Not Added`);
115
+ (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)),
116
+ `${accessory.displayName} Battery`;
117
+ this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
118
+ if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
119
+ this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
131
120
  }
132
121
  // Update Homekit
133
122
  this.updateHomeKitCharacteristics();
@@ -186,13 +175,13 @@ class BlindTilt {
186
175
  async BLEparseStatus() {
187
176
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
188
177
  // CurrentPosition
189
- this.CurrentPosition = 100 - Number(this.position);
178
+ this.CurrentPosition = 100 - Number(this.BLE_CurrentPosition);
190
179
  await this.setMinMax();
191
180
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentPosition ${this.CurrentPosition}`);
192
181
  if (this.setNewTarget) {
193
182
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Checking Status ...`);
194
183
  }
195
- if (this.setNewTarget && this.inMotion) {
184
+ if (this.setNewTarget && this.BLE_InMotion) {
196
185
  await this.setMinMax();
197
186
  if (Number(this.TargetPosition) > this.CurrentPosition) {
198
187
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition}`);
@@ -226,54 +215,54 @@ class BlindTilt {
226
215
  this.set_maxLux = this.maxLux();
227
216
  this.spaceBetweenLevels = 9;
228
217
  // Brightness
229
- switch (this.lightLevel) {
218
+ switch (this.BLE_CurrentAmbientLightLevel) {
230
219
  case 1:
231
220
  this.CurrentAmbientLightLevel = this.set_minLux;
232
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
221
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
233
222
  break;
234
223
  case 2:
235
224
  this.CurrentAmbientLightLevel = (this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels;
236
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel},` +
225
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel},` +
237
226
  ` Calculation: ${(this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels}`);
238
227
  break;
239
228
  case 3:
240
229
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 2;
241
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
230
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
242
231
  break;
243
232
  case 4:
244
233
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 3;
245
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
234
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
246
235
  break;
247
236
  case 5:
248
237
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 4;
249
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
238
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
250
239
  break;
251
240
  case 6:
252
241
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 5;
253
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
242
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
254
243
  break;
255
244
  case 7:
256
245
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 6;
257
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
246
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
258
247
  break;
259
248
  case 8:
260
249
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 7;
261
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
250
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
262
251
  break;
263
252
  case 9:
264
253
  this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 8;
265
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
254
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
266
255
  break;
267
256
  case 10:
268
257
  default:
269
258
  this.CurrentAmbientLightLevel = this.set_maxLux;
270
259
  this.debugLog();
271
260
  }
272
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.lightLevel},` +
261
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel},` +
273
262
  ` CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
274
263
  }
275
264
  // Battery
276
- this.BatteryLevel = Number(this.battery);
265
+ this.BatteryLevel = Number(this.BLE_BatteryLevel);
277
266
  if (this.BatteryLevel < 10) {
278
267
  this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
279
268
  }
@@ -284,8 +273,8 @@ class BlindTilt {
284
273
  }
285
274
  async openAPIparseStatus() {
286
275
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
287
- const [homekitPosition, homekitTiltAngle] = this.mapDeviceValuesToHomekitValues(Number(this.slidePosition), String(this.direction));
288
- this.debugLog(` device: ${this.slidePosition} => HK: ${homekitPosition}`);
276
+ const [homekitPosition, homekitTiltAngle] = this.mapDeviceValuesToHomekitValues(Number(this.OpenAPI_CurrentPosition), String(this.OpenAPI_Direction));
277
+ this.debugLog(` device: ${this.OpenAPI_CurrentPosition} => HK: ${homekitPosition}`);
289
278
  this.CurrentPosition = homekitPosition;
290
279
  // CurrentPosition
291
280
  await this.setMinMax();
@@ -297,7 +286,7 @@ class BlindTilt {
297
286
  if (this.setNewTarget) {
298
287
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Checking Status ...`);
299
288
  }
300
- if (this.setNewTarget && this.moving) {
289
+ if (this.setNewTarget && this.OpenAPI_InMotion) {
301
290
  await this.setMinMax();
302
291
  if (this.TargetPosition > this.CurrentPosition || (homekitTiltAngle && this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle)) {
303
292
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition} `);
@@ -333,7 +322,7 @@ class BlindTilt {
333
322
  this.set_minLux = this.minLux();
334
323
  this.set_maxLux = this.maxLux();
335
324
  // Brightness
336
- switch (this.brightness) {
325
+ switch (this.OpenAPI_CurrentAmbientLightLevel) {
337
326
  case 'dim':
338
327
  this.CurrentAmbientLightLevel = this.set_minLux;
339
328
  break;
@@ -380,27 +369,25 @@ class BlindTilt {
380
369
  .then(async () => {
381
370
  // Set an event hander
382
371
  switchbot.onadvertisement = async (ad) => {
383
- this.address = ad.address;
384
372
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
385
- ` BLE Address Found: ${this.address}`);
386
- this.serviceData = ad.serviceData;
387
- this.calibration = ad.serviceData.calibration;
388
- this.battery = ad.serviceData.battery;
389
- this.inMotion = ad.serviceData.inMotion;
390
- this.position = ad.serviceData.position;
391
- this.lightLevel = ad.serviceData.lightLevel;
373
+ ` BLE Address Found: ${ad.address}`);
374
+ this.BLE_Calibration = ad.serviceData.calibration;
375
+ this.BLE_BatteryLevel = ad.serviceData.battery;
376
+ this.BLE_InMotion = ad.serviceData.inMotion;
377
+ this.BLE_CurrentPosition = ad.serviceData.position;
378
+ this.BLE_CurrentAmbientLightLevel = ad.serviceData.lightLevel;
392
379
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
393
380
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} calibration: ${ad.serviceData.calibration}, ` +
394
381
  `position: ${ad.serviceData.position}, lightLevel: ${ad.serviceData.lightLevel}, battery: ${ad.serviceData.battery}, ` +
395
382
  `inMotion: ${ad.serviceData.inMotion}`);
396
- if (this.serviceData) {
397
- this.connected = true;
398
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.connected}`);
383
+ if (ad.serviceData) {
384
+ this.BLE_IsConnected = true;
385
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
399
386
  await this.stopScanning(switchbot);
400
387
  }
401
388
  else {
402
- this.connected = false;
403
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.connected}`);
389
+ this.BLE_IsConnected = false;
390
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
404
391
  }
405
392
  };
406
393
  // Wait
@@ -432,10 +419,12 @@ class BlindTilt {
432
419
  this.statusCode(statusCode);
433
420
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
434
421
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
435
- this.slidePosition = deviceStatus.body.slidePosition;
436
- this.direction = deviceStatus.body.direction;
437
- this.moving = deviceStatus.body.moving;
438
- this.brightness = deviceStatus.body.brightness;
422
+ this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
423
+ this.OpenAPI_Direction = deviceStatus.body.direction;
424
+ this.OpenAPI_InMotion = deviceStatus.body.moving;
425
+ this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
426
+ this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
427
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
439
428
  this.openAPIparseStatus();
440
429
  this.updateHomeKitCharacteristics();
441
430
  }
@@ -715,29 +704,38 @@ class BlindTilt {
715
704
  ` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
716
705
  }
717
706
  }
718
- if (this.BLE) {
719
- if (this.BatteryLevel === undefined) {
720
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
721
- }
722
- else {
723
- if (this.device.mqttURL) {
724
- this.mqttPublish('BatteryLevel', this.BatteryLevel);
725
- }
726
- this.accessory.context.BatteryLevel = this.BatteryLevel;
727
- this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
728
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
729
- }
730
- if (this.StatusLowBattery === undefined) {
731
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
707
+ if (this.BatteryLevel === undefined) {
708
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
709
+ }
710
+ else {
711
+ if (this.device.mqttURL) {
712
+ this.mqttPublish('BatteryLevel', this.BatteryLevel);
732
713
  }
733
- else {
734
- if (this.device.mqttURL) {
735
- this.mqttPublish('StatusLowBattery', this.StatusLowBattery);
736
- }
737
- this.accessory.context.StatusLowBattery = this.StatusLowBattery;
738
- this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
739
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
714
+ this.accessory.context.BatteryLevel = this.BatteryLevel;
715
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
716
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
717
+ }
718
+ if (this.StatusLowBattery === undefined) {
719
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
720
+ }
721
+ else {
722
+ if (this.device.mqttURL) {
723
+ this.mqttPublish('StatusLowBattery', this.StatusLowBattery);
740
724
  }
725
+ this.accessory.context.StatusLowBattery = this.StatusLowBattery;
726
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
727
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
728
+ }
729
+ // FirmwareRevision
730
+ if (this.OpenAPI_FirmwareRevision === undefined) {
731
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
732
+ }
733
+ else {
734
+ this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
735
+ this.accessory.getService(this.platform.Service.AccessoryInformation)
736
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
737
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
738
+ + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
741
739
  }
742
740
  }
743
741
  /*
@@ -773,7 +771,7 @@ class BlindTilt {
773
771
  }
774
772
  async stopScanning(switchbot) {
775
773
  await switchbot.stopScan();
776
- if (this.connected) {
774
+ if (this.BLE_IsConnected) {
777
775
  await this.BLEparseStatus();
778
776
  await this.updateHomeKitCharacteristics();
779
777
  }
@@ -962,12 +960,15 @@ class BlindTilt {
962
960
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
963
961
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
964
962
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
965
- if (accessory.context.FirmwareRevision) {
966
- FirmwareRevision = accessory.context.FirmwareRevision;
967
- }
968
- else if (device.firmware) {
963
+ if (device.firmware) {
969
964
  FirmwareRevision = device.firmware;
970
965
  }
966
+ else if (device.version) {
967
+ FirmwareRevision = JSON.stringify(device.version);
968
+ }
969
+ else if (accessory.context.FirmwareRevision) {
970
+ FirmwareRevision = accessory.context.FirmwareRevision;
971
+ }
971
972
  else {
972
973
  FirmwareRevision = this.platform.version;
973
974
  }