@enyo-energy/energy-app-sdk 0.0.160 → 0.0.161

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.
@@ -215,9 +215,6 @@ class ApplianceManager {
215
215
  // returns the new appliance without racing the appliance-updated
216
216
  // listener (which may fire on a later microtask).
217
217
  await this.primeCacheFromSdk(applianceId);
218
- if (this.config.enableLogging) {
219
- console.debug(`${existingApplianceId ? 'Updated' : 'Created'} appliance ${applianceId} of type ${appliance.type}`);
220
- }
221
218
  return applianceId;
222
219
  }
223
220
  /**
@@ -278,18 +275,12 @@ class ApplianceManager {
278
275
  const updatedListenerId = applianceService.listenForApplianceUpdated((appliance) => {
279
276
  if (this.disposed)
280
277
  return;
281
- if (this.config.enableLogging) {
282
- console.debug(`Appliance updated event received for ${appliance.id}`);
283
- }
284
278
  this.updateCache(appliance);
285
279
  });
286
280
  this.listenerIds.push(updatedListenerId);
287
281
  const removedListenerId = applianceService.listenForApplianceRemoved((applianceId) => {
288
282
  if (this.disposed)
289
283
  return;
290
- if (this.config.enableLogging) {
291
- console.debug(`Appliance removed event received for ${applianceId}`);
292
- }
293
284
  this.removeFromCache(applianceId);
294
285
  });
295
286
  this.listenerIds.push(removedListenerId);
@@ -469,9 +460,6 @@ class ApplianceManager {
469
460
  };
470
461
  await this.energyApp.useAppliances().save(updated, applianceId);
471
462
  await this.primeCacheFromSdk(applianceId);
472
- if (this.config.enableLogging) {
473
- console.debug(`Updated appliance ${applianceId} state to ${state}`);
474
- }
475
463
  }
476
464
  /**
477
465
  * Patches an appliance with the provided attributes via {@link mergeApplianceData}.
@@ -491,9 +479,6 @@ class ApplianceManager {
491
479
  const updated = this.mergeApplianceData(appliance, attributes);
492
480
  await this.energyApp.useAppliances().save(updated, applianceId);
493
481
  await this.primeCacheFromSdk(applianceId);
494
- if (this.config.enableLogging) {
495
- console.debug(`Updated appliance ${applianceId}`);
496
- }
497
482
  }
498
483
  /**
499
484
  * Refetches an appliance from the SDK and reflects the result in the
@@ -517,9 +502,6 @@ class ApplianceManager {
517
502
  async removeAppliance(applianceId) {
518
503
  this.throwIfDisposed();
519
504
  await this.energyApp.useAppliances().removeById(applianceId);
520
- if (this.config.enableLogging) {
521
- console.debug(`Removed appliance ${applianceId}`);
522
- }
523
505
  }
524
506
  /**
525
507
  * Removes every appliance matching the given identifier. Per-appliance
@@ -600,9 +582,6 @@ class ApplianceManager {
600
582
  failed.push(update.applianceId);
601
583
  }
602
584
  }
603
- if (this.config.enableLogging) {
604
- console.debug(`Bulk update completed: ${succeeded.length} succeeded, ${failed.length} failed`);
605
- }
606
585
  return { succeeded, failed };
607
586
  }
608
587
  /**
@@ -625,9 +604,6 @@ class ApplianceManager {
625
604
  async setIdentifierStrategy(strategy, rebuildCache) {
626
605
  this.throwIfDisposed();
627
606
  this.config.identifierStrategy = strategy;
628
- if (this.config.enableLogging) {
629
- console.debug(`Changed identifier strategy to: ${strategy.name}`);
630
- }
631
607
  if (rebuildCache) {
632
608
  await this.refreshCache();
633
609
  return;
@@ -663,9 +639,6 @@ class ApplianceManager {
663
639
  }
664
640
  this.listenerIds = [];
665
641
  this.clearCache();
666
- if (this.config.enableLogging) {
667
- console.debug('ApplianceManager disposed');
668
- }
669
642
  }
670
643
  /**
671
644
  * Throws {@link ApplianceManagerDisposedError} if {@link dispose} has been
@@ -1,4 +1,13 @@
1
1
  import { EebusConnectionStatusEnum, EebusDevice, EebusDiscoveredDevice, EebusPeerManufacturerData } from '../../types/enyo-eebus.cjs';
2
+ /**
3
+ * Options controlling how an active SHIP connection is established via
4
+ * {@link EebusDeviceManagement.connect}.
5
+ */
6
+ export interface EebusConnectOptions {
7
+ /** Advertised heartbeat timeout (seconds, sent as `PT{n}S`) passed to
8
+ * `EebusService.connect` for the gateway. Defaults to **4** (PT4S). */
9
+ heartbeatTimeoutSeconds?: number;
10
+ }
2
11
  /**
3
12
  * SHIP-level device lifecycle management for EEbus devices.
4
13
  *
@@ -13,7 +22,7 @@ import { EebusConnectionStatusEnum, EebusDevice, EebusDiscoveredDevice, EebusPee
13
22
  *
14
23
  * const discovered = await eebus.devices.getDiscoveredDevices();
15
24
  * const device = await eebus.devices.pairDevice(discovered[0].ski);
16
- * await eebus.devices.connect(device.ski);
25
+ * await eebus.devices.connect(device.ski, {heartbeatTimeoutSeconds: 4});
17
26
  *
18
27
  * const listenerId = eebus.devices.listenForConnectionStatusChange((ski, status) => {
19
28
  * console.log(`${ski} → ${status}`);
@@ -49,8 +58,10 @@ export interface EebusDeviceManagement {
49
58
  * Establish an active SHIP connection to an already-paired device.
50
59
  * The device must have been previously paired via {@link pairDevice}.
51
60
  * @param ski Subject Key Identifier of the device to connect to
61
+ * @param options Connection options, e.g. the advertised heartbeat timeout.
62
+ * See {@link EebusConnectOptions}.
52
63
  */
53
- connect: (ski: string) => Promise<void>;
64
+ connect: (ski: string, options: EebusConnectOptions) => Promise<void>;
54
65
  /**
55
66
  * Safely disconnect from a currently connected device.
56
67
  * @param ski Subject Key Identifier of the device to disconnect from
@@ -3,7 +3,7 @@ import { EebusFeatureCatalog } from './eebus-feature-catalog.cjs';
3
3
  import { EebusIdentityService } from './eebus-identity-service.cjs';
4
4
  import { EebusSpineLowLevel } from './eebus-spine-low-level.cjs';
5
5
  import { EebusUseCaseRegistry } from './eebus-use-case-registry.cjs';
6
- export { EebusDeviceManagement } from './eebus-device-management.cjs';
6
+ export { EebusDeviceManagement, EebusConnectOptions } from './eebus-device-management.cjs';
7
7
  export { EebusFeatureCatalog, EebusFeatureAddressMatch, EebusFindFeatureForClientOptions, } from './eebus-feature-catalog.cjs';
8
8
  export { EebusIdentityService } from './eebus-identity-service.cjs';
9
9
  export { EebusSpineLowLevel } from './eebus-spine-low-level.cjs';
@@ -47,7 +47,7 @@ export { EebusVapdClient, VapdClientOptions } from './eebus-vapd-client.cjs';
47
47
  * // 1. SHIP — pair and connect
48
48
  * const [discovered] = await eebus.devices.getDiscoveredDevices();
49
49
  * const device = await eebus.devices.pairDevice(discovered.ski);
50
- * await eebus.devices.connect(device.ski);
50
+ * await eebus.devices.connect(device.ski, {heartbeatTimeoutSeconds: 4});
51
51
  *
52
52
  * // 2. NID — read identity and watch for changes
53
53
  * const identity = await eebus.identity.get(device.ski);
@@ -9,7 +9,7 @@ exports.getSdkVersion = getSdkVersion;
9
9
  /**
10
10
  * Current version of the enyo Energy App SDK.
11
11
  */
12
- exports.SDK_VERSION = '0.0.160';
12
+ exports.SDK_VERSION = '0.0.161';
13
13
  /**
14
14
  * Gets the current SDK version.
15
15
  * @returns The semantic version string of the SDK
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.160";
8
+ export declare const SDK_VERSION = "0.0.161";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -209,9 +209,6 @@ export class ApplianceManager {
209
209
  // returns the new appliance without racing the appliance-updated
210
210
  // listener (which may fire on a later microtask).
211
211
  await this.primeCacheFromSdk(applianceId);
212
- if (this.config.enableLogging) {
213
- console.debug(`${existingApplianceId ? 'Updated' : 'Created'} appliance ${applianceId} of type ${appliance.type}`);
214
- }
215
212
  return applianceId;
216
213
  }
217
214
  /**
@@ -272,18 +269,12 @@ export class ApplianceManager {
272
269
  const updatedListenerId = applianceService.listenForApplianceUpdated((appliance) => {
273
270
  if (this.disposed)
274
271
  return;
275
- if (this.config.enableLogging) {
276
- console.debug(`Appliance updated event received for ${appliance.id}`);
277
- }
278
272
  this.updateCache(appliance);
279
273
  });
280
274
  this.listenerIds.push(updatedListenerId);
281
275
  const removedListenerId = applianceService.listenForApplianceRemoved((applianceId) => {
282
276
  if (this.disposed)
283
277
  return;
284
- if (this.config.enableLogging) {
285
- console.debug(`Appliance removed event received for ${applianceId}`);
286
- }
287
278
  this.removeFromCache(applianceId);
288
279
  });
289
280
  this.listenerIds.push(removedListenerId);
@@ -463,9 +454,6 @@ export class ApplianceManager {
463
454
  };
464
455
  await this.energyApp.useAppliances().save(updated, applianceId);
465
456
  await this.primeCacheFromSdk(applianceId);
466
- if (this.config.enableLogging) {
467
- console.debug(`Updated appliance ${applianceId} state to ${state}`);
468
- }
469
457
  }
470
458
  /**
471
459
  * Patches an appliance with the provided attributes via {@link mergeApplianceData}.
@@ -485,9 +473,6 @@ export class ApplianceManager {
485
473
  const updated = this.mergeApplianceData(appliance, attributes);
486
474
  await this.energyApp.useAppliances().save(updated, applianceId);
487
475
  await this.primeCacheFromSdk(applianceId);
488
- if (this.config.enableLogging) {
489
- console.debug(`Updated appliance ${applianceId}`);
490
- }
491
476
  }
492
477
  /**
493
478
  * Refetches an appliance from the SDK and reflects the result in the
@@ -511,9 +496,6 @@ export class ApplianceManager {
511
496
  async removeAppliance(applianceId) {
512
497
  this.throwIfDisposed();
513
498
  await this.energyApp.useAppliances().removeById(applianceId);
514
- if (this.config.enableLogging) {
515
- console.debug(`Removed appliance ${applianceId}`);
516
- }
517
499
  }
518
500
  /**
519
501
  * Removes every appliance matching the given identifier. Per-appliance
@@ -594,9 +576,6 @@ export class ApplianceManager {
594
576
  failed.push(update.applianceId);
595
577
  }
596
578
  }
597
- if (this.config.enableLogging) {
598
- console.debug(`Bulk update completed: ${succeeded.length} succeeded, ${failed.length} failed`);
599
- }
600
579
  return { succeeded, failed };
601
580
  }
602
581
  /**
@@ -619,9 +598,6 @@ export class ApplianceManager {
619
598
  async setIdentifierStrategy(strategy, rebuildCache) {
620
599
  this.throwIfDisposed();
621
600
  this.config.identifierStrategy = strategy;
622
- if (this.config.enableLogging) {
623
- console.debug(`Changed identifier strategy to: ${strategy.name}`);
624
- }
625
601
  if (rebuildCache) {
626
602
  await this.refreshCache();
627
603
  return;
@@ -657,9 +633,6 @@ export class ApplianceManager {
657
633
  }
658
634
  this.listenerIds = [];
659
635
  this.clearCache();
660
- if (this.config.enableLogging) {
661
- console.debug('ApplianceManager disposed');
662
- }
663
636
  }
664
637
  /**
665
638
  * Throws {@link ApplianceManagerDisposedError} if {@link dispose} has been
@@ -1,4 +1,13 @@
1
1
  import { EebusConnectionStatusEnum, EebusDevice, EebusDiscoveredDevice, EebusPeerManufacturerData } from '../../types/enyo-eebus.js';
2
+ /**
3
+ * Options controlling how an active SHIP connection is established via
4
+ * {@link EebusDeviceManagement.connect}.
5
+ */
6
+ export interface EebusConnectOptions {
7
+ /** Advertised heartbeat timeout (seconds, sent as `PT{n}S`) passed to
8
+ * `EebusService.connect` for the gateway. Defaults to **4** (PT4S). */
9
+ heartbeatTimeoutSeconds?: number;
10
+ }
2
11
  /**
3
12
  * SHIP-level device lifecycle management for EEbus devices.
4
13
  *
@@ -13,7 +22,7 @@ import { EebusConnectionStatusEnum, EebusDevice, EebusDiscoveredDevice, EebusPee
13
22
  *
14
23
  * const discovered = await eebus.devices.getDiscoveredDevices();
15
24
  * const device = await eebus.devices.pairDevice(discovered[0].ski);
16
- * await eebus.devices.connect(device.ski);
25
+ * await eebus.devices.connect(device.ski, {heartbeatTimeoutSeconds: 4});
17
26
  *
18
27
  * const listenerId = eebus.devices.listenForConnectionStatusChange((ski, status) => {
19
28
  * console.log(`${ski} → ${status}`);
@@ -49,8 +58,10 @@ export interface EebusDeviceManagement {
49
58
  * Establish an active SHIP connection to an already-paired device.
50
59
  * The device must have been previously paired via {@link pairDevice}.
51
60
  * @param ski Subject Key Identifier of the device to connect to
61
+ * @param options Connection options, e.g. the advertised heartbeat timeout.
62
+ * See {@link EebusConnectOptions}.
52
63
  */
53
- connect: (ski: string) => Promise<void>;
64
+ connect: (ski: string, options: EebusConnectOptions) => Promise<void>;
54
65
  /**
55
66
  * Safely disconnect from a currently connected device.
56
67
  * @param ski Subject Key Identifier of the device to disconnect from
@@ -3,7 +3,7 @@ import { EebusFeatureCatalog } from './eebus-feature-catalog.js';
3
3
  import { EebusIdentityService } from './eebus-identity-service.js';
4
4
  import { EebusSpineLowLevel } from './eebus-spine-low-level.js';
5
5
  import { EebusUseCaseRegistry } from './eebus-use-case-registry.js';
6
- export { EebusDeviceManagement } from './eebus-device-management.js';
6
+ export { EebusDeviceManagement, EebusConnectOptions } from './eebus-device-management.js';
7
7
  export { EebusFeatureCatalog, EebusFeatureAddressMatch, EebusFindFeatureForClientOptions, } from './eebus-feature-catalog.js';
8
8
  export { EebusIdentityService } from './eebus-identity-service.js';
9
9
  export { EebusSpineLowLevel } from './eebus-spine-low-level.js';
@@ -47,7 +47,7 @@ export { EebusVapdClient, VapdClientOptions } from './eebus-vapd-client.js';
47
47
  * // 1. SHIP — pair and connect
48
48
  * const [discovered] = await eebus.devices.getDiscoveredDevices();
49
49
  * const device = await eebus.devices.pairDevice(discovered.ski);
50
- * await eebus.devices.connect(device.ski);
50
+ * await eebus.devices.connect(device.ski, {heartbeatTimeoutSeconds: 4});
51
51
  *
52
52
  * // 2. NID — read identity and watch for changes
53
53
  * const identity = await eebus.identity.get(device.ski);
package/dist/version.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.160";
8
+ export declare const SDK_VERSION = "0.0.161";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/dist/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export const SDK_VERSION = '0.0.160';
8
+ export const SDK_VERSION = '0.0.161';
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enyo-energy/energy-app-sdk",
3
- "version": "0.0.160",
3
+ "version": "0.0.161",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",