@enyo-energy/energy-app-sdk 0.0.58 → 0.0.60

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.
Files changed (69) hide show
  1. package/dist/cjs/energy-app-package-definition.d.cts +0 -2
  2. package/dist/cjs/energy-app-permission.type.cjs +7 -0
  3. package/dist/cjs/energy-app-permission.type.d.cts +9 -2
  4. package/dist/cjs/enyo-energy-app-sdk.d.cts +13 -1
  5. package/dist/cjs/implementations/data-bus/data-bus-command-handler.cjs +140 -0
  6. package/dist/cjs/implementations/data-bus/data-bus-command-handler.d.cts +114 -0
  7. package/dist/cjs/implementations/ocpp/ocpp16.cjs +2 -1
  8. package/dist/cjs/implementations/ocpp/ocpp16.d.cts +6 -7
  9. package/dist/cjs/implementations/ocpp/ocpp201.cjs +2 -1
  10. package/dist/cjs/implementations/ocpp/ocpp201.d.cts +5 -9
  11. package/dist/cjs/index.cjs +44 -0
  12. package/dist/cjs/index.d.cts +40 -0
  13. package/dist/cjs/packages/energy-app-electricity-prices.d.cts +15 -0
  14. package/dist/cjs/packages/energy-app-electricity-tariff.cjs +2 -0
  15. package/dist/cjs/packages/energy-app-electricity-tariff.d.cts +33 -0
  16. package/dist/cjs/packages/energy-app-pv-forecasting.cjs +2 -0
  17. package/dist/cjs/packages/energy-app-pv-forecasting.d.cts +63 -0
  18. package/dist/cjs/packages/energy-app-pv-system.cjs +2 -0
  19. package/dist/cjs/packages/energy-app-pv-system.d.cts +70 -0
  20. package/dist/cjs/packages/energy-app-weather-forecasting.cjs +2 -0
  21. package/dist/cjs/packages/energy-app-weather-forecasting.d.cts +89 -0
  22. package/dist/cjs/types/enyo-data-bus-value.cjs +20 -1
  23. package/dist/cjs/types/enyo-data-bus-value.d.cts +110 -2
  24. package/dist/cjs/types/enyo-electricity-prices.d.cts +2 -0
  25. package/dist/cjs/types/enyo-electricity-tariff.cjs +15 -0
  26. package/dist/cjs/types/enyo-electricity-tariff.d.cts +34 -0
  27. package/dist/cjs/types/enyo-forecasting.cjs +25 -0
  28. package/dist/cjs/types/enyo-forecasting.d.cts +110 -0
  29. package/dist/cjs/types/enyo-pv-forecast.cjs +2 -0
  30. package/dist/cjs/types/enyo-pv-forecast.d.cts +22 -0
  31. package/dist/cjs/types/enyo-pv-system.cjs +26 -0
  32. package/dist/cjs/types/enyo-pv-system.d.cts +70 -0
  33. package/dist/cjs/version.cjs +1 -1
  34. package/dist/cjs/version.d.cts +1 -1
  35. package/dist/energy-app-package-definition.d.ts +0 -2
  36. package/dist/energy-app-permission.type.d.ts +9 -2
  37. package/dist/energy-app-permission.type.js +7 -0
  38. package/dist/enyo-energy-app-sdk.d.ts +13 -1
  39. package/dist/implementations/data-bus/data-bus-command-handler.d.ts +114 -0
  40. package/dist/implementations/data-bus/data-bus-command-handler.js +135 -0
  41. package/dist/implementations/ocpp/ocpp16.d.ts +6 -7
  42. package/dist/implementations/ocpp/ocpp16.js +2 -1
  43. package/dist/implementations/ocpp/ocpp201.d.ts +5 -9
  44. package/dist/implementations/ocpp/ocpp201.js +2 -1
  45. package/dist/index.d.ts +40 -0
  46. package/dist/index.js +44 -0
  47. package/dist/packages/energy-app-electricity-prices.d.ts +15 -0
  48. package/dist/packages/energy-app-electricity-tariff.d.ts +33 -0
  49. package/dist/packages/energy-app-electricity-tariff.js +1 -0
  50. package/dist/packages/energy-app-pv-forecasting.d.ts +63 -0
  51. package/dist/packages/energy-app-pv-forecasting.js +1 -0
  52. package/dist/packages/energy-app-pv-system.d.ts +70 -0
  53. package/dist/packages/energy-app-pv-system.js +1 -0
  54. package/dist/packages/energy-app-weather-forecasting.d.ts +89 -0
  55. package/dist/packages/energy-app-weather-forecasting.js +1 -0
  56. package/dist/types/enyo-data-bus-value.d.ts +110 -2
  57. package/dist/types/enyo-data-bus-value.js +19 -0
  58. package/dist/types/enyo-electricity-prices.d.ts +2 -0
  59. package/dist/types/enyo-electricity-tariff.d.ts +34 -0
  60. package/dist/types/enyo-electricity-tariff.js +12 -0
  61. package/dist/types/enyo-forecasting.d.ts +110 -0
  62. package/dist/types/enyo-forecasting.js +22 -0
  63. package/dist/types/enyo-pv-forecast.d.ts +22 -0
  64. package/dist/types/enyo-pv-forecast.js +1 -0
  65. package/dist/types/enyo-pv-system.d.ts +70 -0
  66. package/dist/types/enyo-pv-system.js +23 -0
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/package.json +1 -1
@@ -50,8 +50,6 @@ export interface EnergyAppPackageOptionsDeviceDetectionHttp {
50
50
  matchingValues: string[];
51
51
  }
52
52
  export interface EnergyAppPackageOptionsDeviceDetectionOcpp {
53
- /** ocpp message name, for example BootNotification */
54
- message: string;
55
53
  /** field name in the boot notification */
56
54
  field: string;
57
55
  /** matching values, for example the vendor names or model names */
@@ -23,4 +23,11 @@ var EnergyAppPermissionTypeEnum;
23
23
  EnergyAppPermissionTypeEnum["LocationCoordinates"] = "LocationCoordinates";
24
24
  EnergyAppPermissionTypeEnum["Timeseries"] = "Timeseries";
25
25
  EnergyAppPermissionTypeEnum["EnergyManagerInfo"] = "EnergyManagerInfo";
26
+ EnergyAppPermissionTypeEnum["ElectricityTariff"] = "ElectricityTariff";
27
+ EnergyAppPermissionTypeEnum["WeatherForecastRegister"] = "WeatherForecastRegister";
28
+ EnergyAppPermissionTypeEnum["WeatherForecastUse"] = "WeatherForecastUse";
29
+ EnergyAppPermissionTypeEnum["PvForecastRegister"] = "PvForecastRegister";
30
+ EnergyAppPermissionTypeEnum["PvForecastUse"] = "PvForecastUse";
31
+ EnergyAppPermissionTypeEnum["PvSystemRegister"] = "PvSystemRegister";
32
+ EnergyAppPermissionTypeEnum["PvSystemUse"] = "PvSystemUse";
26
33
  })(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';
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';
2
2
  export declare enum EnergyAppPermissionTypeEnum {
3
3
  RestrictedInternetAccess = "RestrictedInternetAccess",
4
4
  NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
@@ -19,5 +19,12 @@ export declare enum EnergyAppPermissionTypeEnum {
19
19
  LocationZipCode = "LocationZipCode",
20
20
  LocationCoordinates = "LocationCoordinates",
21
21
  Timeseries = "Timeseries",
22
- EnergyManagerInfo = "EnergyManagerInfo"
22
+ EnergyManagerInfo = "EnergyManagerInfo",
23
+ ElectricityTariff = "ElectricityTariff",
24
+ WeatherForecastRegister = "WeatherForecastRegister",
25
+ WeatherForecastUse = "WeatherForecastUse",
26
+ PvForecastRegister = "PvForecastRegister",
27
+ PvForecastUse = "PvForecastUse",
28
+ PvSystemRegister = "PvSystemRegister",
29
+ PvSystemUse = "PvSystemUse"
23
30
  }
@@ -18,6 +18,10 @@ import { EnergyAppOnboarding } from "./packages/energy-app-onboarding.cjs";
18
18
  import { EnergyAppTimeseries } from "./packages/energy-app-timeseries.cjs";
19
19
  import { EnyoPackageChannel } from "./enyo-package-channel.cjs";
20
20
  import { EnergyAppEnergyManager } from "./packages/energy-app-energy-manager.cjs";
21
+ import { EnergyAppElectricityTariff } from "./packages/energy-app-electricity-tariff.cjs";
22
+ import { EnergyAppWeatherForecasting } from "./packages/energy-app-weather-forecasting.cjs";
23
+ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs";
24
+ import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
21
25
  export declare enum EnergyAppStateEnum {
22
26
  Launching = "launching",
23
27
  Running = "running",
@@ -33,7 +37,7 @@ export declare enum EnergyAppStateEnum {
33
37
  */
34
38
  export interface EnyoEnergyAppSdk {
35
39
  /** Register a callback that gets called when the package is initialized */
36
- register: (callback: (packageName: string, version: number, channel: EnyoPackageChannel) => void) => void;
40
+ register: (callback: (packageName: string, version: number, channel: EnyoPackageChannel) => void | Promise<void>) => void;
37
41
  /** Register a callback that gets called when the system is shutting down */
38
42
  onShutdown: (callback: () => Promise<void>) => void;
39
43
  /** Update the state of the Energy App. Default state set is launching*/
@@ -80,4 +84,12 @@ export interface EnyoEnergyAppSdk {
80
84
  useTimeseries: () => EnergyAppTimeseries;
81
85
  /** Get the Energy Manager API for retrieving energy manager info and capabilities */
82
86
  useEnergyManager: () => EnergyAppEnergyManager;
87
+ /** Get the Electricity Tariff API for managing electricity tariffs */
88
+ useElectricityTariff: () => EnergyAppElectricityTariff;
89
+ /** Get the Weather Forecasting API for managing weather forecast providers and retrieving weather forecasts */
90
+ useWeatherForecasting: () => EnergyAppWeatherForecasting;
91
+ /** Get the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts */
92
+ usePvForecasting: () => EnergyAppPvForecasting;
93
+ /** Get the PV System API for managing PV system registrations and configurations */
94
+ usePvSystem: () => EnergyAppPvSystem;
83
95
  }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataBusCommandHandler = exports.CommandTimeoutError = void 0;
4
+ const enyo_data_bus_value_js_1 = require("../../types/enyo-data-bus-value.cjs");
5
+ /**
6
+ * Error thrown when a command does not receive an acknowledgment within the configured timeout.
7
+ */
8
+ class CommandTimeoutError extends Error {
9
+ /**
10
+ * The ID of the command message that timed out.
11
+ */
12
+ messageId;
13
+ /**
14
+ * The timeout duration in milliseconds that was exceeded.
15
+ */
16
+ timeoutMs;
17
+ /**
18
+ * Creates a new CommandTimeoutError.
19
+ * @param messageId - The ID of the command message that timed out
20
+ * @param timeoutMs - The timeout duration in milliseconds
21
+ */
22
+ constructor(messageId, timeoutMs) {
23
+ super(`Command ${messageId} timed out after ${timeoutMs}ms without acknowledgment`);
24
+ this.name = 'CommandTimeoutError';
25
+ this.messageId = messageId;
26
+ this.timeoutMs = timeoutMs;
27
+ }
28
+ }
29
+ exports.CommandTimeoutError = CommandTimeoutError;
30
+ /**
31
+ * Utility class that wraps an {@link EnergyAppDataBus} to provide promise-based command sending
32
+ * with automatic acknowledgment matching and timeout handling.
33
+ *
34
+ * Commands are sent via the data bus and the handler waits for a matching
35
+ * {@link EnyoDataBusMessageEnum.CommandAcknowledgeV1} message. The returned promise resolves
36
+ * with the acknowledgment for all answer types (Accepted, Rejected, NotSupported) — the
37
+ * consumer is responsible for inspecting the `data.answer` field. The promise only rejects
38
+ * on timeout or when {@link dispose} is called.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const commandHandler = new DataBusCommandHandler(energyApp.useDataBus());
43
+ *
44
+ * try {
45
+ * const ack = await commandHandler.sendCommand(myStartChargeCommand);
46
+ * if (ack.data.answer === EnyoCommandAcknowledgeAnswerEnum.Accepted) {
47
+ * console.log('Command accepted');
48
+ * } else {
49
+ * console.log('Rejected:', ack.data.rejectionReason);
50
+ * }
51
+ * } catch (error) {
52
+ * if (error instanceof CommandTimeoutError) {
53
+ * console.error('No acknowledgment within timeout');
54
+ * }
55
+ * }
56
+ *
57
+ * // Clean up when done
58
+ * commandHandler.dispose();
59
+ * ```
60
+ */
61
+ class DataBusCommandHandler {
62
+ dataBus;
63
+ defaultTimeoutMs;
64
+ pendingCommands = new Map();
65
+ listenerId;
66
+ disposed = false;
67
+ /**
68
+ * Creates a new DataBusCommandHandler.
69
+ * @param dataBus - The data bus instance to send commands through and listen for acknowledgments on
70
+ * @param options - Optional configuration options
71
+ */
72
+ constructor(dataBus, options) {
73
+ this.dataBus = dataBus;
74
+ this.defaultTimeoutMs = options?.defaultTimeoutMs ?? 10_000;
75
+ this.listenerId = this.dataBus.listenForMessages([enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.CommandAcknowledgeV1], (entry) => this.handleAcknowledge(entry));
76
+ }
77
+ /**
78
+ * Sends a command message on the data bus and waits for its acknowledgment.
79
+ *
80
+ * The returned promise resolves with the {@link EnyoDataBusCommandAcknowledgeV1} for all
81
+ * acknowledgment answer types (Accepted, Rejected, NotSupported). It only rejects when:
82
+ * - The timeout is exceeded (throws {@link CommandTimeoutError})
83
+ * - The handler has been disposed
84
+ *
85
+ * @param command - The command message to send. Its `id` field is used to correlate
86
+ * the acknowledgment response.
87
+ * @param options - Optional per-call options to override the default timeout
88
+ * @returns A promise that resolves with the command acknowledgment
89
+ * @throws {CommandTimeoutError} If no acknowledgment is received within the timeout
90
+ * @throws {Error} If the handler has been disposed
91
+ */
92
+ sendCommand(command, options) {
93
+ if (this.disposed) {
94
+ return Promise.reject(new Error('DataBusCommandHandler has been disposed'));
95
+ }
96
+ const timeoutMs = options?.timeoutMs ?? this.defaultTimeoutMs;
97
+ return new Promise((resolve, reject) => {
98
+ const timer = setTimeout(() => {
99
+ this.pendingCommands.delete(command.id);
100
+ reject(new CommandTimeoutError(command.id, timeoutMs));
101
+ }, timeoutMs);
102
+ // Store the pending entry BEFORE calling sendMessage to handle
103
+ // synchronous acknowledgment (e.g. DemoDataBus notifies listeners inline).
104
+ this.pendingCommands.set(command.id, { resolve, reject, timer });
105
+ this.dataBus.sendMessage([command]);
106
+ });
107
+ }
108
+ /**
109
+ * Disposes the command handler by unsubscribing from the data bus,
110
+ * rejecting all pending commands, and clearing internal state.
111
+ *
112
+ * After calling dispose, any subsequent calls to {@link sendCommand} will reject immediately.
113
+ */
114
+ dispose() {
115
+ if (this.disposed) {
116
+ return;
117
+ }
118
+ this.disposed = true;
119
+ this.dataBus.unsubscribe(this.listenerId);
120
+ for (const [messageId, pending] of this.pendingCommands) {
121
+ clearTimeout(pending.timer);
122
+ pending.reject(new Error(`DataBusCommandHandler disposed while waiting for acknowledgment of command ${messageId}`));
123
+ }
124
+ this.pendingCommands.clear();
125
+ }
126
+ /**
127
+ * Handles an incoming CommandAcknowledgeV1 message by resolving the
128
+ * corresponding pending command promise, if one exists.
129
+ */
130
+ handleAcknowledge(ack) {
131
+ const pending = this.pendingCommands.get(ack.data.messageId);
132
+ if (!pending) {
133
+ return;
134
+ }
135
+ clearTimeout(pending.timer);
136
+ this.pendingCommands.delete(ack.data.messageId);
137
+ pending.resolve(ack);
138
+ }
139
+ }
140
+ exports.DataBusCommandHandler = DataBusCommandHandler;
@@ -0,0 +1,114 @@
1
+ import { EnergyAppDataBus } from "../../packages/energy-app-data-bus.cjs";
2
+ import { EnyoDataBusCommandAcknowledgeV1, EnyoDataBusMessage } from "../../types/enyo-data-bus-value.cjs";
3
+ /**
4
+ * Configuration options for the {@link DataBusCommandHandler}.
5
+ */
6
+ export interface DataBusCommandHandlerOptions {
7
+ /**
8
+ * Default timeout in milliseconds to wait for a command acknowledgment.
9
+ * Individual calls to {@link DataBusCommandHandler.sendCommand} can override this value.
10
+ * @default 10000
11
+ */
12
+ defaultTimeoutMs?: number;
13
+ }
14
+ /**
15
+ * Per-call options for {@link DataBusCommandHandler.sendCommand}.
16
+ */
17
+ export interface SendCommandOptions {
18
+ /**
19
+ * Timeout in milliseconds for this specific command.
20
+ * Overrides the default timeout configured in {@link DataBusCommandHandlerOptions}.
21
+ */
22
+ timeoutMs?: number;
23
+ }
24
+ /**
25
+ * Error thrown when a command does not receive an acknowledgment within the configured timeout.
26
+ */
27
+ export declare class CommandTimeoutError extends Error {
28
+ /**
29
+ * The ID of the command message that timed out.
30
+ */
31
+ readonly messageId: string;
32
+ /**
33
+ * The timeout duration in milliseconds that was exceeded.
34
+ */
35
+ readonly timeoutMs: number;
36
+ /**
37
+ * Creates a new CommandTimeoutError.
38
+ * @param messageId - The ID of the command message that timed out
39
+ * @param timeoutMs - The timeout duration in milliseconds
40
+ */
41
+ constructor(messageId: string, timeoutMs: number);
42
+ }
43
+ /**
44
+ * Utility class that wraps an {@link EnergyAppDataBus} to provide promise-based command sending
45
+ * with automatic acknowledgment matching and timeout handling.
46
+ *
47
+ * Commands are sent via the data bus and the handler waits for a matching
48
+ * {@link EnyoDataBusMessageEnum.CommandAcknowledgeV1} message. The returned promise resolves
49
+ * with the acknowledgment for all answer types (Accepted, Rejected, NotSupported) — the
50
+ * consumer is responsible for inspecting the `data.answer` field. The promise only rejects
51
+ * on timeout or when {@link dispose} is called.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const commandHandler = new DataBusCommandHandler(energyApp.useDataBus());
56
+ *
57
+ * try {
58
+ * const ack = await commandHandler.sendCommand(myStartChargeCommand);
59
+ * if (ack.data.answer === EnyoCommandAcknowledgeAnswerEnum.Accepted) {
60
+ * console.log('Command accepted');
61
+ * } else {
62
+ * console.log('Rejected:', ack.data.rejectionReason);
63
+ * }
64
+ * } catch (error) {
65
+ * if (error instanceof CommandTimeoutError) {
66
+ * console.error('No acknowledgment within timeout');
67
+ * }
68
+ * }
69
+ *
70
+ * // Clean up when done
71
+ * commandHandler.dispose();
72
+ * ```
73
+ */
74
+ export declare class DataBusCommandHandler {
75
+ private readonly dataBus;
76
+ private readonly defaultTimeoutMs;
77
+ private readonly pendingCommands;
78
+ private readonly listenerId;
79
+ private disposed;
80
+ /**
81
+ * Creates a new DataBusCommandHandler.
82
+ * @param dataBus - The data bus instance to send commands through and listen for acknowledgments on
83
+ * @param options - Optional configuration options
84
+ */
85
+ constructor(dataBus: EnergyAppDataBus, options?: DataBusCommandHandlerOptions);
86
+ /**
87
+ * Sends a command message on the data bus and waits for its acknowledgment.
88
+ *
89
+ * The returned promise resolves with the {@link EnyoDataBusCommandAcknowledgeV1} for all
90
+ * acknowledgment answer types (Accepted, Rejected, NotSupported). It only rejects when:
91
+ * - The timeout is exceeded (throws {@link CommandTimeoutError})
92
+ * - The handler has been disposed
93
+ *
94
+ * @param command - The command message to send. Its `id` field is used to correlate
95
+ * the acknowledgment response.
96
+ * @param options - Optional per-call options to override the default timeout
97
+ * @returns A promise that resolves with the command acknowledgment
98
+ * @throws {CommandTimeoutError} If no acknowledgment is received within the timeout
99
+ * @throws {Error} If the handler has been disposed
100
+ */
101
+ sendCommand(command: EnyoDataBusMessage, options?: SendCommandOptions): Promise<EnyoDataBusCommandAcknowledgeV1>;
102
+ /**
103
+ * Disposes the command handler by unsubscribing from the data bus,
104
+ * rejecting all pending commands, and clearing internal state.
105
+ *
106
+ * After calling dispose, any subsequent calls to {@link sendCommand} will reject immediately.
107
+ */
108
+ dispose(): void;
109
+ /**
110
+ * Handles an incoming CommandAcknowledgeV1 message by resolving the
111
+ * corresponding pending command promise, if one exists.
112
+ */
113
+ private handleAcknowledge;
114
+ }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChargePointStatus = exports.RegistrationStatus = exports.OCPP16Action = void 0;
4
4
  var OCPP16Action;
5
5
  (function (OCPP16Action) {
6
- OCPP16Action["Authorize"] = "Authorize";
6
+ /** The authorization is handled by the core and you will get an info if authorized */
7
+ OCPP16Action["AuthorizationInfo"] = "AuthorizationInfo";
7
8
  OCPP16Action["BootNotification"] = "BootNotification";
8
9
  OCPP16Action["CancelReservation"] = "CancelReservation";
9
10
  OCPP16Action["ChangeAvailability"] = "ChangeAvailability";
@@ -1,5 +1,6 @@
1
1
  export declare enum OCPP16Action {
2
- Authorize = "Authorize",
2
+ /** The authorization is handled by the core and you will get an info if authorized */
3
+ AuthorizationInfo = "AuthorizationInfo",
3
4
  BootNotification = "BootNotification",
4
5
  CancelReservation = "CancelReservation",
5
6
  ChangeAvailability = "ChangeAvailability",
@@ -78,12 +79,10 @@ export interface OCPP16StatusNotificationResponse {
78
79
  export interface OCPP16AuthorizeRequest {
79
80
  idTag: string;
80
81
  }
81
- export interface OCPP16AuthorizeResponse {
82
- idTagInfo: {
83
- status: 'Accepted' | 'Blocked' | 'Expired' | 'Invalid' | 'ConcurrentTx';
84
- expiryDate?: string;
85
- parentIdTag?: string;
86
- };
82
+ export interface OCPP16AuthorizationInfoResponse {
83
+ idTag: string;
84
+ chargingCardId?: string;
85
+ vehicleId?: string;
87
86
  }
88
87
  export interface OCPP16StartTransactionRequest {
89
88
  connectorId: number;
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectorStatusEnumType = exports.RegistrationStatusEnumType = exports.OCPP201Action = void 0;
4
4
  var OCPP201Action;
5
5
  (function (OCPP201Action) {
6
- OCPP201Action["Authorize"] = "Authorize";
6
+ /** The authorization is handled by the core and you will get an info if authorized */
7
+ OCPP201Action["AuthorizationInfo"] = "AuthorizationInfo";
7
8
  OCPP201Action["BootNotification"] = "BootNotification";
8
9
  OCPP201Action["CancelReservation"] = "CancelReservation";
9
10
  OCPP201Action["CertificateSigned"] = "CertificateSigned";
@@ -1,5 +1,6 @@
1
1
  export declare enum OCPP201Action {
2
- Authorize = "Authorize",
2
+ /** The authorization is handled by the core and you will get an info if authorized */
3
+ AuthorizationInfo = "AuthorizationInfo",
3
4
  BootNotification = "BootNotification",
4
5
  CancelReservation = "CancelReservation",
5
6
  CertificateSigned = "CertificateSigned",
@@ -112,7 +113,9 @@ export interface OCPP201StatusNotificationRequest {
112
113
  }
113
114
  export interface OCPP201StatusNotificationResponse {
114
115
  }
115
- export interface OCPP201AuthorizeRequest {
116
+ export interface OCPP201AuthorizationInfoRequest {
117
+ chargingCardId?: string;
118
+ vehicleId?: string;
116
119
  idToken: {
117
120
  idToken: string;
118
121
  type: 'Central' | 'eMAID' | 'ISO14443' | 'ISO15693' | 'KeyCode' | 'Local' | 'MacAddress' | 'NoAuthorization';
@@ -121,13 +124,6 @@ export interface OCPP201AuthorizeRequest {
121
124
  type: string;
122
125
  }>;
123
126
  };
124
- certificate?: string;
125
- iso15118CertificateHashData?: Array<{
126
- hashAlgorithm: 'SHA256' | 'SHA384' | 'SHA512';
127
- issuerNameHash: string;
128
- issuerKeyHash: string;
129
- serialNumber: string;
130
- }>;
131
127
  }
132
128
  export interface OCPP201AuthorizeResponse {
133
129
  idTokenInfo: {
@@ -34,6 +34,15 @@ __exportStar(require("./enyo-package-channel.cjs"), exports);
34
34
  __exportStar(require("./types/enyo-timeseries.cjs"), exports);
35
35
  __exportStar(require("./types/enyo-energy-manager.cjs"), exports);
36
36
  __exportStar(require("./packages/energy-app-energy-manager.cjs"), exports);
37
+ __exportStar(require("./types/enyo-electricity-tariff.cjs"), exports);
38
+ __exportStar(require("./packages/energy-app-electricity-tariff.cjs"), exports);
39
+ __exportStar(require("./types/enyo-pv-forecast.cjs"), exports);
40
+ __exportStar(require("./types/enyo-forecasting.cjs"), exports);
41
+ __exportStar(require("./packages/energy-app-weather-forecasting.cjs"), exports);
42
+ __exportStar(require("./packages/energy-app-pv-forecasting.cjs"), exports);
43
+ __exportStar(require("./types/enyo-pv-system.cjs"), exports);
44
+ __exportStar(require("./packages/energy-app-pv-system.cjs"), exports);
45
+ __exportStar(require("./implementations/data-bus/data-bus-command-handler.cjs"), exports);
37
46
  class EnergyApp {
38
47
  energyAppSdk;
39
48
  constructor() {
@@ -147,6 +156,41 @@ class EnergyApp {
147
156
  useEnergyManager() {
148
157
  return this.energyAppSdk.useEnergyManager();
149
158
  }
159
+ /**
160
+ * Gets the Electricity Tariff API for managing electricity tariffs.
161
+ * Provides methods to register, retrieve, and remove electricity tariffs
162
+ * used for energy pricing and consumption calculations.
163
+ * @returns The Electricity Tariff API instance
164
+ */
165
+ useElectricityTariff() {
166
+ return this.energyAppSdk.useElectricityTariff();
167
+ }
168
+ /**
169
+ * Gets the Weather Forecasting API for managing weather forecast providers and retrieving weather forecasts.
170
+ * Provides methods to register/deregister weather forecast providers, list available providers,
171
+ * and fetch weather forecasts by zip code or coordinates.
172
+ * @returns The Weather Forecasting API instance
173
+ */
174
+ useWeatherForecasting() {
175
+ return this.energyAppSdk.useWeatherForecasting();
176
+ }
177
+ /**
178
+ * Gets the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts.
179
+ * Provides methods to register/deregister PV forecast providers and fetch power production forecasts.
180
+ * @returns The PV Forecasting API instance
181
+ */
182
+ usePvForecasting() {
183
+ return this.energyAppSdk.usePvForecasting();
184
+ }
185
+ /**
186
+ * Gets the PV System API for managing PV system registrations and configurations.
187
+ * Provides methods to register, retrieve, update, and remove PV systems
188
+ * including DC string orientations, peak power, associated appliances, and feature flags.
189
+ * @returns The PV System API instance
190
+ */
191
+ usePvSystem() {
192
+ return this.energyAppSdk.usePvSystem();
193
+ }
150
194
  /**
151
195
  * Gets the current SDK version.
152
196
  * @returns The semantic version string of the SDK
@@ -19,6 +19,10 @@ import { EnergyAppOnboarding } from "./packages/energy-app-onboarding.cjs";
19
19
  import { EnergyAppTimeseries } from "./packages/energy-app-timeseries.cjs";
20
20
  import { EnyoPackageChannel } from "./enyo-package-channel.cjs";
21
21
  import { EnergyAppEnergyManager } from "./packages/energy-app-energy-manager.cjs";
22
+ import { EnergyAppElectricityTariff } from "./packages/energy-app-electricity-tariff.cjs";
23
+ import { EnergyAppWeatherForecasting } from "./packages/energy-app-weather-forecasting.cjs";
24
+ import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs";
25
+ import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
22
26
  export * from './energy-app-package-definition.cjs';
23
27
  export * from './version.cjs';
24
28
  export * from './implementations/ocpp/ocpp16.cjs';
@@ -37,6 +41,15 @@ export * from './enyo-package-channel.cjs';
37
41
  export * from './types/enyo-timeseries.cjs';
38
42
  export * from './types/enyo-energy-manager.cjs';
39
43
  export * from './packages/energy-app-energy-manager.cjs';
44
+ export * from './types/enyo-electricity-tariff.cjs';
45
+ export * from './packages/energy-app-electricity-tariff.cjs';
46
+ export * from './types/enyo-pv-forecast.cjs';
47
+ export * from './types/enyo-forecasting.cjs';
48
+ export * from './packages/energy-app-weather-forecasting.cjs';
49
+ export * from './packages/energy-app-pv-forecasting.cjs';
50
+ export * from './types/enyo-pv-system.cjs';
51
+ export * from './packages/energy-app-pv-system.cjs';
52
+ export * from './implementations/data-bus/data-bus-command-handler.cjs';
40
53
  export declare class EnergyApp implements EnyoEnergyAppSdk {
41
54
  private readonly energyAppSdk;
42
55
  constructor();
@@ -85,6 +98,33 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
85
98
  * @returns The Energy Manager API instance
86
99
  */
87
100
  useEnergyManager(): EnergyAppEnergyManager;
101
+ /**
102
+ * Gets the Electricity Tariff API for managing electricity tariffs.
103
+ * Provides methods to register, retrieve, and remove electricity tariffs
104
+ * used for energy pricing and consumption calculations.
105
+ * @returns The Electricity Tariff API instance
106
+ */
107
+ useElectricityTariff(): EnergyAppElectricityTariff;
108
+ /**
109
+ * Gets the Weather Forecasting API for managing weather forecast providers and retrieving weather forecasts.
110
+ * Provides methods to register/deregister weather forecast providers, list available providers,
111
+ * and fetch weather forecasts by zip code or coordinates.
112
+ * @returns The Weather Forecasting API instance
113
+ */
114
+ useWeatherForecasting(): EnergyAppWeatherForecasting;
115
+ /**
116
+ * Gets the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts.
117
+ * Provides methods to register/deregister PV forecast providers and fetch power production forecasts.
118
+ * @returns The PV Forecasting API instance
119
+ */
120
+ usePvForecasting(): EnergyAppPvForecasting;
121
+ /**
122
+ * Gets the PV System API for managing PV system registrations and configurations.
123
+ * Provides methods to register, retrieve, update, and remove PV systems
124
+ * including DC string orientations, peak power, associated appliances, and feature flags.
125
+ * @returns The PV System API instance
126
+ */
127
+ usePvSystem(): EnergyAppPvSystem;
88
128
  /**
89
129
  * Gets the current SDK version.
90
130
  * @returns The semantic version string of the SDK
@@ -45,6 +45,21 @@ export interface EnergyAppElectricityPrices {
45
45
  * @returns Promise that resolves to current price information, or null if no pricing data is available
46
46
  */
47
47
  getCurrentPrice(applianceId?: string): Promise<ElectricityPriceEntry | null>;
48
+ /**
49
+ * Retrieves the system default tariff information.
50
+ * Returns the full tariff including pricing data.
51
+ *
52
+ * @returns Promise that resolves to the default tariff info, or null if none is configured
53
+ */
54
+ getDefaultTariff(): Promise<EnergyTariffInfo | null>;
55
+ /**
56
+ * Retrieves tariff information by tariff ID.
57
+ * Returns the full tariff including pricing data.
58
+ *
59
+ * @param tariffId - The unique identifier of the tariff
60
+ * @returns Promise that resolves to the tariff info, or null if not found
61
+ */
62
+ getTariffById(tariffId: string): Promise<EnergyTariffInfo | null>;
48
63
  }
49
64
  /**
50
65
  * Represents a single electricity price entry for convenience methods
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import { ElectricityTariffRegistration, ElectricityTariffWithDefault } from "../types/enyo-electricity-tariff.cjs";
2
+ /**
3
+ * Interface for managing electricity tariffs.
4
+ * Provides methods to register, retrieve, and remove electricity tariffs
5
+ * used for energy pricing and consumption calculations.
6
+ */
7
+ export interface EnergyAppElectricityTariff {
8
+ /**
9
+ * Registers a new electricity tariff or updates an existing one.
10
+ * Uses upsert logic based on tariffId - if a tariff with the same ID exists,
11
+ * it will be updated; otherwise, a new tariff will be created.
12
+ *
13
+ * @param tariff - The tariff registration data including ID, type, name, and vendor
14
+ * @returns Promise that resolves when the tariff has been registered
15
+ */
16
+ registerTariff(tariff: ElectricityTariffRegistration): Promise<void>;
17
+ /**
18
+ * Retrieves all registered electricity tariffs.
19
+ * Each tariff includes a defaultTariff boolean indicating whether
20
+ * it is the system default tariff.
21
+ *
22
+ * @returns Promise that resolves to an array of all registered tariffs with default indicators
23
+ */
24
+ getAllTariffs(): Promise<ElectricityTariffWithDefault[]>;
25
+ /**
26
+ * Removes an electricity tariff by its ID.
27
+ * If the tariff does not exist, this operation is a no-op.
28
+ *
29
+ * @param tariffId - The unique identifier of the tariff to remove
30
+ * @returns Promise that resolves when the tariff has been removed
31
+ */
32
+ removeTariff(tariffId: string): Promise<void>;
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,63 @@
1
+ import { PvForecastProviderRegistration, PvForecastProviderInfo, PvForecastResponse } from "../types/enyo-forecasting.cjs";
2
+ /**
3
+ * Interface for managing PV forecast providers and retrieving PV forecasts.
4
+ * Allows energy apps to register PV forecast providers and fetch power production forecasts.
5
+ */
6
+ export interface EnergyAppPvForecasting {
7
+ /**
8
+ * Registers a new PV forecast provider or updates an existing one.
9
+ * Uses upsert logic based on forecastId - if a provider with the same ID exists,
10
+ * it will be updated; otherwise, a new provider will be created.
11
+ *
12
+ * @param registration - The forecast provider registration data
13
+ * @returns Promise that resolves when the provider has been registered
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * await pvForecasting.registerForecast({
18
+ * forecastId: 'solcast-1',
19
+ * name: 'Solcast Forecast',
20
+ * vendor: 'Solcast'
21
+ * });
22
+ * ```
23
+ */
24
+ registerForecast(registration: PvForecastProviderRegistration): Promise<void>;
25
+ /**
26
+ * Removes a registered PV forecast provider by its ID.
27
+ * If the provider does not exist, this operation is a no-op.
28
+ *
29
+ * @param forecastId - The unique identifier of the forecast provider to remove
30
+ * @returns Promise that resolves when the provider has been removed
31
+ */
32
+ deregisterForecast(forecastId: string): Promise<void>;
33
+ /**
34
+ * Retrieves all registered PV forecast providers.
35
+ *
36
+ * @returns Promise that resolves to an array of all registered PV forecast providers
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const providers = await pvForecasting.listForecasts();
41
+ * providers.forEach(p => console.log(`${p.name} (${p.vendor})`));
42
+ * ```
43
+ */
44
+ listForecasts(): Promise<PvForecastProviderInfo[]>;
45
+ /**
46
+ * Fetches a PV power production forecast for a specific PV system.
47
+ * Returns forecasted power output entries based on the PV system's configuration.
48
+ *
49
+ * @param forecastId - The unique identifier of the forecast provider to use
50
+ * @param pvSystemId - The unique identifier of the PV system to get the forecast for
51
+ * @returns Promise that resolves to the PV forecast data with resolution and entries
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const forecast = await pvForecasting.getPvForecast('solcast-1', 'pv-system-001');
56
+ * console.log(`Resolution: ${forecast.resolution}`);
57
+ * forecast.entries.forEach(e =>
58
+ * console.log(`${e.timestampIso}: ${e.forecastedKw} kW`)
59
+ * );
60
+ * ```
61
+ */
62
+ getPvForecast(forecastId: string, pvSystemId: string): Promise<PvForecastResponse>;
63
+ }