@enyo-energy/energy-app-sdk 0.0.77 → 0.0.78

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.
@@ -36,4 +36,7 @@ var EnergyAppPermissionTypeEnum;
36
36
  EnergyAppPermissionTypeEnum["InverterControlCommands"] = "InverterControlCommands";
37
37
  EnergyAppPermissionTypeEnum["BatteryControlCommands"] = "BatteryControlCommands";
38
38
  EnergyAppPermissionTypeEnum["ChargerControlCommands"] = "ChargerControlCommands";
39
+ EnergyAppPermissionTypeEnum["EebusDeviceManagement"] = "EebusDeviceManagement";
40
+ EnergyAppPermissionTypeEnum["EebusDataAccess"] = "EebusDataAccess";
41
+ EnergyAppPermissionTypeEnum["EebusControl"] = "EebusControl";
39
42
  })(EnergyAppPermissionTypeEnum || (exports.EnergyAppPermissionTypeEnum = EnergyAppPermissionTypeEnum = {}));
@@ -1,4 +1,4 @@
1
- export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager';
1
+ export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl';
2
2
  export declare enum EnergyAppPermissionTypeEnum {
3
3
  RestrictedInternetAccess = "RestrictedInternetAccess",
4
4
  NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
@@ -32,5 +32,8 @@ export declare enum EnergyAppPermissionTypeEnum {
32
32
  PvSystemUse = "PvSystemUse",
33
33
  InverterControlCommands = "InverterControlCommands",
34
34
  BatteryControlCommands = "BatteryControlCommands",
35
- ChargerControlCommands = "ChargerControlCommands"
35
+ ChargerControlCommands = "ChargerControlCommands",
36
+ EebusDeviceManagement = "EebusDeviceManagement",
37
+ EebusDataAccess = "EebusDataAccess",
38
+ EebusControl = "EebusControl"
36
39
  }
@@ -24,6 +24,7 @@ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs
24
24
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
25
25
  import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-generator.cjs";
26
26
  import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.cjs";
27
+ import { EnergyAppEebus } from "./packages/energy-app-eebus.cjs";
27
28
  export declare enum EnergyAppStateEnum {
28
29
  Launching = "launching",
29
30
  Running = "running",
@@ -98,4 +99,6 @@ export interface EnyoEnergyAppSdk {
98
99
  useSequenceGenerator: () => EnergyAppSequenceGenerator;
99
100
  /** Get the Modbus RTU serial communication API */
100
101
  useModbusRtu: () => EnergyAppModbusRtu;
102
+ /** Get the EEbus SHIP/SPINE communication API for device pairing, data access, and power management */
103
+ useEebus: () => EnergyAppEebus;
101
104
  }
@@ -46,6 +46,8 @@ __exportStar(require("./types/enyo-currency.cjs"), exports);
46
46
  __exportStar(require("./packages/energy-app-sequence-generator.cjs"), exports);
47
47
  __exportStar(require("./packages/energy-app-energy-prices.cjs"), exports);
48
48
  __exportStar(require("./packages/energy-app-modbus-rtu.cjs"), exports);
49
+ __exportStar(require("./types/enyo-eebus.cjs"), exports);
50
+ __exportStar(require("./packages/energy-app-eebus.cjs"), exports);
49
51
  class EnergyApp {
50
52
  energyAppSdk;
51
53
  constructor() {
@@ -211,6 +213,16 @@ class EnergyApp {
211
213
  useModbusRtu() {
212
214
  return this.energyAppSdk.useModbusRtu();
213
215
  }
216
+ /**
217
+ * Gets the EEbus API for SHIP/SPINE device communication.
218
+ * Provides device pairing and discovery, low-level SPINE data access,
219
+ * and high-level convenience methods for power management and device classification.
220
+ * Supports both appliance and energy manager roles for bidirectional communication.
221
+ * @returns The EEbus API instance
222
+ */
223
+ useEebus() {
224
+ return this.energyAppSdk.useEebus();
225
+ }
214
226
  /**
215
227
  * Gets the current SDK version.
216
228
  * @returns The semantic version string of the SDK
@@ -25,6 +25,7 @@ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs
25
25
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
26
26
  import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-generator.cjs";
27
27
  import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.cjs";
28
+ import { EnergyAppEebus } from "./packages/energy-app-eebus.cjs";
28
29
  export * from './energy-app-package-definition.cjs';
29
30
  export * from './version.cjs';
30
31
  export * from './implementations/ocpp/ocpp16.cjs';
@@ -55,6 +56,8 @@ export * from './types/enyo-currency.cjs';
55
56
  export * from './packages/energy-app-sequence-generator.cjs';
56
57
  export * from './packages/energy-app-energy-prices.cjs';
57
58
  export * from './packages/energy-app-modbus-rtu.cjs';
59
+ export * from './types/enyo-eebus.cjs';
60
+ export * from './packages/energy-app-eebus.cjs';
58
61
  export declare class EnergyApp implements EnyoEnergyAppSdk {
59
62
  private readonly energyAppSdk;
60
63
  constructor();
@@ -143,6 +146,14 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
143
146
  * @returns The Modbus RTU API instance
144
147
  */
145
148
  useModbusRtu(): EnergyAppModbusRtu;
149
+ /**
150
+ * Gets the EEbus API for SHIP/SPINE device communication.
151
+ * Provides device pairing and discovery, low-level SPINE data access,
152
+ * and high-level convenience methods for power management and device classification.
153
+ * Supports both appliance and energy manager roles for bidirectional communication.
154
+ * @returns The EEbus API instance
155
+ */
156
+ useEebus(): EnergyAppEebus;
146
157
  /**
147
158
  * Gets the current SDK version.
148
159
  * @returns The semantic version string of the SDK
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,176 @@
1
+ import { EebusConnectionStatusEnum, EebusDataPoint, EebusDevice, EebusDeviceDetails, EebusDiscoveredDevice, EebusFeatureTypeEnum, EebusPowerLimit } from "../types/enyo-eebus.cjs";
2
+ /**
3
+ * Interface for EEbus (SHIP/SPINE) device communication in enyo packages.
4
+ *
5
+ * Provides three layers of API:
6
+ * - **Device Management**: Pairing, connecting, and managing EEbus devices
7
+ * - **Low-Level API**: Direct SPINE feature data read/write/subscribe operations
8
+ * - **High-Level API**: Convenient methods for common energy use cases (power consumption, power limits, device details)
9
+ *
10
+ * The high-level API supports both directions of communication:
11
+ * - **Energy Manager role**: Reads power consumption from appliances and sends power limit commands
12
+ * - **Appliance role**: Receives power limit commands and provides power consumption data via registered handlers
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const eebus = energyApp.useEebus();
17
+ *
18
+ * // Discover and pair a device
19
+ * const discovered = await eebus.getDiscoveredDevices();
20
+ * const device = await eebus.pairDevice(discovered[0].ski);
21
+ *
22
+ * // Connect and read power (Energy Manager role)
23
+ * await eebus.connect(device.ski);
24
+ * const watts = await eebus.getPowerConsumption(device.ski);
25
+ *
26
+ * // Receive power limits (Appliance role)
27
+ * eebus.onPowerLimitReceived((ski, limit) => {
28
+ * console.log(`Received limit: ${limit.watts}W from ${ski}`);
29
+ * });
30
+ * ```
31
+ */
32
+ export interface EnergyAppEebus {
33
+ /**
34
+ * Get all devices that have been successfully paired (trusted).
35
+ * @returns Array of paired EEbus devices with their current connection status
36
+ */
37
+ getPairedDevices: () => Promise<EebusDevice[]>;
38
+ /**
39
+ * Get devices currently visible on the network that have not yet been paired.
40
+ * Uses mDNS discovery to find EEbus-capable devices.
41
+ * @returns Array of discovered but unpaired EEbus devices
42
+ */
43
+ getDiscoveredDevices: () => Promise<EebusDiscoveredDevice[]>;
44
+ /**
45
+ * Initiate the EEbus pairing (trust) handshake with a device identified by its SKI.
46
+ * The device must have been previously discovered via {@link getDiscoveredDevices}.
47
+ * @param ski Subject Key Identifier of the device to pair with
48
+ * @returns The newly paired device
49
+ */
50
+ pairDevice: (ski: string) => Promise<EebusDevice>;
51
+ /**
52
+ * Remove the trust relationship and delete stored connection information for a paired device.
53
+ * If the device is currently connected, it will be disconnected first.
54
+ * @param ski Subject Key Identifier of the device to unpair
55
+ */
56
+ unpairDevice: (ski: string) => Promise<void>;
57
+ /**
58
+ * Establish an active SHIP connection to an already-paired device.
59
+ * The device must have been previously paired via {@link pairDevice}.
60
+ * @param ski Subject Key Identifier of the device to connect to
61
+ */
62
+ connect: (ski: string) => Promise<void>;
63
+ /**
64
+ * Safely disconnect from a currently connected device.
65
+ * @param ski Subject Key Identifier of the device to disconnect from
66
+ */
67
+ disconnect: (ski: string) => Promise<void>;
68
+ /**
69
+ * Check the current connection status of a device.
70
+ * @param ski Subject Key Identifier of the device to check
71
+ * @returns The current connection status (Connected, Disconnected, or Connecting)
72
+ */
73
+ getConnectionStatus: (ski: string) => Promise<EebusConnectionStatusEnum>;
74
+ /**
75
+ * Register a listener for connection status changes of EEbus devices.
76
+ * The listener is invoked whenever any paired device's connection status changes.
77
+ * @param listener Callback invoked with the device SKI and its new connection status
78
+ * @returns Listener ID that can be passed to {@link removeListener} to stop listening
79
+ */
80
+ listenForConnectionStatusChange: (listener: (ski: string, status: EebusConnectionStatusEnum) => void) => string;
81
+ /**
82
+ * Read specific data points from a device's SPINE feature.
83
+ * @param ski Subject Key Identifier of the target device
84
+ * @param featureType The SPINE feature type to read from
85
+ * @param functionName The specific function or data set to read (e.g. "measurementListData")
86
+ * @returns The data point containing the value, timestamp, and optional unit
87
+ */
88
+ readData: (ski: string, featureType: EebusFeatureTypeEnum, functionName: string) => Promise<EebusDataPoint>;
89
+ /**
90
+ * Write data or send a command to a device's SPINE feature.
91
+ * @param ski Subject Key Identifier of the target device
92
+ * @param featureType The SPINE feature type to write to
93
+ * @param functionName The specific function or command to invoke (e.g. "loadControlLimitListData")
94
+ * @param payload The data payload to send
95
+ */
96
+ writeData: (ski: string, featureType: EebusFeatureTypeEnum, functionName: string, payload: unknown) => Promise<void>;
97
+ /**
98
+ * Subscribe to automatic notifications when a SPINE feature's data changes on the remote device.
99
+ * Sets up a SPINE binding so the local device is notified whenever the subscribed data changes.
100
+ * @param ski Subject Key Identifier of the target device
101
+ * @param featureType The SPINE feature type to subscribe to
102
+ * @param listener Callback invoked with updated data whenever the value changes
103
+ * @returns Listener ID that can be passed to {@link removeListener} to cancel the subscription
104
+ */
105
+ subscribe: (ski: string, featureType: EebusFeatureTypeEnum, listener: (data: EebusDataPoint) => void) => string;
106
+ /**
107
+ * Get the current active power consumption of a remote device in Watts.
108
+ * Reads the Measurement feature (SPINE) for active power data.
109
+ * Intended for the **energy manager role** — reading consumption from a remote appliance.
110
+ * @param ski Subject Key Identifier of the target device
111
+ * @returns Current power consumption in Watts
112
+ */
113
+ getPowerConsumption: (ski: string) => Promise<number>;
114
+ /**
115
+ * Send a power limit command to a consumer device (e.g. a wallbox).
116
+ * Uses the LoadControl feature (SPINE) to set consumption limits.
117
+ * Intended for the **energy manager role** — sending limits to a remote appliance.
118
+ * @param ski Subject Key Identifier of the target device
119
+ * @param limit The power limit to apply, including watts and optional duration
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * // Limit a wallbox to 11kW
124
+ * await eebus.setPowerLimit(wallboxSki, { watts: 11000 });
125
+ *
126
+ * // Temporary limit for 30 minutes
127
+ * await eebus.setPowerLimit(wallboxSki, { watts: 6000, durationSeconds: 1800 });
128
+ * ```
129
+ */
130
+ setPowerLimit: (ski: string, limit: EebusPowerLimit) => Promise<void>;
131
+ /**
132
+ * Get detailed device information including manufacturer, model, and serial number.
133
+ * Reads the DeviceClassification feature (SPINE).
134
+ * @param ski Subject Key Identifier of the target device
135
+ * @returns Device classification details
136
+ */
137
+ getDeviceDetails: (ski: string) => Promise<EebusDeviceDetails>;
138
+ /**
139
+ * Register a handler for incoming power limit commands (appliance role).
140
+ * When this device acts as an appliance, a remote energy manager may send
141
+ * power limit commands via LoadControl. This handler is invoked for each incoming command.
142
+ * @param handler Callback invoked with the sender's SKI and the power limit received
143
+ * @returns Listener ID that can be passed to {@link removeListener} to deregister the handler
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * eebus.onPowerLimitReceived((ski, limit) => {
148
+ * console.log(`Energy manager ${ski} requests limit: ${limit.watts}W`);
149
+ * applyChargingLimit(limit.watts);
150
+ * });
151
+ * ```
152
+ */
153
+ onPowerLimitReceived: (handler: (ski: string, limit: EebusPowerLimit) => void) => string;
154
+ /**
155
+ * Register a handler to provide power consumption data on request (appliance role).
156
+ * When this device acts as an appliance, a remote energy manager may request
157
+ * the current power consumption. The handler should return the current value in Watts.
158
+ * @param handler Async callback invoked with the requester's SKI, returning power in Watts
159
+ * @returns Listener ID that can be passed to {@link removeListener} to deregister the handler
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * eebus.onPowerConsumptionRequested(async (ski) => {
164
+ * return getCurrentChargingPowerWatts();
165
+ * });
166
+ * ```
167
+ */
168
+ onPowerConsumptionRequested: (handler: (ski: string) => Promise<number>) => string;
169
+ /**
170
+ * Remove a previously registered listener, subscription, or handler.
171
+ * Works for IDs returned by {@link listenForConnectionStatusChange}, {@link subscribe},
172
+ * {@link onPowerLimitReceived}, and {@link onPowerConsumptionRequested}.
173
+ * @param listenerId The ID returned by the registration method
174
+ */
175
+ removeListener: (listenerId: string) => void;
176
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EebusFeatureTypeEnum = exports.EebusConnectionStatusEnum = void 0;
4
+ /**
5
+ * Enum representing the connection status of an EEbus device.
6
+ */
7
+ var EebusConnectionStatusEnum;
8
+ (function (EebusConnectionStatusEnum) {
9
+ /** The device is actively connected via SHIP */
10
+ EebusConnectionStatusEnum["Connected"] = "connected";
11
+ /** The device is not connected */
12
+ EebusConnectionStatusEnum["Disconnected"] = "disconnected";
13
+ /** A SHIP connection is currently being established */
14
+ EebusConnectionStatusEnum["Connecting"] = "connecting";
15
+ })(EebusConnectionStatusEnum || (exports.EebusConnectionStatusEnum = EebusConnectionStatusEnum = {}));
16
+ /**
17
+ * Enum representing EEbus SPINE feature types for low-level data access.
18
+ * These map to the functional model feature types defined in the SPINE specification.
19
+ */
20
+ var EebusFeatureTypeEnum;
21
+ (function (EebusFeatureTypeEnum) {
22
+ /** Device manufacturer, model, serial number */
23
+ EebusFeatureTypeEnum["DeviceClassification"] = "DeviceClassification";
24
+ /** Device operational state and diagnostics */
25
+ EebusFeatureTypeEnum["DeviceDiagnosis"] = "DeviceDiagnosis";
26
+ /** Electrical connection parameters (voltage, current, power limits) */
27
+ EebusFeatureTypeEnum["ElectricalConnection"] = "ElectricalConnection";
28
+ /** Measurement data (power, energy, temperature) */
29
+ EebusFeatureTypeEnum["Measurement"] = "Measurement";
30
+ /** Load control limits and obligations */
31
+ EebusFeatureTypeEnum["LoadControl"] = "LoadControl";
32
+ /** Device configuration key-value pairs */
33
+ EebusFeatureTypeEnum["DeviceConfiguration"] = "DeviceConfiguration";
34
+ /** Device and entity identification */
35
+ EebusFeatureTypeEnum["Identification"] = "Identification";
36
+ })(EebusFeatureTypeEnum || (exports.EebusFeatureTypeEnum = EebusFeatureTypeEnum = {}));
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Enum representing the connection status of an EEbus device.
3
+ */
4
+ export declare enum EebusConnectionStatusEnum {
5
+ /** The device is actively connected via SHIP */
6
+ Connected = "connected",
7
+ /** The device is not connected */
8
+ Disconnected = "disconnected",
9
+ /** A SHIP connection is currently being established */
10
+ Connecting = "connecting"
11
+ }
12
+ /**
13
+ * Enum representing EEbus SPINE feature types for low-level data access.
14
+ * These map to the functional model feature types defined in the SPINE specification.
15
+ */
16
+ export declare enum EebusFeatureTypeEnum {
17
+ /** Device manufacturer, model, serial number */
18
+ DeviceClassification = "DeviceClassification",
19
+ /** Device operational state and diagnostics */
20
+ DeviceDiagnosis = "DeviceDiagnosis",
21
+ /** Electrical connection parameters (voltage, current, power limits) */
22
+ ElectricalConnection = "ElectricalConnection",
23
+ /** Measurement data (power, energy, temperature) */
24
+ Measurement = "Measurement",
25
+ /** Load control limits and obligations */
26
+ LoadControl = "LoadControl",
27
+ /** Device configuration key-value pairs */
28
+ DeviceConfiguration = "DeviceConfiguration",
29
+ /** Device and entity identification */
30
+ Identification = "Identification"
31
+ }
32
+ /**
33
+ * Represents an EEbus device that has been successfully paired (trusted).
34
+ */
35
+ export interface EebusDevice {
36
+ /** Subject Key Identifier — unique cryptographic identifier for the device */
37
+ ski: string;
38
+ /** Human-readable device name */
39
+ deviceName: string;
40
+ /** Device brand or model description, if available */
41
+ deviceModel?: string;
42
+ /** Current connection status of the device */
43
+ connectionStatus: EebusConnectionStatusEnum;
44
+ /** Timestamp of when the pairing (trust) was established */
45
+ pairedAt: Date;
46
+ /** Timestamp of the last successful communication with the device */
47
+ lastSeen?: Date;
48
+ }
49
+ /**
50
+ * Represents a device discovered on the network via mDNS that has not yet been paired.
51
+ */
52
+ export interface EebusDiscoveredDevice {
53
+ /** Subject Key Identifier — unique cryptographic identifier for the device */
54
+ ski: string;
55
+ /** Human-readable device name advertised during discovery */
56
+ deviceName?: string;
57
+ /** IP address or hostname of the device */
58
+ host: string;
59
+ /** Port number for the SHIP connection */
60
+ port: number;
61
+ }
62
+ /**
63
+ * Detailed device information retrieved from the EEbus Device Classification feature.
64
+ */
65
+ export interface EebusDeviceDetails {
66
+ /** Device manufacturer name */
67
+ manufacturer?: string;
68
+ /** Device model name */
69
+ model?: string;
70
+ /** Device serial number */
71
+ serialNumber?: string;
72
+ /** Firmware or software version of the device */
73
+ softwareVersion?: string;
74
+ /** Hardware version of the device */
75
+ hardwareVersion?: string;
76
+ /** Device type description */
77
+ deviceType?: string;
78
+ }
79
+ /**
80
+ * Represents a data point read from an EEbus device via the low-level SPINE API.
81
+ */
82
+ export interface EebusDataPoint {
83
+ /** The value of the data point */
84
+ value: unknown;
85
+ /** Timestamp when the value was read or last updated */
86
+ timestamp: Date;
87
+ /** Unit of measurement, if applicable (e.g. "W", "Wh", "°C") */
88
+ unit?: string;
89
+ }
90
+ /**
91
+ * Represents a power limit command to be sent to or received from an EEbus device.
92
+ */
93
+ export interface EebusPowerLimit {
94
+ /** Power limit in Watts */
95
+ watts: number;
96
+ /** Whether this limit is an obligation (true) or a recommendation (false). Defaults to true. */
97
+ isObligatory?: boolean;
98
+ /** Duration in seconds for which the limit applies. 0 or undefined means indefinite. */
99
+ durationSeconds?: number;
100
+ }
@@ -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.77';
12
+ exports.SDK_VERSION = '0.0.78';
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.77";
8
+ export declare const SDK_VERSION = "0.0.78";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -1,4 +1,4 @@
1
- export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager';
1
+ export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl';
2
2
  export declare enum EnergyAppPermissionTypeEnum {
3
3
  RestrictedInternetAccess = "RestrictedInternetAccess",
4
4
  NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
@@ -32,5 +32,8 @@ export declare enum EnergyAppPermissionTypeEnum {
32
32
  PvSystemUse = "PvSystemUse",
33
33
  InverterControlCommands = "InverterControlCommands",
34
34
  BatteryControlCommands = "BatteryControlCommands",
35
- ChargerControlCommands = "ChargerControlCommands"
35
+ ChargerControlCommands = "ChargerControlCommands",
36
+ EebusDeviceManagement = "EebusDeviceManagement",
37
+ EebusDataAccess = "EebusDataAccess",
38
+ EebusControl = "EebusControl"
36
39
  }
@@ -33,4 +33,7 @@ export var EnergyAppPermissionTypeEnum;
33
33
  EnergyAppPermissionTypeEnum["InverterControlCommands"] = "InverterControlCommands";
34
34
  EnergyAppPermissionTypeEnum["BatteryControlCommands"] = "BatteryControlCommands";
35
35
  EnergyAppPermissionTypeEnum["ChargerControlCommands"] = "ChargerControlCommands";
36
+ EnergyAppPermissionTypeEnum["EebusDeviceManagement"] = "EebusDeviceManagement";
37
+ EnergyAppPermissionTypeEnum["EebusDataAccess"] = "EebusDataAccess";
38
+ EnergyAppPermissionTypeEnum["EebusControl"] = "EebusControl";
36
39
  })(EnergyAppPermissionTypeEnum || (EnergyAppPermissionTypeEnum = {}));
@@ -24,6 +24,7 @@ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.js"
24
24
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.js";
25
25
  import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-generator.js";
26
26
  import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.js";
27
+ import { EnergyAppEebus } from "./packages/energy-app-eebus.js";
27
28
  export declare enum EnergyAppStateEnum {
28
29
  Launching = "launching",
29
30
  Running = "running",
@@ -98,4 +99,6 @@ export interface EnyoEnergyAppSdk {
98
99
  useSequenceGenerator: () => EnergyAppSequenceGenerator;
99
100
  /** Get the Modbus RTU serial communication API */
100
101
  useModbusRtu: () => EnergyAppModbusRtu;
102
+ /** Get the EEbus SHIP/SPINE communication API for device pairing, data access, and power management */
103
+ useEebus: () => EnergyAppEebus;
101
104
  }
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.js"
25
25
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.js";
26
26
  import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-generator.js";
27
27
  import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.js";
28
+ import { EnergyAppEebus } from "./packages/energy-app-eebus.js";
28
29
  export * from './energy-app-package-definition.js';
29
30
  export * from './version.js';
30
31
  export * from './implementations/ocpp/ocpp16.js';
@@ -55,6 +56,8 @@ export * from './types/enyo-currency.js';
55
56
  export * from './packages/energy-app-sequence-generator.js';
56
57
  export * from './packages/energy-app-energy-prices.js';
57
58
  export * from './packages/energy-app-modbus-rtu.js';
59
+ export * from './types/enyo-eebus.js';
60
+ export * from './packages/energy-app-eebus.js';
58
61
  export declare class EnergyApp implements EnyoEnergyAppSdk {
59
62
  private readonly energyAppSdk;
60
63
  constructor();
@@ -143,6 +146,14 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
143
146
  * @returns The Modbus RTU API instance
144
147
  */
145
148
  useModbusRtu(): EnergyAppModbusRtu;
149
+ /**
150
+ * Gets the EEbus API for SHIP/SPINE device communication.
151
+ * Provides device pairing and discovery, low-level SPINE data access,
152
+ * and high-level convenience methods for power management and device classification.
153
+ * Supports both appliance and energy manager roles for bidirectional communication.
154
+ * @returns The EEbus API instance
155
+ */
156
+ useEebus(): EnergyAppEebus;
146
157
  /**
147
158
  * Gets the current SDK version.
148
159
  * @returns The semantic version string of the SDK
package/dist/index.js CHANGED
@@ -29,6 +29,8 @@ export * from './types/enyo-currency.js';
29
29
  export * from './packages/energy-app-sequence-generator.js';
30
30
  export * from './packages/energy-app-energy-prices.js';
31
31
  export * from './packages/energy-app-modbus-rtu.js';
32
+ export * from './types/enyo-eebus.js';
33
+ export * from './packages/energy-app-eebus.js';
32
34
  export class EnergyApp {
33
35
  energyAppSdk;
34
36
  constructor() {
@@ -194,6 +196,16 @@ export class EnergyApp {
194
196
  useModbusRtu() {
195
197
  return this.energyAppSdk.useModbusRtu();
196
198
  }
199
+ /**
200
+ * Gets the EEbus API for SHIP/SPINE device communication.
201
+ * Provides device pairing and discovery, low-level SPINE data access,
202
+ * and high-level convenience methods for power management and device classification.
203
+ * Supports both appliance and energy manager roles for bidirectional communication.
204
+ * @returns The EEbus API instance
205
+ */
206
+ useEebus() {
207
+ return this.energyAppSdk.useEebus();
208
+ }
197
209
  /**
198
210
  * Gets the current SDK version.
199
211
  * @returns The semantic version string of the SDK
@@ -0,0 +1,176 @@
1
+ import { EebusConnectionStatusEnum, EebusDataPoint, EebusDevice, EebusDeviceDetails, EebusDiscoveredDevice, EebusFeatureTypeEnum, EebusPowerLimit } from "../types/enyo-eebus.js";
2
+ /**
3
+ * Interface for EEbus (SHIP/SPINE) device communication in enyo packages.
4
+ *
5
+ * Provides three layers of API:
6
+ * - **Device Management**: Pairing, connecting, and managing EEbus devices
7
+ * - **Low-Level API**: Direct SPINE feature data read/write/subscribe operations
8
+ * - **High-Level API**: Convenient methods for common energy use cases (power consumption, power limits, device details)
9
+ *
10
+ * The high-level API supports both directions of communication:
11
+ * - **Energy Manager role**: Reads power consumption from appliances and sends power limit commands
12
+ * - **Appliance role**: Receives power limit commands and provides power consumption data via registered handlers
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const eebus = energyApp.useEebus();
17
+ *
18
+ * // Discover and pair a device
19
+ * const discovered = await eebus.getDiscoveredDevices();
20
+ * const device = await eebus.pairDevice(discovered[0].ski);
21
+ *
22
+ * // Connect and read power (Energy Manager role)
23
+ * await eebus.connect(device.ski);
24
+ * const watts = await eebus.getPowerConsumption(device.ski);
25
+ *
26
+ * // Receive power limits (Appliance role)
27
+ * eebus.onPowerLimitReceived((ski, limit) => {
28
+ * console.log(`Received limit: ${limit.watts}W from ${ski}`);
29
+ * });
30
+ * ```
31
+ */
32
+ export interface EnergyAppEebus {
33
+ /**
34
+ * Get all devices that have been successfully paired (trusted).
35
+ * @returns Array of paired EEbus devices with their current connection status
36
+ */
37
+ getPairedDevices: () => Promise<EebusDevice[]>;
38
+ /**
39
+ * Get devices currently visible on the network that have not yet been paired.
40
+ * Uses mDNS discovery to find EEbus-capable devices.
41
+ * @returns Array of discovered but unpaired EEbus devices
42
+ */
43
+ getDiscoveredDevices: () => Promise<EebusDiscoveredDevice[]>;
44
+ /**
45
+ * Initiate the EEbus pairing (trust) handshake with a device identified by its SKI.
46
+ * The device must have been previously discovered via {@link getDiscoveredDevices}.
47
+ * @param ski Subject Key Identifier of the device to pair with
48
+ * @returns The newly paired device
49
+ */
50
+ pairDevice: (ski: string) => Promise<EebusDevice>;
51
+ /**
52
+ * Remove the trust relationship and delete stored connection information for a paired device.
53
+ * If the device is currently connected, it will be disconnected first.
54
+ * @param ski Subject Key Identifier of the device to unpair
55
+ */
56
+ unpairDevice: (ski: string) => Promise<void>;
57
+ /**
58
+ * Establish an active SHIP connection to an already-paired device.
59
+ * The device must have been previously paired via {@link pairDevice}.
60
+ * @param ski Subject Key Identifier of the device to connect to
61
+ */
62
+ connect: (ski: string) => Promise<void>;
63
+ /**
64
+ * Safely disconnect from a currently connected device.
65
+ * @param ski Subject Key Identifier of the device to disconnect from
66
+ */
67
+ disconnect: (ski: string) => Promise<void>;
68
+ /**
69
+ * Check the current connection status of a device.
70
+ * @param ski Subject Key Identifier of the device to check
71
+ * @returns The current connection status (Connected, Disconnected, or Connecting)
72
+ */
73
+ getConnectionStatus: (ski: string) => Promise<EebusConnectionStatusEnum>;
74
+ /**
75
+ * Register a listener for connection status changes of EEbus devices.
76
+ * The listener is invoked whenever any paired device's connection status changes.
77
+ * @param listener Callback invoked with the device SKI and its new connection status
78
+ * @returns Listener ID that can be passed to {@link removeListener} to stop listening
79
+ */
80
+ listenForConnectionStatusChange: (listener: (ski: string, status: EebusConnectionStatusEnum) => void) => string;
81
+ /**
82
+ * Read specific data points from a device's SPINE feature.
83
+ * @param ski Subject Key Identifier of the target device
84
+ * @param featureType The SPINE feature type to read from
85
+ * @param functionName The specific function or data set to read (e.g. "measurementListData")
86
+ * @returns The data point containing the value, timestamp, and optional unit
87
+ */
88
+ readData: (ski: string, featureType: EebusFeatureTypeEnum, functionName: string) => Promise<EebusDataPoint>;
89
+ /**
90
+ * Write data or send a command to a device's SPINE feature.
91
+ * @param ski Subject Key Identifier of the target device
92
+ * @param featureType The SPINE feature type to write to
93
+ * @param functionName The specific function or command to invoke (e.g. "loadControlLimitListData")
94
+ * @param payload The data payload to send
95
+ */
96
+ writeData: (ski: string, featureType: EebusFeatureTypeEnum, functionName: string, payload: unknown) => Promise<void>;
97
+ /**
98
+ * Subscribe to automatic notifications when a SPINE feature's data changes on the remote device.
99
+ * Sets up a SPINE binding so the local device is notified whenever the subscribed data changes.
100
+ * @param ski Subject Key Identifier of the target device
101
+ * @param featureType The SPINE feature type to subscribe to
102
+ * @param listener Callback invoked with updated data whenever the value changes
103
+ * @returns Listener ID that can be passed to {@link removeListener} to cancel the subscription
104
+ */
105
+ subscribe: (ski: string, featureType: EebusFeatureTypeEnum, listener: (data: EebusDataPoint) => void) => string;
106
+ /**
107
+ * Get the current active power consumption of a remote device in Watts.
108
+ * Reads the Measurement feature (SPINE) for active power data.
109
+ * Intended for the **energy manager role** — reading consumption from a remote appliance.
110
+ * @param ski Subject Key Identifier of the target device
111
+ * @returns Current power consumption in Watts
112
+ */
113
+ getPowerConsumption: (ski: string) => Promise<number>;
114
+ /**
115
+ * Send a power limit command to a consumer device (e.g. a wallbox).
116
+ * Uses the LoadControl feature (SPINE) to set consumption limits.
117
+ * Intended for the **energy manager role** — sending limits to a remote appliance.
118
+ * @param ski Subject Key Identifier of the target device
119
+ * @param limit The power limit to apply, including watts and optional duration
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * // Limit a wallbox to 11kW
124
+ * await eebus.setPowerLimit(wallboxSki, { watts: 11000 });
125
+ *
126
+ * // Temporary limit for 30 minutes
127
+ * await eebus.setPowerLimit(wallboxSki, { watts: 6000, durationSeconds: 1800 });
128
+ * ```
129
+ */
130
+ setPowerLimit: (ski: string, limit: EebusPowerLimit) => Promise<void>;
131
+ /**
132
+ * Get detailed device information including manufacturer, model, and serial number.
133
+ * Reads the DeviceClassification feature (SPINE).
134
+ * @param ski Subject Key Identifier of the target device
135
+ * @returns Device classification details
136
+ */
137
+ getDeviceDetails: (ski: string) => Promise<EebusDeviceDetails>;
138
+ /**
139
+ * Register a handler for incoming power limit commands (appliance role).
140
+ * When this device acts as an appliance, a remote energy manager may send
141
+ * power limit commands via LoadControl. This handler is invoked for each incoming command.
142
+ * @param handler Callback invoked with the sender's SKI and the power limit received
143
+ * @returns Listener ID that can be passed to {@link removeListener} to deregister the handler
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * eebus.onPowerLimitReceived((ski, limit) => {
148
+ * console.log(`Energy manager ${ski} requests limit: ${limit.watts}W`);
149
+ * applyChargingLimit(limit.watts);
150
+ * });
151
+ * ```
152
+ */
153
+ onPowerLimitReceived: (handler: (ski: string, limit: EebusPowerLimit) => void) => string;
154
+ /**
155
+ * Register a handler to provide power consumption data on request (appliance role).
156
+ * When this device acts as an appliance, a remote energy manager may request
157
+ * the current power consumption. The handler should return the current value in Watts.
158
+ * @param handler Async callback invoked with the requester's SKI, returning power in Watts
159
+ * @returns Listener ID that can be passed to {@link removeListener} to deregister the handler
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * eebus.onPowerConsumptionRequested(async (ski) => {
164
+ * return getCurrentChargingPowerWatts();
165
+ * });
166
+ * ```
167
+ */
168
+ onPowerConsumptionRequested: (handler: (ski: string) => Promise<number>) => string;
169
+ /**
170
+ * Remove a previously registered listener, subscription, or handler.
171
+ * Works for IDs returned by {@link listenForConnectionStatusChange}, {@link subscribe},
172
+ * {@link onPowerLimitReceived}, and {@link onPowerConsumptionRequested}.
173
+ * @param listenerId The ID returned by the registration method
174
+ */
175
+ removeListener: (listenerId: string) => void;
176
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Enum representing the connection status of an EEbus device.
3
+ */
4
+ export declare enum EebusConnectionStatusEnum {
5
+ /** The device is actively connected via SHIP */
6
+ Connected = "connected",
7
+ /** The device is not connected */
8
+ Disconnected = "disconnected",
9
+ /** A SHIP connection is currently being established */
10
+ Connecting = "connecting"
11
+ }
12
+ /**
13
+ * Enum representing EEbus SPINE feature types for low-level data access.
14
+ * These map to the functional model feature types defined in the SPINE specification.
15
+ */
16
+ export declare enum EebusFeatureTypeEnum {
17
+ /** Device manufacturer, model, serial number */
18
+ DeviceClassification = "DeviceClassification",
19
+ /** Device operational state and diagnostics */
20
+ DeviceDiagnosis = "DeviceDiagnosis",
21
+ /** Electrical connection parameters (voltage, current, power limits) */
22
+ ElectricalConnection = "ElectricalConnection",
23
+ /** Measurement data (power, energy, temperature) */
24
+ Measurement = "Measurement",
25
+ /** Load control limits and obligations */
26
+ LoadControl = "LoadControl",
27
+ /** Device configuration key-value pairs */
28
+ DeviceConfiguration = "DeviceConfiguration",
29
+ /** Device and entity identification */
30
+ Identification = "Identification"
31
+ }
32
+ /**
33
+ * Represents an EEbus device that has been successfully paired (trusted).
34
+ */
35
+ export interface EebusDevice {
36
+ /** Subject Key Identifier — unique cryptographic identifier for the device */
37
+ ski: string;
38
+ /** Human-readable device name */
39
+ deviceName: string;
40
+ /** Device brand or model description, if available */
41
+ deviceModel?: string;
42
+ /** Current connection status of the device */
43
+ connectionStatus: EebusConnectionStatusEnum;
44
+ /** Timestamp of when the pairing (trust) was established */
45
+ pairedAt: Date;
46
+ /** Timestamp of the last successful communication with the device */
47
+ lastSeen?: Date;
48
+ }
49
+ /**
50
+ * Represents a device discovered on the network via mDNS that has not yet been paired.
51
+ */
52
+ export interface EebusDiscoveredDevice {
53
+ /** Subject Key Identifier — unique cryptographic identifier for the device */
54
+ ski: string;
55
+ /** Human-readable device name advertised during discovery */
56
+ deviceName?: string;
57
+ /** IP address or hostname of the device */
58
+ host: string;
59
+ /** Port number for the SHIP connection */
60
+ port: number;
61
+ }
62
+ /**
63
+ * Detailed device information retrieved from the EEbus Device Classification feature.
64
+ */
65
+ export interface EebusDeviceDetails {
66
+ /** Device manufacturer name */
67
+ manufacturer?: string;
68
+ /** Device model name */
69
+ model?: string;
70
+ /** Device serial number */
71
+ serialNumber?: string;
72
+ /** Firmware or software version of the device */
73
+ softwareVersion?: string;
74
+ /** Hardware version of the device */
75
+ hardwareVersion?: string;
76
+ /** Device type description */
77
+ deviceType?: string;
78
+ }
79
+ /**
80
+ * Represents a data point read from an EEbus device via the low-level SPINE API.
81
+ */
82
+ export interface EebusDataPoint {
83
+ /** The value of the data point */
84
+ value: unknown;
85
+ /** Timestamp when the value was read or last updated */
86
+ timestamp: Date;
87
+ /** Unit of measurement, if applicable (e.g. "W", "Wh", "°C") */
88
+ unit?: string;
89
+ }
90
+ /**
91
+ * Represents a power limit command to be sent to or received from an EEbus device.
92
+ */
93
+ export interface EebusPowerLimit {
94
+ /** Power limit in Watts */
95
+ watts: number;
96
+ /** Whether this limit is an obligation (true) or a recommendation (false). Defaults to true. */
97
+ isObligatory?: boolean;
98
+ /** Duration in seconds for which the limit applies. 0 or undefined means indefinite. */
99
+ durationSeconds?: number;
100
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Enum representing the connection status of an EEbus device.
3
+ */
4
+ export var EebusConnectionStatusEnum;
5
+ (function (EebusConnectionStatusEnum) {
6
+ /** The device is actively connected via SHIP */
7
+ EebusConnectionStatusEnum["Connected"] = "connected";
8
+ /** The device is not connected */
9
+ EebusConnectionStatusEnum["Disconnected"] = "disconnected";
10
+ /** A SHIP connection is currently being established */
11
+ EebusConnectionStatusEnum["Connecting"] = "connecting";
12
+ })(EebusConnectionStatusEnum || (EebusConnectionStatusEnum = {}));
13
+ /**
14
+ * Enum representing EEbus SPINE feature types for low-level data access.
15
+ * These map to the functional model feature types defined in the SPINE specification.
16
+ */
17
+ export var EebusFeatureTypeEnum;
18
+ (function (EebusFeatureTypeEnum) {
19
+ /** Device manufacturer, model, serial number */
20
+ EebusFeatureTypeEnum["DeviceClassification"] = "DeviceClassification";
21
+ /** Device operational state and diagnostics */
22
+ EebusFeatureTypeEnum["DeviceDiagnosis"] = "DeviceDiagnosis";
23
+ /** Electrical connection parameters (voltage, current, power limits) */
24
+ EebusFeatureTypeEnum["ElectricalConnection"] = "ElectricalConnection";
25
+ /** Measurement data (power, energy, temperature) */
26
+ EebusFeatureTypeEnum["Measurement"] = "Measurement";
27
+ /** Load control limits and obligations */
28
+ EebusFeatureTypeEnum["LoadControl"] = "LoadControl";
29
+ /** Device configuration key-value pairs */
30
+ EebusFeatureTypeEnum["DeviceConfiguration"] = "DeviceConfiguration";
31
+ /** Device and entity identification */
32
+ EebusFeatureTypeEnum["Identification"] = "Identification";
33
+ })(EebusFeatureTypeEnum || (EebusFeatureTypeEnum = {}));
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.77";
8
+ export declare const SDK_VERSION = "0.0.78";
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.77';
8
+ export const SDK_VERSION = '0.0.78';
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.77",
3
+ "version": "0.0.78",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",