homebridge-tydom 0.26.0 → 0.27.1

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/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  <img src="https://img.shields.io/npm/l/homebridge-tydom.svg?style=for-the-badge" alt="npm license" />
23
23
  </a>
24
24
  <a href="https://github.com/mgcrea/homebridge-tydom/actions/workflows/main.yml">
25
- <img src="https://img.shields.io/github/workflow/status/mgcrea/homebridge-tydom/main?style=for-the-badge" alt="github main workflow" />
25
+ <img src="https://img.shields.io/github/actions/workflow/status/mgcrea/homebridge-tydom/main.yml?style=for-the-badge" alt="github main workflow" />
26
26
  </a>
27
27
  </p>
28
28
 
@@ -30,6 +30,8 @@
30
30
 
31
31
  [Homebridge](https://homebridge.io/) plugin to easily manage [Tydom hardware](https://www.deltadore.fr/domotique/pilotage-maison-connectee) by [Delta Dore](https://www.deltadore.fr/) from [Apple HomeKit](https://www.apple.com/ios/home/).
32
32
 
33
+ - Compatible with [Homebridge](https://homebridge.io/) v1.6+ and v2.0.
34
+
33
35
  - Rely on [node-tydom-client](https://github.com/mgcrea/node-tydom-client) to communicate with an existing [Tydom bridge](https://www.deltadore.fr/domotique/pilotage-maison-connectee/box-domotique/tydom-2-0-ref-6414118) (required).
34
36
 
35
37
  - Properly propagates external events into [Apple HomeKit](https://www.apple.com/ios/home/).
@@ -51,7 +53,7 @@
51
53
  "private": true,
52
54
  "description": "This file keeps track of which plugins should be installed.",
53
55
  "dependencies": {
54
- "homebridge-tydom": "^0.23.9"
56
+ "homebridge-tydom": "^0.25.1"
55
57
  }
56
58
  }
57
59
  ```
@@ -296,17 +298,14 @@ Alternatively, you can set `debug` to `true` in the plugin's configuration.
296
298
 
297
299
  ### Available scripts
298
300
 
299
- | **Script** | **Description** |
300
- | ------------- | ---------------------------- |
301
- | start | alias to `spec:watch` |
302
- | test | Run all tests |
303
- | spec | Run unit tests |
304
- | spec:coverage | Run unit tests with coverage |
305
- | spec:watch | Watch unit tests |
306
- | lint | Run eslint static tests |
307
- | pretty | Run prettier static tests |
308
- | build | Compile the library |
309
- | build:watch | Watch compilation |
301
+ | **Script** | **Description** |
302
+ | ---------- | ------------------------------ |
303
+ | start | Start homebridge in debug mode |
304
+ | lint | Run eslint static tests |
305
+ | format | Run prettier formatting |
306
+ | check | Run TypeScript type checking |
307
+ | test | Run lint, format, and check |
308
+ | build | Compile the library with tsup |
310
309
 
311
310
  ## Authors
312
311
 
package/dist/index.js CHANGED
@@ -4394,8 +4394,19 @@ var TydomPlatform = class {
4394
4394
  enableDebug();
4395
4395
  }
4396
4396
  this.controller = new TydomController(log, this.config);
4397
- this.api.on("didFinishLaunching", () => setTimeout(() => this.didFinishLaunching(), 16));
4398
- this.controller.on("device", this.handleControllerDevice.bind(this));
4397
+ this.api.on(
4398
+ "didFinishLaunching",
4399
+ () => setTimeout(() => {
4400
+ this.didFinishLaunching().catch((err) => {
4401
+ this.log.error(`Failed to finish launching: ${stringifyError(err)}`);
4402
+ });
4403
+ }, 16)
4404
+ );
4405
+ this.controller.on("device", (context) => {
4406
+ this.handleControllerDevice(context).catch((err) => {
4407
+ this.log.error(`Failed to handle device ${context.deviceId}: ${stringifyError(err)}`);
4408
+ });
4409
+ });
4399
4410
  this.controller.on("update", this.handleControllerDataUpdate.bind(this));
4400
4411
  this.controller.on("notification", this.handleControllerNotification.bind(this));
4401
4412
  }
@@ -4446,7 +4457,18 @@ var TydomPlatform = class {
4446
4457
  if (!accessory || !this.controller) return;
4447
4458
  const tydomAccessoryUpdate = getTydomAccessoryDataUpdate(accessory, context);
4448
4459
  if (tydomAccessoryUpdate) {
4449
- void tydomAccessoryUpdate(accessory, this.controller, updates, type);
4460
+ try {
4461
+ const result = tydomAccessoryUpdate(accessory, this.controller, updates, type);
4462
+ if (result instanceof Promise) {
4463
+ void result.catch((err) => {
4464
+ this.log.error(
4465
+ `Failed to update accessory ${context.accessoryId}: ${stringifyError(err)}`
4466
+ );
4467
+ });
4468
+ }
4469
+ } catch (err) {
4470
+ this.log.error(`Failed to update accessory ${context.accessoryId}: ${stringifyError(err)}`);
4471
+ }
4450
4472
  }
4451
4473
  }
4452
4474
  handleControllerNotification({ level, message }) {