homebridge-bedjet 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-bedjet",
3
3
  "displayName": "BedJet",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Homebridge plugin for BedJet V3 via Bluetooth LE",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
@@ -179,11 +179,19 @@ export class BedJet extends EventEmitter {
179
179
  }
180
180
 
181
181
  // Subscribe to notifications on the status characteristic
182
- await this.statusChar.subscribeAsync();
182
+ this.log.info(`[${this.config.name}] Subscribing to notifications…`);
183
+ await Promise.race([
184
+ this.statusChar.subscribeAsync(),
185
+ new Promise<never>((_, reject) =>
186
+ setTimeout(() => reject(new Error(`[${this.config.name}] Subscribe timed out`)), 10_000),
187
+ ),
188
+ ]);
189
+ this.log.info(`[${this.config.name}] Subscribed — reading device status…`);
183
190
  this.statusChar.on('data', (data: Buffer) => this._handleNotification(data));
184
191
 
185
192
  // Read extended status and device name
186
193
  await this._readDeviceStatus();
194
+ this.log.info(`[${this.config.name}] Reading device name…`);
187
195
  await this._readDeviceName();
188
196
 
189
197
  this.reconnectAttempts = 0;