@enyo-energy/energy-app-sdk 0.0.159 → 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);
@@ -1,4 +1,4 @@
1
- import { EnyoCharge, EnyoChargeFilter } from "../types/enyo-charge.cjs";
1
+ import { EnyoCharge, EnyoChargeFilter, EnyoDefaultChargeMode } from "../types/enyo-charge.cjs";
2
2
  /**
3
3
  * Interface for managing charging sessions in enyo packages.
4
4
  * Provides operations for charge session tracking and management.
@@ -14,4 +14,24 @@ export interface EnergyAppCharge {
14
14
  findActiveCharge: (applianceId: string) => Promise<EnyoCharge | null>;
15
15
  /** Find the currently active charge by appliance ID and transaction ID */
16
16
  findActiveChargeByTransactionId: (applianceId: string, transactionId: string) => Promise<EnyoCharge | null>;
17
+ /**
18
+ * Sets the default charging mode for a specific appliance, optionally
19
+ * with a target completion time and its timezone.
20
+ *
21
+ * **Required permission:** `EnergyManager`.
22
+ *
23
+ * @param applianceId - The appliance (charger) the default charge mode applies to.
24
+ * @param defaultChargeMode - The default charge mode configuration to apply.
25
+ * @returns Promise that resolves once the default charge mode is stored.
26
+ */
27
+ setDefaultChargeMode: (applianceId: string, defaultChargeMode: EnyoDefaultChargeMode) => Promise<void>;
28
+ /**
29
+ * Retrieves the currently configured default charging mode for a specific appliance.
30
+ *
31
+ * No permission is required to read the default charge mode.
32
+ *
33
+ * @param applianceId - The appliance (charger) to read the default charge mode for.
34
+ * @returns Promise resolving to the configured default charge mode
35
+ */
36
+ getDefaultChargeMode: (applianceId: string) => Promise<EnyoDefaultChargeMode>;
17
37
  }
@@ -83,6 +83,27 @@ export interface EnyoChargeScheduleEntry {
83
83
  /** Current limit in Ampere for this schedule period */
84
84
  limitAmpere: number;
85
85
  }
86
+ /**
87
+ * Default charging preference applied to charging sessions when no
88
+ * per-session mode is explicitly provided.
89
+ */
90
+ export interface EnyoDefaultChargeMode {
91
+ /** The default charging mode (e.g. immediate, cost-optimized, price-limit) */
92
+ chargeMode: EnyoChargeModeEnum;
93
+ /**
94
+ * Optional target completion time as a wall-clock time in the
95
+ * accompanying {@link EnyoDefaultChargeMode.timezone} (e.g. `"07:30"`).
96
+ * When set, optimized modes plan the session to finish by this time.
97
+ */
98
+ completeAtTime?: string;
99
+ /**
100
+ * IANA timezone the {@link EnyoDefaultChargeMode.completeAtTime} is
101
+ * expressed in (e.g. `"Europe/Berlin"`). Should be provided whenever
102
+ * `completeAtTime` is set so the wall-clock time can be resolved
103
+ * unambiguously.
104
+ */
105
+ timezone?: string;
106
+ }
86
107
  export interface EnyoChargeFilter {
87
108
  /** Filter by specific appliance ID */
88
109
  applianceId?: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnyoChargingProfileTypeEnum = exports.EnyoCommandAcknowledgeAnswerEnum = exports.EnyoStorageScheduleDirectionEnum = exports.EnyoStorageScheduleModeEnum = exports.EnyoDataBusMessageEnum = exports.EnyoChargeModeEnum = exports.EnyoChargingStopReason = exports.EnyoChargingMeterValueContext = exports.EnyoStringStateEnum = exports.EnyoInverterStateEnum = exports.EnyoBatteryStateEnum = exports.EnyoDataBusCommandReasonTypeEnum = void 0;
3
+ exports.EnyoChargingProfileTypeEnum = exports.EnyoCommandAcknowledgeAnswerEnum = exports.EnyoStorageScheduleDirectionEnum = exports.EnyoStorageScheduleModeEnum = exports.EnyoDataBusMessageEnum = exports.EnyoChargeInitiatorEnum = exports.EnyoChargeModeEnum = exports.EnyoChargingStopReason = exports.EnyoChargingMeterValueContext = exports.EnyoStringStateEnum = exports.EnyoInverterStateEnum = exports.EnyoBatteryStateEnum = exports.EnyoDataBusCommandReasonCategoryEnum = exports.EnyoDataBusCommandReasonTypeEnum = void 0;
4
4
  /**
5
5
  * Enum representing the reason type for why a data bus command was issued.
6
6
  * Used to attach context to commands for logging, debugging, and UI display.
@@ -23,7 +23,51 @@ var EnyoDataBusCommandReasonTypeEnum;
23
23
  EnyoDataBusCommandReasonTypeEnum["GridOperatorPowerLimitationActive"] = "grid-operator-power-limitation-active";
24
24
  /** Command issued because a grid operator power limitation is inactive */
25
25
  EnyoDataBusCommandReasonTypeEnum["GridOperatorPowerLimitationInactive"] = "grid-operator-power-limitation-inactive";
26
+ /** Command issued because the battery state of charge is low */
27
+ EnyoDataBusCommandReasonTypeEnum["BatterySoCLow"] = "battery-soc-low";
28
+ /** Command issued because the battery state of charge is high */
29
+ EnyoDataBusCommandReasonTypeEnum["BatterySoCHigh"] = "battery-soc-high";
30
+ /** Command issued to follow the planned EV charging schedule */
31
+ EnyoDataBusCommandReasonTypeEnum["EvChargingSchedule"] = "ev-charging-schedule";
32
+ /** Command issued as part of a planned/scheduled optimization */
33
+ EnyoDataBusCommandReasonTypeEnum["ScheduledOptimization"] = "scheduled-optimization";
34
+ /** Command issued because the user explicitly requested it */
35
+ EnyoDataBusCommandReasonTypeEnum["UserRequest"] = "user-request";
36
+ /** Command issued to protect the device (e.g. overheating or safety limit) */
37
+ EnyoDataBusCommandReasonTypeEnum["DeviceProtection"] = "device-protection";
38
+ /** Command issued because home consumption is high */
39
+ EnyoDataBusCommandReasonTypeEnum["HomeConsumptionHigh"] = "home-consumption-high";
40
+ /** Command issued to optimize self-consumption */
41
+ EnyoDataBusCommandReasonTypeEnum["SelfConsumptionOptimization"] = "self-consumption-optimization";
26
42
  })(EnyoDataBusCommandReasonTypeEnum || (exports.EnyoDataBusCommandReasonTypeEnum = EnyoDataBusCommandReasonTypeEnum = {}));
43
+ /**
44
+ * Coarse, machine-readable grouping of why a data bus command was issued.
45
+ * Intended for filtering, iconography, and analytics. The human-readable,
46
+ * end-user explanation lives in {@link EnyoDataBusCommandReason.translation}.
47
+ */
48
+ var EnyoDataBusCommandReasonCategoryEnum;
49
+ (function (EnyoDataBusCommandReasonCategoryEnum) {
50
+ /** Driven by the electricity price (cheap/expensive). */
51
+ EnyoDataBusCommandReasonCategoryEnum["EnergyPrice"] = "energy-price";
52
+ /** Driven by available/unavailable PV surplus. */
53
+ EnyoDataBusCommandReasonCategoryEnum["PvSurplus"] = "pv-surplus";
54
+ /** Driven by battery capacity or state of charge. */
55
+ EnyoDataBusCommandReasonCategoryEnum["BatteryState"] = "battery-state";
56
+ /** Driven by a grid operator power limitation. */
57
+ EnyoDataBusCommandReasonCategoryEnum["GridLimitation"] = "grid-limitation";
58
+ /** Driven by following a planned schedule. */
59
+ EnyoDataBusCommandReasonCategoryEnum["Schedule"] = "schedule";
60
+ /** Driven by an explicit user request. */
61
+ EnyoDataBusCommandReasonCategoryEnum["UserRequest"] = "user-request";
62
+ /** Driven by device protection / safety (e.g. overheating). */
63
+ EnyoDataBusCommandReasonCategoryEnum["DeviceProtection"] = "device-protection";
64
+ /** Driven by a temperature condition (e.g. heatpump thermal control). */
65
+ EnyoDataBusCommandReasonCategoryEnum["Temperature"] = "temperature";
66
+ /** Driven by self-consumption optimization. */
67
+ EnyoDataBusCommandReasonCategoryEnum["SelfConsumptionOptimization"] = "self-consumption-optimization";
68
+ /** Any reason not covered by the categories above. */
69
+ EnyoDataBusCommandReasonCategoryEnum["Other"] = "other";
70
+ })(EnyoDataBusCommandReasonCategoryEnum || (exports.EnyoDataBusCommandReasonCategoryEnum = EnyoDataBusCommandReasonCategoryEnum = {}));
27
71
  var EnyoBatteryStateEnum;
28
72
  (function (EnyoBatteryStateEnum) {
29
73
  EnyoBatteryStateEnum["Off"] = "off";
@@ -107,6 +151,16 @@ var EnyoChargeModeEnum;
107
151
  /** Optimize charging schedule for a maximum price limit, for example 7 ct grid or pv production */
108
152
  EnyoChargeModeEnum["PriceLimit"] = "price-limit";
109
153
  })(EnyoChargeModeEnum || (exports.EnyoChargeModeEnum = EnyoChargeModeEnum = {}));
154
+ /**
155
+ * Identifies who initiated a charging session.
156
+ */
157
+ var EnyoChargeInitiatorEnum;
158
+ (function (EnyoChargeInitiatorEnum) {
159
+ /** Session was started from the enyo app (remote/user-driven start) */
160
+ EnyoChargeInitiatorEnum["App"] = "app";
161
+ /** Session was started directly at the charger (e.g. plug-and-charge or local autostart) */
162
+ EnyoChargeInitiatorEnum["Charger"] = "charger";
163
+ })(EnyoChargeInitiatorEnum || (exports.EnyoChargeInitiatorEnum = EnyoChargeInitiatorEnum = {}));
110
164
  var EnyoDataBusMessageEnum;
111
165
  (function (EnyoDataBusMessageEnum) {
112
166
  EnyoDataBusMessageEnum["InverterValuesUpdateV1"] = "InverterValuesUpdateV1";
@@ -8,6 +8,7 @@ import { EnyoCurrencyEnum } from "./enyo-currency.cjs";
8
8
  import { EnyoHeatpumpApplianceModeEnum } from "./enyo-heatpump-appliance.cjs";
9
9
  import { EnyoAirConditioningApplianceModeEnum } from "./enyo-air-conditioning-appliance.cjs";
10
10
  import { EnergyAppPackageCategory } from "../energy-app-package-definition.cjs";
11
+ import { EnyoPackageConfigurationTranslatedValue } from "./enyo-settings.cjs";
11
12
  /**
12
13
  * Enum representing the reason type for why a data bus command was issued.
13
14
  * Used to attach context to commands for logging, debugging, and UI display.
@@ -28,7 +29,50 @@ export declare enum EnyoDataBusCommandReasonTypeEnum {
28
29
  /** Command issued because a grid operator power limitation is active */
29
30
  GridOperatorPowerLimitationActive = "grid-operator-power-limitation-active",
30
31
  /** Command issued because a grid operator power limitation is inactive */
31
- GridOperatorPowerLimitationInactive = "grid-operator-power-limitation-inactive"
32
+ GridOperatorPowerLimitationInactive = "grid-operator-power-limitation-inactive",
33
+ /** Command issued because the battery state of charge is low */
34
+ BatterySoCLow = "battery-soc-low",
35
+ /** Command issued because the battery state of charge is high */
36
+ BatterySoCHigh = "battery-soc-high",
37
+ /** Command issued to follow the planned EV charging schedule */
38
+ EvChargingSchedule = "ev-charging-schedule",
39
+ /** Command issued as part of a planned/scheduled optimization */
40
+ ScheduledOptimization = "scheduled-optimization",
41
+ /** Command issued because the user explicitly requested it */
42
+ UserRequest = "user-request",
43
+ /** Command issued to protect the device (e.g. overheating or safety limit) */
44
+ DeviceProtection = "device-protection",
45
+ /** Command issued because home consumption is high */
46
+ HomeConsumptionHigh = "home-consumption-high",
47
+ /** Command issued to optimize self-consumption */
48
+ SelfConsumptionOptimization = "self-consumption-optimization"
49
+ }
50
+ /**
51
+ * Coarse, machine-readable grouping of why a data bus command was issued.
52
+ * Intended for filtering, iconography, and analytics. The human-readable,
53
+ * end-user explanation lives in {@link EnyoDataBusCommandReason.translation}.
54
+ */
55
+ export declare enum EnyoDataBusCommandReasonCategoryEnum {
56
+ /** Driven by the electricity price (cheap/expensive). */
57
+ EnergyPrice = "energy-price",
58
+ /** Driven by available/unavailable PV surplus. */
59
+ PvSurplus = "pv-surplus",
60
+ /** Driven by battery capacity or state of charge. */
61
+ BatteryState = "battery-state",
62
+ /** Driven by a grid operator power limitation. */
63
+ GridLimitation = "grid-limitation",
64
+ /** Driven by following a planned schedule. */
65
+ Schedule = "schedule",
66
+ /** Driven by an explicit user request. */
67
+ UserRequest = "user-request",
68
+ /** Driven by device protection / safety (e.g. overheating). */
69
+ DeviceProtection = "device-protection",
70
+ /** Driven by a temperature condition (e.g. heatpump thermal control). */
71
+ Temperature = "temperature",
72
+ /** Driven by self-consumption optimization. */
73
+ SelfConsumptionOptimization = "self-consumption-optimization",
74
+ /** Any reason not covered by the categories above. */
75
+ Other = "other"
32
76
  }
33
77
  /**
34
78
  * Interface describing the reason why a data bus command was issued.
@@ -37,6 +81,10 @@ export declare enum EnyoDataBusCommandReasonTypeEnum {
37
81
  export interface EnyoDataBusCommandReason {
38
82
  /** The reason type indicating why this command was issued */
39
83
  type: EnyoDataBusCommandReasonTypeEnum;
84
+ /** Coarse category for grouping, iconography, and analytics */
85
+ category?: EnyoDataBusCommandReasonCategoryEnum;
86
+ /** Per-language, end-user-facing explanation of this reason */
87
+ translation?: EnyoPackageConfigurationTranslatedValue[];
40
88
  /** Electricity price per kWh that triggered this command */
41
89
  electricityPricePerKwh?: number;
42
90
  /** Currency of the electricity price */
@@ -47,6 +95,10 @@ export interface EnyoDataBusCommandReason {
47
95
  powerW?: number;
48
96
  /** Relevant energy in Watt hours */
49
97
  powerWh?: number;
98
+ /** Relevant temperature in Celsius (e.g. heatpump-driven reasons) */
99
+ temperatureC?: number;
100
+ /** Relevant state of charge as a percentage (battery-driven reasons) */
101
+ socPercent?: number;
50
102
  }
51
103
  export declare enum EnyoBatteryStateEnum {
52
104
  Off = "off",
@@ -125,6 +177,15 @@ export declare enum EnyoChargeModeEnum {
125
177
  /** Optimize charging schedule for a maximum price limit, for example 7 ct grid or pv production */
126
178
  PriceLimit = "price-limit"
127
179
  }
180
+ /**
181
+ * Identifies who initiated a charging session.
182
+ */
183
+ export declare enum EnyoChargeInitiatorEnum {
184
+ /** Session was started from the enyo app (remote/user-driven start) */
185
+ App = "app",
186
+ /** Session was started directly at the charger (e.g. plug-and-charge or local autostart) */
187
+ Charger = "charger"
188
+ }
128
189
  export interface EnyoAggregatedStateApplianceValues {
129
190
  powerW?: number;
130
191
  batterySoC?: number;
@@ -440,6 +501,8 @@ export interface EnyoDataBusChargingStartedV1 extends EnyoDataBusMessage {
440
501
  transactionId: string;
441
502
  /** used charging card */
442
503
  chargingCardId?: string;
504
+ /** Who initiated the charging session — the enyo app or the charger itself */
505
+ initiator: EnyoChargeInitiatorEnum;
443
506
  /** The charge mode of the started charge. If initiated by wallbox, use either user settings or immediate as default */
444
507
  chargeMode: EnyoChargeModeEnum;
445
508
  /** ISO timestamp for target completion time (optional) */
@@ -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.159';
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.159";
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);
@@ -1,4 +1,4 @@
1
- import { EnyoCharge, EnyoChargeFilter } from "../types/enyo-charge.js";
1
+ import { EnyoCharge, EnyoChargeFilter, EnyoDefaultChargeMode } from "../types/enyo-charge.js";
2
2
  /**
3
3
  * Interface for managing charging sessions in enyo packages.
4
4
  * Provides operations for charge session tracking and management.
@@ -14,4 +14,24 @@ export interface EnergyAppCharge {
14
14
  findActiveCharge: (applianceId: string) => Promise<EnyoCharge | null>;
15
15
  /** Find the currently active charge by appliance ID and transaction ID */
16
16
  findActiveChargeByTransactionId: (applianceId: string, transactionId: string) => Promise<EnyoCharge | null>;
17
+ /**
18
+ * Sets the default charging mode for a specific appliance, optionally
19
+ * with a target completion time and its timezone.
20
+ *
21
+ * **Required permission:** `EnergyManager`.
22
+ *
23
+ * @param applianceId - The appliance (charger) the default charge mode applies to.
24
+ * @param defaultChargeMode - The default charge mode configuration to apply.
25
+ * @returns Promise that resolves once the default charge mode is stored.
26
+ */
27
+ setDefaultChargeMode: (applianceId: string, defaultChargeMode: EnyoDefaultChargeMode) => Promise<void>;
28
+ /**
29
+ * Retrieves the currently configured default charging mode for a specific appliance.
30
+ *
31
+ * No permission is required to read the default charge mode.
32
+ *
33
+ * @param applianceId - The appliance (charger) to read the default charge mode for.
34
+ * @returns Promise resolving to the configured default charge mode
35
+ */
36
+ getDefaultChargeMode: (applianceId: string) => Promise<EnyoDefaultChargeMode>;
17
37
  }
@@ -83,6 +83,27 @@ export interface EnyoChargeScheduleEntry {
83
83
  /** Current limit in Ampere for this schedule period */
84
84
  limitAmpere: number;
85
85
  }
86
+ /**
87
+ * Default charging preference applied to charging sessions when no
88
+ * per-session mode is explicitly provided.
89
+ */
90
+ export interface EnyoDefaultChargeMode {
91
+ /** The default charging mode (e.g. immediate, cost-optimized, price-limit) */
92
+ chargeMode: EnyoChargeModeEnum;
93
+ /**
94
+ * Optional target completion time as a wall-clock time in the
95
+ * accompanying {@link EnyoDefaultChargeMode.timezone} (e.g. `"07:30"`).
96
+ * When set, optimized modes plan the session to finish by this time.
97
+ */
98
+ completeAtTime?: string;
99
+ /**
100
+ * IANA timezone the {@link EnyoDefaultChargeMode.completeAtTime} is
101
+ * expressed in (e.g. `"Europe/Berlin"`). Should be provided whenever
102
+ * `completeAtTime` is set so the wall-clock time can be resolved
103
+ * unambiguously.
104
+ */
105
+ timezone?: string;
106
+ }
86
107
  export interface EnyoChargeFilter {
87
108
  /** Filter by specific appliance ID */
88
109
  applianceId?: string;
@@ -8,6 +8,7 @@ import { EnyoCurrencyEnum } from "./enyo-currency.js";
8
8
  import { EnyoHeatpumpApplianceModeEnum } from "./enyo-heatpump-appliance.js";
9
9
  import { EnyoAirConditioningApplianceModeEnum } from "./enyo-air-conditioning-appliance.js";
10
10
  import { EnergyAppPackageCategory } from "../energy-app-package-definition.js";
11
+ import { EnyoPackageConfigurationTranslatedValue } from "./enyo-settings.js";
11
12
  /**
12
13
  * Enum representing the reason type for why a data bus command was issued.
13
14
  * Used to attach context to commands for logging, debugging, and UI display.
@@ -28,7 +29,50 @@ export declare enum EnyoDataBusCommandReasonTypeEnum {
28
29
  /** Command issued because a grid operator power limitation is active */
29
30
  GridOperatorPowerLimitationActive = "grid-operator-power-limitation-active",
30
31
  /** Command issued because a grid operator power limitation is inactive */
31
- GridOperatorPowerLimitationInactive = "grid-operator-power-limitation-inactive"
32
+ GridOperatorPowerLimitationInactive = "grid-operator-power-limitation-inactive",
33
+ /** Command issued because the battery state of charge is low */
34
+ BatterySoCLow = "battery-soc-low",
35
+ /** Command issued because the battery state of charge is high */
36
+ BatterySoCHigh = "battery-soc-high",
37
+ /** Command issued to follow the planned EV charging schedule */
38
+ EvChargingSchedule = "ev-charging-schedule",
39
+ /** Command issued as part of a planned/scheduled optimization */
40
+ ScheduledOptimization = "scheduled-optimization",
41
+ /** Command issued because the user explicitly requested it */
42
+ UserRequest = "user-request",
43
+ /** Command issued to protect the device (e.g. overheating or safety limit) */
44
+ DeviceProtection = "device-protection",
45
+ /** Command issued because home consumption is high */
46
+ HomeConsumptionHigh = "home-consumption-high",
47
+ /** Command issued to optimize self-consumption */
48
+ SelfConsumptionOptimization = "self-consumption-optimization"
49
+ }
50
+ /**
51
+ * Coarse, machine-readable grouping of why a data bus command was issued.
52
+ * Intended for filtering, iconography, and analytics. The human-readable,
53
+ * end-user explanation lives in {@link EnyoDataBusCommandReason.translation}.
54
+ */
55
+ export declare enum EnyoDataBusCommandReasonCategoryEnum {
56
+ /** Driven by the electricity price (cheap/expensive). */
57
+ EnergyPrice = "energy-price",
58
+ /** Driven by available/unavailable PV surplus. */
59
+ PvSurplus = "pv-surplus",
60
+ /** Driven by battery capacity or state of charge. */
61
+ BatteryState = "battery-state",
62
+ /** Driven by a grid operator power limitation. */
63
+ GridLimitation = "grid-limitation",
64
+ /** Driven by following a planned schedule. */
65
+ Schedule = "schedule",
66
+ /** Driven by an explicit user request. */
67
+ UserRequest = "user-request",
68
+ /** Driven by device protection / safety (e.g. overheating). */
69
+ DeviceProtection = "device-protection",
70
+ /** Driven by a temperature condition (e.g. heatpump thermal control). */
71
+ Temperature = "temperature",
72
+ /** Driven by self-consumption optimization. */
73
+ SelfConsumptionOptimization = "self-consumption-optimization",
74
+ /** Any reason not covered by the categories above. */
75
+ Other = "other"
32
76
  }
33
77
  /**
34
78
  * Interface describing the reason why a data bus command was issued.
@@ -37,6 +81,10 @@ export declare enum EnyoDataBusCommandReasonTypeEnum {
37
81
  export interface EnyoDataBusCommandReason {
38
82
  /** The reason type indicating why this command was issued */
39
83
  type: EnyoDataBusCommandReasonTypeEnum;
84
+ /** Coarse category for grouping, iconography, and analytics */
85
+ category?: EnyoDataBusCommandReasonCategoryEnum;
86
+ /** Per-language, end-user-facing explanation of this reason */
87
+ translation?: EnyoPackageConfigurationTranslatedValue[];
40
88
  /** Electricity price per kWh that triggered this command */
41
89
  electricityPricePerKwh?: number;
42
90
  /** Currency of the electricity price */
@@ -47,6 +95,10 @@ export interface EnyoDataBusCommandReason {
47
95
  powerW?: number;
48
96
  /** Relevant energy in Watt hours */
49
97
  powerWh?: number;
98
+ /** Relevant temperature in Celsius (e.g. heatpump-driven reasons) */
99
+ temperatureC?: number;
100
+ /** Relevant state of charge as a percentage (battery-driven reasons) */
101
+ socPercent?: number;
50
102
  }
51
103
  export declare enum EnyoBatteryStateEnum {
52
104
  Off = "off",
@@ -125,6 +177,15 @@ export declare enum EnyoChargeModeEnum {
125
177
  /** Optimize charging schedule for a maximum price limit, for example 7 ct grid or pv production */
126
178
  PriceLimit = "price-limit"
127
179
  }
180
+ /**
181
+ * Identifies who initiated a charging session.
182
+ */
183
+ export declare enum EnyoChargeInitiatorEnum {
184
+ /** Session was started from the enyo app (remote/user-driven start) */
185
+ App = "app",
186
+ /** Session was started directly at the charger (e.g. plug-and-charge or local autostart) */
187
+ Charger = "charger"
188
+ }
128
189
  export interface EnyoAggregatedStateApplianceValues {
129
190
  powerW?: number;
130
191
  batterySoC?: number;
@@ -440,6 +501,8 @@ export interface EnyoDataBusChargingStartedV1 extends EnyoDataBusMessage {
440
501
  transactionId: string;
441
502
  /** used charging card */
442
503
  chargingCardId?: string;
504
+ /** Who initiated the charging session — the enyo app or the charger itself */
505
+ initiator: EnyoChargeInitiatorEnum;
443
506
  /** The charge mode of the started charge. If initiated by wallbox, use either user settings or immediate as default */
444
507
  chargeMode: EnyoChargeModeEnum;
445
508
  /** ISO timestamp for target completion time (optional) */
@@ -20,7 +20,51 @@ export var EnyoDataBusCommandReasonTypeEnum;
20
20
  EnyoDataBusCommandReasonTypeEnum["GridOperatorPowerLimitationActive"] = "grid-operator-power-limitation-active";
21
21
  /** Command issued because a grid operator power limitation is inactive */
22
22
  EnyoDataBusCommandReasonTypeEnum["GridOperatorPowerLimitationInactive"] = "grid-operator-power-limitation-inactive";
23
+ /** Command issued because the battery state of charge is low */
24
+ EnyoDataBusCommandReasonTypeEnum["BatterySoCLow"] = "battery-soc-low";
25
+ /** Command issued because the battery state of charge is high */
26
+ EnyoDataBusCommandReasonTypeEnum["BatterySoCHigh"] = "battery-soc-high";
27
+ /** Command issued to follow the planned EV charging schedule */
28
+ EnyoDataBusCommandReasonTypeEnum["EvChargingSchedule"] = "ev-charging-schedule";
29
+ /** Command issued as part of a planned/scheduled optimization */
30
+ EnyoDataBusCommandReasonTypeEnum["ScheduledOptimization"] = "scheduled-optimization";
31
+ /** Command issued because the user explicitly requested it */
32
+ EnyoDataBusCommandReasonTypeEnum["UserRequest"] = "user-request";
33
+ /** Command issued to protect the device (e.g. overheating or safety limit) */
34
+ EnyoDataBusCommandReasonTypeEnum["DeviceProtection"] = "device-protection";
35
+ /** Command issued because home consumption is high */
36
+ EnyoDataBusCommandReasonTypeEnum["HomeConsumptionHigh"] = "home-consumption-high";
37
+ /** Command issued to optimize self-consumption */
38
+ EnyoDataBusCommandReasonTypeEnum["SelfConsumptionOptimization"] = "self-consumption-optimization";
23
39
  })(EnyoDataBusCommandReasonTypeEnum || (EnyoDataBusCommandReasonTypeEnum = {}));
40
+ /**
41
+ * Coarse, machine-readable grouping of why a data bus command was issued.
42
+ * Intended for filtering, iconography, and analytics. The human-readable,
43
+ * end-user explanation lives in {@link EnyoDataBusCommandReason.translation}.
44
+ */
45
+ export var EnyoDataBusCommandReasonCategoryEnum;
46
+ (function (EnyoDataBusCommandReasonCategoryEnum) {
47
+ /** Driven by the electricity price (cheap/expensive). */
48
+ EnyoDataBusCommandReasonCategoryEnum["EnergyPrice"] = "energy-price";
49
+ /** Driven by available/unavailable PV surplus. */
50
+ EnyoDataBusCommandReasonCategoryEnum["PvSurplus"] = "pv-surplus";
51
+ /** Driven by battery capacity or state of charge. */
52
+ EnyoDataBusCommandReasonCategoryEnum["BatteryState"] = "battery-state";
53
+ /** Driven by a grid operator power limitation. */
54
+ EnyoDataBusCommandReasonCategoryEnum["GridLimitation"] = "grid-limitation";
55
+ /** Driven by following a planned schedule. */
56
+ EnyoDataBusCommandReasonCategoryEnum["Schedule"] = "schedule";
57
+ /** Driven by an explicit user request. */
58
+ EnyoDataBusCommandReasonCategoryEnum["UserRequest"] = "user-request";
59
+ /** Driven by device protection / safety (e.g. overheating). */
60
+ EnyoDataBusCommandReasonCategoryEnum["DeviceProtection"] = "device-protection";
61
+ /** Driven by a temperature condition (e.g. heatpump thermal control). */
62
+ EnyoDataBusCommandReasonCategoryEnum["Temperature"] = "temperature";
63
+ /** Driven by self-consumption optimization. */
64
+ EnyoDataBusCommandReasonCategoryEnum["SelfConsumptionOptimization"] = "self-consumption-optimization";
65
+ /** Any reason not covered by the categories above. */
66
+ EnyoDataBusCommandReasonCategoryEnum["Other"] = "other";
67
+ })(EnyoDataBusCommandReasonCategoryEnum || (EnyoDataBusCommandReasonCategoryEnum = {}));
24
68
  export var EnyoBatteryStateEnum;
25
69
  (function (EnyoBatteryStateEnum) {
26
70
  EnyoBatteryStateEnum["Off"] = "off";
@@ -104,6 +148,16 @@ export var EnyoChargeModeEnum;
104
148
  /** Optimize charging schedule for a maximum price limit, for example 7 ct grid or pv production */
105
149
  EnyoChargeModeEnum["PriceLimit"] = "price-limit";
106
150
  })(EnyoChargeModeEnum || (EnyoChargeModeEnum = {}));
151
+ /**
152
+ * Identifies who initiated a charging session.
153
+ */
154
+ export var EnyoChargeInitiatorEnum;
155
+ (function (EnyoChargeInitiatorEnum) {
156
+ /** Session was started from the enyo app (remote/user-driven start) */
157
+ EnyoChargeInitiatorEnum["App"] = "app";
158
+ /** Session was started directly at the charger (e.g. plug-and-charge or local autostart) */
159
+ EnyoChargeInitiatorEnum["Charger"] = "charger";
160
+ })(EnyoChargeInitiatorEnum || (EnyoChargeInitiatorEnum = {}));
107
161
  export var EnyoDataBusMessageEnum;
108
162
  (function (EnyoDataBusMessageEnum) {
109
163
  EnyoDataBusMessageEnum["InverterValuesUpdateV1"] = "InverterValuesUpdateV1";
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.159";
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.159';
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.159",
3
+ "version": "0.0.161",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",