homebridge-tydom 0.27.0 → 0.27.2

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
 
package/dist/index.js CHANGED
@@ -454,7 +454,7 @@ var TydomController = class extends import_events.EventEmitter {
454
454
  const { hostname } = this.config;
455
455
  this.log.info(`Scaning devices from hostname=${chalkString(hostname)}...`);
456
456
  const {
457
- settings,
457
+ settings = {},
458
458
  includedDevices = [],
459
459
  excludedDevices = [],
460
460
  includedCategories = [],
@@ -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 }) {