@enyo-energy/energy-app-sdk 0.0.95 → 0.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -0
- package/dist/cjs/implementations/appliances/appliance-manager.d.cts +29 -1
- package/dist/cjs/index.cjs +11 -0
- package/dist/cjs/index.d.cts +10 -0
- package/dist/cjs/packages/energy-app-learning-phase.cjs +2 -0
- package/dist/cjs/packages/energy-app-learning-phase.d.cts +88 -0
- package/dist/cjs/types/enyo-diagnostics.d.cts +1 -0
- package/dist/cjs/types/enyo-heatpump-appliance.cjs +0 -2
- package/dist/cjs/types/enyo-heatpump-appliance.d.cts +0 -2
- package/dist/cjs/types/enyo-learning-phase.cjs +2 -0
- package/dist/cjs/types/enyo-learning-phase.d.cts +37 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/enyo-energy-app-sdk.d.ts +3 -0
- package/dist/implementations/appliances/appliance-manager.d.ts +29 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/packages/energy-app-learning-phase.d.ts +88 -0
- package/dist/packages/energy-app-learning-phase.js +1 -0
- package/dist/types/enyo-diagnostics.d.ts +1 -0
- package/dist/types/enyo-heatpump-appliance.d.ts +0 -2
- package/dist/types/enyo-heatpump-appliance.js +0 -2
- package/dist/types/enyo-learning-phase.d.ts +37 -0
- package/dist/types/enyo-learning-phase.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ The official TypeScript SDK for building Energy Apps on the enyo platform. Creat
|
|
|
20
20
|
- [Data Management](#data-management)
|
|
21
21
|
- [Energy Resources](#energy-resources)
|
|
22
22
|
- [User Features](#user-features)
|
|
23
|
+
- [App Intelligence](#app-intelligence)
|
|
23
24
|
- [Advanced Modbus Integration](#advanced-modbus-integration)
|
|
24
25
|
- [Examples](#examples)
|
|
25
26
|
- [Basic Energy App](#basic-energy-app)
|
|
@@ -615,6 +616,61 @@ await notifications.sendNotification({
|
|
|
615
616
|
});
|
|
616
617
|
```
|
|
617
618
|
|
|
619
|
+
### App Intelligence
|
|
620
|
+
|
|
621
|
+
#### `useLearningPhase(): EnergyAppLearningPhase`
|
|
622
|
+
|
|
623
|
+
Track and manage learning phases — periods where an app or a specific appliance is calibrating, gathering data, or optimizing its behavior:
|
|
624
|
+
|
|
625
|
+
```typescript
|
|
626
|
+
const learningPhase = energyApp.useLearningPhase();
|
|
627
|
+
|
|
628
|
+
// Register a package-wide learning phase
|
|
629
|
+
const phaseId = await learningPhase.registerLearningPhase({
|
|
630
|
+
name: 'consumption-pattern-analysis',
|
|
631
|
+
reason: [
|
|
632
|
+
{ language: 'en', value: 'Analyzing energy consumption patterns' },
|
|
633
|
+
{ language: 'de', value: 'Analyse der Energieverbrauchsmuster' }
|
|
634
|
+
],
|
|
635
|
+
description: [
|
|
636
|
+
{ language: 'en', value: 'The system is learning your household energy consumption patterns to optimize scheduling.' },
|
|
637
|
+
{ language: 'de', value: 'Das System lernt Ihre Energieverbrauchsmuster, um die Planung zu optimieren.' }
|
|
638
|
+
]
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
// Register a learning phase for a specific appliance
|
|
642
|
+
const heatpumpPhaseId = await learningPhase.registerLearningPhase({
|
|
643
|
+
name: 'heating-curve-optimization',
|
|
644
|
+
applianceId: 'heatpump-001',
|
|
645
|
+
reason: [
|
|
646
|
+
{ language: 'en', value: 'Optimizing heating curve' },
|
|
647
|
+
{ language: 'de', value: 'Optimierung der Heizkurve' }
|
|
648
|
+
]
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
// Check if a learning phase is still active
|
|
652
|
+
const isLearning = await learningPhase.isInLearningPhase(heatpumpPhaseId);
|
|
653
|
+
console.log(`Heatpump is ${isLearning ? 'still learning' : 'done learning'}`);
|
|
654
|
+
|
|
655
|
+
// Check if a learning phase is completed
|
|
656
|
+
const isDone = await learningPhase.isLearningPhaseCompleted(heatpumpPhaseId);
|
|
657
|
+
|
|
658
|
+
// Get all learning phases with their status and duration
|
|
659
|
+
const allPhases = await learningPhase.getLearningPhases();
|
|
660
|
+
for (const phase of allPhases) {
|
|
661
|
+
console.log(`${phase.name}: ${phase.durationInHours}h, active: ${!phase.endDate}`);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// Get learning phases for a specific appliance
|
|
665
|
+
const heatpumpPhases = await learningPhase.getLearningPhasesByApplianceId('heatpump-001');
|
|
666
|
+
|
|
667
|
+
// Complete a learning phase
|
|
668
|
+
await learningPhase.completeLearningPhase(heatpumpPhaseId);
|
|
669
|
+
|
|
670
|
+
// Remove a learning phase
|
|
671
|
+
await learningPhase.removeLearningPhase(phaseId);
|
|
672
|
+
```
|
|
673
|
+
|
|
618
674
|
## Advanced Modbus Integration
|
|
619
675
|
|
|
620
676
|
The SDK includes a powerful, vendor-agnostic Modbus implementation for energy management systems. This allows you to connect to any Modbus-enabled device through configuration without code changes.
|
|
@@ -27,6 +27,7 @@ import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.cjs";
|
|
|
27
27
|
import { EnergyAppEebus } from "./packages/energy-app-eebus.cjs";
|
|
28
28
|
import { EnergyAppMqtt } from "./packages/energy-app-mqtt.cjs";
|
|
29
29
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
30
|
+
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
30
31
|
export declare enum EnergyAppStateEnum {
|
|
31
32
|
Launching = "launching",
|
|
32
33
|
Running = "running",
|
|
@@ -109,4 +110,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
109
110
|
useMqtt: () => EnergyAppMqtt;
|
|
110
111
|
/** Get the Diagnostics API for submitting energy manager diagnostics data */
|
|
111
112
|
useDiagnostics: () => EnergyAppDiagnostics;
|
|
113
|
+
/** Get the Learning Phase API for registering and tracking learning phases */
|
|
114
|
+
useLearningPhase: () => EnergyAppLearningPhase;
|
|
112
115
|
}
|
|
@@ -165,7 +165,7 @@ export declare class ApplianceManager {
|
|
|
165
165
|
* @param applianceId The ID of the appliance
|
|
166
166
|
* @param attributes The attributes to update
|
|
167
167
|
*/
|
|
168
|
-
updateAppliance(applianceId: string, attributes: Partial<
|
|
168
|
+
updateAppliance(applianceId: string, attributes: Partial<PartialEnyoAppliance>): Promise<void>;
|
|
169
169
|
/**
|
|
170
170
|
* Removes an appliance by its ID.
|
|
171
171
|
* @param applianceId The ID of the appliance to remove
|
|
@@ -218,3 +218,31 @@ export declare class ApplianceManager {
|
|
|
218
218
|
*/
|
|
219
219
|
dispose(): void;
|
|
220
220
|
}
|
|
221
|
+
export interface PartialEnyoAppliance {
|
|
222
|
+
/** Unique identifier for the appliance */
|
|
223
|
+
id: string;
|
|
224
|
+
/** Name of the appliance in different supported languages */
|
|
225
|
+
name: EnyoApplianceName[];
|
|
226
|
+
/** Type/category of the appliance */
|
|
227
|
+
type: EnyoApplianceTypeEnum;
|
|
228
|
+
/** network device IDs associated with the appliance */
|
|
229
|
+
networkDeviceIds: string[];
|
|
230
|
+
/** Optional Metadata of the Appliance */
|
|
231
|
+
metadata?: Partial<EnyoApplianceMetadata>;
|
|
232
|
+
/** Topology Information of the appliance */
|
|
233
|
+
topology?: EnyoApplianceTopology;
|
|
234
|
+
/** Optional Metadata of the Appliance if of type Meter */
|
|
235
|
+
meter?: Partial<EnyoMeterAppliance>;
|
|
236
|
+
/** Optional Metadata of the Appliance if of type Inverter */
|
|
237
|
+
inverter?: Partial<EnyoInverterApplianceMetadata>;
|
|
238
|
+
/** Optional Metadata of the Appliance if of type Charger */
|
|
239
|
+
charger?: Partial<EnyoChargerApplianceMetadata>;
|
|
240
|
+
/** Optional Metadata of the Appliance if of type Heatpump */
|
|
241
|
+
heatpump?: Partial<EnyoHeatpumpApplianceMetadata>;
|
|
242
|
+
/** Optional Metadata of the Appliance if of type Battery */
|
|
243
|
+
battery?: Partial<EnyoBatteryApplianceMetadata>;
|
|
244
|
+
/** Optional Metadata of the Appliance if of type TemperatureSensor */
|
|
245
|
+
temperatureSensor?: Partial<EnyoTemperatureSensorApplianceMetadata>;
|
|
246
|
+
/** Optional custom name for the appliance, defined by the user */
|
|
247
|
+
customName?: string;
|
|
248
|
+
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -53,6 +53,8 @@ __exportStar(require("./types/enyo-mqtt.cjs"), exports);
|
|
|
53
53
|
__exportStar(require("./packages/energy-app-mqtt.cjs"), exports);
|
|
54
54
|
__exportStar(require("./types/enyo-diagnostics.cjs"), exports);
|
|
55
55
|
__exportStar(require("./packages/energy-app-diagnostics.cjs"), exports);
|
|
56
|
+
__exportStar(require("./types/enyo-learning-phase.cjs"), exports);
|
|
57
|
+
__exportStar(require("./packages/energy-app-learning-phase.cjs"), exports);
|
|
56
58
|
class EnergyApp {
|
|
57
59
|
energyAppSdk;
|
|
58
60
|
constructor() {
|
|
@@ -254,6 +256,15 @@ class EnergyApp {
|
|
|
254
256
|
useDiagnostics() {
|
|
255
257
|
return this.energyAppSdk.useDiagnostics();
|
|
256
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Gets the Learning Phase API for registering and tracking learning phases.
|
|
261
|
+
* Provides methods to register new learning phases, check their status,
|
|
262
|
+
* and retrieve learning phase history for the package or specific appliances.
|
|
263
|
+
* @returns The Learning Phase API instance
|
|
264
|
+
*/
|
|
265
|
+
useLearningPhase() {
|
|
266
|
+
return this.energyAppSdk.useLearningPhase();
|
|
267
|
+
}
|
|
257
268
|
/**
|
|
258
269
|
* Gets the current SDK version.
|
|
259
270
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -28,6 +28,7 @@ import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.cjs";
|
|
|
28
28
|
import { EnergyAppEebus } from "./packages/energy-app-eebus.cjs";
|
|
29
29
|
import { EnergyAppMqtt } from "./packages/energy-app-mqtt.cjs";
|
|
30
30
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
31
|
+
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
31
32
|
export * from './energy-app-appliance-type.enum.cjs';
|
|
32
33
|
export * from './energy-app-package-definition.cjs';
|
|
33
34
|
export * from './version.cjs';
|
|
@@ -65,6 +66,8 @@ export * from './types/enyo-mqtt.cjs';
|
|
|
65
66
|
export * from './packages/energy-app-mqtt.cjs';
|
|
66
67
|
export * from './types/enyo-diagnostics.cjs';
|
|
67
68
|
export * from './packages/energy-app-diagnostics.cjs';
|
|
69
|
+
export * from './types/enyo-learning-phase.cjs';
|
|
70
|
+
export * from './packages/energy-app-learning-phase.cjs';
|
|
68
71
|
export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
69
72
|
private readonly energyAppSdk;
|
|
70
73
|
constructor();
|
|
@@ -181,6 +184,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
181
184
|
* @returns The Diagnostics API instance
|
|
182
185
|
*/
|
|
183
186
|
useDiagnostics(): EnergyAppDiagnostics;
|
|
187
|
+
/**
|
|
188
|
+
* Gets the Learning Phase API for registering and tracking learning phases.
|
|
189
|
+
* Provides methods to register new learning phases, check their status,
|
|
190
|
+
* and retrieve learning phase history for the package or specific appliances.
|
|
191
|
+
* @returns The Learning Phase API instance
|
|
192
|
+
*/
|
|
193
|
+
useLearningPhase(): EnergyAppLearningPhase;
|
|
184
194
|
/**
|
|
185
195
|
* Gets the current SDK version.
|
|
186
196
|
* @returns The semantic version string of the SDK
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { EnyoLearningPhase, EnyoLearningPhaseRegistration } from "../types/enyo-learning-phase.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for managing learning phases within Energy App packages.
|
|
4
|
+
* Learning phases represent periods where an app or a specific appliance is calibrating,
|
|
5
|
+
* gathering data, or optimizing its behavior (e.g., a heatpump learning optimal heating curves
|
|
6
|
+
* after installation, or an energy manager learning consumption patterns).
|
|
7
|
+
*
|
|
8
|
+
* Learning phases can be package-wide (no applianceId) or tied to a specific appliance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const learningPhase = energyApp.useLearningPhase();
|
|
13
|
+
*
|
|
14
|
+
* // Register a learning phase for a specific appliance
|
|
15
|
+
* const phaseId = await learningPhase.registerLearningPhase({
|
|
16
|
+
* name: 'heating-curve-optimization',
|
|
17
|
+
* applianceId: 'heatpump-001',
|
|
18
|
+
* reason: [
|
|
19
|
+
* { language: 'en', value: 'Optimizing heating curve' },
|
|
20
|
+
* { language: 'de', value: 'Optimierung der Heizkurve' }
|
|
21
|
+
* ],
|
|
22
|
+
* description: [
|
|
23
|
+
* { language: 'en', value: 'The heatpump is learning the optimal heating curve for your home.' },
|
|
24
|
+
* { language: 'de', value: 'Die Wärmepumpe lernt die optimale Heizkurve für Ihr Zuhause.' }
|
|
25
|
+
* ]
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Check if still learning
|
|
29
|
+
* const isLearning = await learningPhase.isInLearningPhase(phaseId);
|
|
30
|
+
*
|
|
31
|
+
* // Complete the learning phase
|
|
32
|
+
* await learningPhase.completeLearningPhase(phaseId);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface EnergyAppLearningPhase {
|
|
36
|
+
/**
|
|
37
|
+
* Registers a new learning phase and starts tracking it.
|
|
38
|
+
* The learning phase starts immediately upon registration.
|
|
39
|
+
*
|
|
40
|
+
* @param registration - The learning phase registration details including name, optional applianceId, reason, and description
|
|
41
|
+
* @returns Promise that resolves to the unique ID of the newly created learning phase
|
|
42
|
+
*/
|
|
43
|
+
registerLearningPhase(registration: EnyoLearningPhaseRegistration): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Marks a learning phase as completed by setting its end date.
|
|
46
|
+
*
|
|
47
|
+
* @param learningPhaseId - The unique ID of the learning phase to complete
|
|
48
|
+
* @returns Promise that resolves when the learning phase is marked as completed
|
|
49
|
+
*/
|
|
50
|
+
completeLearningPhase(learningPhaseId: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether a specific learning phase is still active (not yet completed).
|
|
53
|
+
*
|
|
54
|
+
* @param learningPhaseId - The unique ID of the learning phase to check
|
|
55
|
+
* @returns Promise that resolves to `true` if the learning phase is still active, `false` otherwise
|
|
56
|
+
*/
|
|
57
|
+
isInLearningPhase(learningPhaseId: string): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Checks whether a specific learning phase has been completed.
|
|
60
|
+
*
|
|
61
|
+
* @param learningPhaseId - The unique ID of the learning phase to check
|
|
62
|
+
* @returns Promise that resolves to `true` if the learning phase is completed, `false` otherwise
|
|
63
|
+
*/
|
|
64
|
+
isLearningPhaseCompleted(learningPhaseId: string): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves all learning phases registered by this package.
|
|
67
|
+
* Returns both active and completed learning phases with their current duration.
|
|
68
|
+
*
|
|
69
|
+
* @returns Promise that resolves to an array of all learning phases
|
|
70
|
+
*/
|
|
71
|
+
getLearningPhases(): Promise<EnyoLearningPhase[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves all learning phases associated with a specific appliance.
|
|
74
|
+
* Returns both active and completed learning phases for the given appliance.
|
|
75
|
+
*
|
|
76
|
+
* @param applianceId - The appliance ID to filter learning phases by
|
|
77
|
+
* @returns Promise that resolves to an array of learning phases for the specified appliance
|
|
78
|
+
*/
|
|
79
|
+
getLearningPhasesByApplianceId(applianceId: string): Promise<EnyoLearningPhase[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Removes a learning phase from the system.
|
|
82
|
+
* This permanently deletes the learning phase record regardless of its active/completed status.
|
|
83
|
+
*
|
|
84
|
+
* @param learningPhaseId - The unique ID of the learning phase to remove
|
|
85
|
+
* @returns Promise that resolves when the learning phase is removed
|
|
86
|
+
*/
|
|
87
|
+
removeLearningPhase(learningPhaseId: string): Promise<void>;
|
|
88
|
+
}
|
|
@@ -5,8 +5,6 @@ var EnyoHeatpumpApplianceAvailableFeaturesEnum;
|
|
|
5
5
|
(function (EnyoHeatpumpApplianceAvailableFeaturesEnum) {
|
|
6
6
|
/** If the heatpump is capable of domestic hot water*/
|
|
7
7
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["DomesticHotWater"] = "DomesticHotWater";
|
|
8
|
-
/** If the heatpump is capable of domestic hot water boost to use more pv energy*/
|
|
9
|
-
EnyoHeatpumpApplianceAvailableFeaturesEnum["DomesticHotWaterBoost"] = "DomesticHotWaterBoost";
|
|
10
8
|
/** If the heatpump has a heating rod*/
|
|
11
9
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["HeatingRod"] = "HeatingRod";
|
|
12
10
|
/** If the heatpump supports room overheating via heating circuits */
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare enum EnyoHeatpumpApplianceAvailableFeaturesEnum {
|
|
2
2
|
/** If the heatpump is capable of domestic hot water*/
|
|
3
3
|
DomesticHotWater = "DomesticHotWater",
|
|
4
|
-
/** If the heatpump is capable of domestic hot water boost to use more pv energy*/
|
|
5
|
-
DomesticHotWaterBoost = "DomesticHotWaterBoost",
|
|
6
4
|
/** If the heatpump has a heating rod*/
|
|
7
5
|
HeatingRod = "HeatingRod",
|
|
8
6
|
/** If the heatpump supports room overheating via heating circuits */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EnyoPackageConfigurationTranslatedValue } from "./enyo-settings.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a learning phase tracked by an Energy App.
|
|
4
|
+
* A learning phase is a period during which an app or appliance is calibrating,
|
|
5
|
+
* gathering data, or optimizing its behavior (e.g., a heatpump learning optimal heating curves).
|
|
6
|
+
*/
|
|
7
|
+
export interface EnyoLearningPhase {
|
|
8
|
+
/** Unique identifier of the learning phase */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Name identifying the learning phase (e.g., 'heating-curve-optimization') */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Optional appliance ID — if omitted, the learning phase applies to the entire package */
|
|
13
|
+
applianceId?: string;
|
|
14
|
+
/** Optional translated reason explaining why this learning phase is needed */
|
|
15
|
+
reason?: EnyoPackageConfigurationTranslatedValue[];
|
|
16
|
+
/** Optional translated description providing details about what is being learned */
|
|
17
|
+
description?: EnyoPackageConfigurationTranslatedValue[];
|
|
18
|
+
/** ISO 8601 date string of when the learning phase started */
|
|
19
|
+
startDate: string;
|
|
20
|
+
/** ISO 8601 date string of when the learning phase ended — undefined if still active */
|
|
21
|
+
endDate?: string;
|
|
22
|
+
/** Duration of the learning phase in hours (elapsed if active, total if completed) */
|
|
23
|
+
durationInHours: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registration parameters for creating a new learning phase.
|
|
27
|
+
*/
|
|
28
|
+
export interface EnyoLearningPhaseRegistration {
|
|
29
|
+
/** Name identifying the learning phase (e.g., 'heating-curve-optimization') */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Optional appliance ID — if omitted, the learning phase applies to the entire package */
|
|
32
|
+
applianceId?: string;
|
|
33
|
+
/** Optional translated reason explaining why this learning phase is needed */
|
|
34
|
+
reason?: EnyoPackageConfigurationTranslatedValue[];
|
|
35
|
+
/** Optional translated description providing details about what is being learned */
|
|
36
|
+
description?: EnyoPackageConfigurationTranslatedValue[];
|
|
37
|
+
}
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -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.
|
|
12
|
+
exports.SDK_VERSION = '0.0.96';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the current SDK version.
|
|
15
15
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/version.d.cts
CHANGED
|
@@ -27,6 +27,7 @@ import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.js";
|
|
|
27
27
|
import { EnergyAppEebus } from "./packages/energy-app-eebus.js";
|
|
28
28
|
import { EnergyAppMqtt } from "./packages/energy-app-mqtt.js";
|
|
29
29
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.js";
|
|
30
|
+
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.js";
|
|
30
31
|
export declare enum EnergyAppStateEnum {
|
|
31
32
|
Launching = "launching",
|
|
32
33
|
Running = "running",
|
|
@@ -109,4 +110,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
109
110
|
useMqtt: () => EnergyAppMqtt;
|
|
110
111
|
/** Get the Diagnostics API for submitting energy manager diagnostics data */
|
|
111
112
|
useDiagnostics: () => EnergyAppDiagnostics;
|
|
113
|
+
/** Get the Learning Phase API for registering and tracking learning phases */
|
|
114
|
+
useLearningPhase: () => EnergyAppLearningPhase;
|
|
112
115
|
}
|
|
@@ -165,7 +165,7 @@ export declare class ApplianceManager {
|
|
|
165
165
|
* @param applianceId The ID of the appliance
|
|
166
166
|
* @param attributes The attributes to update
|
|
167
167
|
*/
|
|
168
|
-
updateAppliance(applianceId: string, attributes: Partial<
|
|
168
|
+
updateAppliance(applianceId: string, attributes: Partial<PartialEnyoAppliance>): Promise<void>;
|
|
169
169
|
/**
|
|
170
170
|
* Removes an appliance by its ID.
|
|
171
171
|
* @param applianceId The ID of the appliance to remove
|
|
@@ -218,3 +218,31 @@ export declare class ApplianceManager {
|
|
|
218
218
|
*/
|
|
219
219
|
dispose(): void;
|
|
220
220
|
}
|
|
221
|
+
export interface PartialEnyoAppliance {
|
|
222
|
+
/** Unique identifier for the appliance */
|
|
223
|
+
id: string;
|
|
224
|
+
/** Name of the appliance in different supported languages */
|
|
225
|
+
name: EnyoApplianceName[];
|
|
226
|
+
/** Type/category of the appliance */
|
|
227
|
+
type: EnyoApplianceTypeEnum;
|
|
228
|
+
/** network device IDs associated with the appliance */
|
|
229
|
+
networkDeviceIds: string[];
|
|
230
|
+
/** Optional Metadata of the Appliance */
|
|
231
|
+
metadata?: Partial<EnyoApplianceMetadata>;
|
|
232
|
+
/** Topology Information of the appliance */
|
|
233
|
+
topology?: EnyoApplianceTopology;
|
|
234
|
+
/** Optional Metadata of the Appliance if of type Meter */
|
|
235
|
+
meter?: Partial<EnyoMeterAppliance>;
|
|
236
|
+
/** Optional Metadata of the Appliance if of type Inverter */
|
|
237
|
+
inverter?: Partial<EnyoInverterApplianceMetadata>;
|
|
238
|
+
/** Optional Metadata of the Appliance if of type Charger */
|
|
239
|
+
charger?: Partial<EnyoChargerApplianceMetadata>;
|
|
240
|
+
/** Optional Metadata of the Appliance if of type Heatpump */
|
|
241
|
+
heatpump?: Partial<EnyoHeatpumpApplianceMetadata>;
|
|
242
|
+
/** Optional Metadata of the Appliance if of type Battery */
|
|
243
|
+
battery?: Partial<EnyoBatteryApplianceMetadata>;
|
|
244
|
+
/** Optional Metadata of the Appliance if of type TemperatureSensor */
|
|
245
|
+
temperatureSensor?: Partial<EnyoTemperatureSensorApplianceMetadata>;
|
|
246
|
+
/** Optional custom name for the appliance, defined by the user */
|
|
247
|
+
customName?: string;
|
|
248
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { EnergyAppModbusRtu } from "./packages/energy-app-modbus-rtu.js";
|
|
|
28
28
|
import { EnergyAppEebus } from "./packages/energy-app-eebus.js";
|
|
29
29
|
import { EnergyAppMqtt } from "./packages/energy-app-mqtt.js";
|
|
30
30
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.js";
|
|
31
|
+
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.js";
|
|
31
32
|
export * from './energy-app-appliance-type.enum.js';
|
|
32
33
|
export * from './energy-app-package-definition.js';
|
|
33
34
|
export * from './version.js';
|
|
@@ -65,6 +66,8 @@ export * from './types/enyo-mqtt.js';
|
|
|
65
66
|
export * from './packages/energy-app-mqtt.js';
|
|
66
67
|
export * from './types/enyo-diagnostics.js';
|
|
67
68
|
export * from './packages/energy-app-diagnostics.js';
|
|
69
|
+
export * from './types/enyo-learning-phase.js';
|
|
70
|
+
export * from './packages/energy-app-learning-phase.js';
|
|
68
71
|
export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
69
72
|
private readonly energyAppSdk;
|
|
70
73
|
constructor();
|
|
@@ -181,6 +184,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
181
184
|
* @returns The Diagnostics API instance
|
|
182
185
|
*/
|
|
183
186
|
useDiagnostics(): EnergyAppDiagnostics;
|
|
187
|
+
/**
|
|
188
|
+
* Gets the Learning Phase API for registering and tracking learning phases.
|
|
189
|
+
* Provides methods to register new learning phases, check their status,
|
|
190
|
+
* and retrieve learning phase history for the package or specific appliances.
|
|
191
|
+
* @returns The Learning Phase API instance
|
|
192
|
+
*/
|
|
193
|
+
useLearningPhase(): EnergyAppLearningPhase;
|
|
184
194
|
/**
|
|
185
195
|
* Gets the current SDK version.
|
|
186
196
|
* @returns The semantic version string of the SDK
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,8 @@ export * from './types/enyo-mqtt.js';
|
|
|
36
36
|
export * from './packages/energy-app-mqtt.js';
|
|
37
37
|
export * from './types/enyo-diagnostics.js';
|
|
38
38
|
export * from './packages/energy-app-diagnostics.js';
|
|
39
|
+
export * from './types/enyo-learning-phase.js';
|
|
40
|
+
export * from './packages/energy-app-learning-phase.js';
|
|
39
41
|
export class EnergyApp {
|
|
40
42
|
energyAppSdk;
|
|
41
43
|
constructor() {
|
|
@@ -237,6 +239,15 @@ export class EnergyApp {
|
|
|
237
239
|
useDiagnostics() {
|
|
238
240
|
return this.energyAppSdk.useDiagnostics();
|
|
239
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Gets the Learning Phase API for registering and tracking learning phases.
|
|
244
|
+
* Provides methods to register new learning phases, check their status,
|
|
245
|
+
* and retrieve learning phase history for the package or specific appliances.
|
|
246
|
+
* @returns The Learning Phase API instance
|
|
247
|
+
*/
|
|
248
|
+
useLearningPhase() {
|
|
249
|
+
return this.energyAppSdk.useLearningPhase();
|
|
250
|
+
}
|
|
240
251
|
/**
|
|
241
252
|
* Gets the current SDK version.
|
|
242
253
|
* @returns The semantic version string of the SDK
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { EnyoLearningPhase, EnyoLearningPhaseRegistration } from "../types/enyo-learning-phase.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for managing learning phases within Energy App packages.
|
|
4
|
+
* Learning phases represent periods where an app or a specific appliance is calibrating,
|
|
5
|
+
* gathering data, or optimizing its behavior (e.g., a heatpump learning optimal heating curves
|
|
6
|
+
* after installation, or an energy manager learning consumption patterns).
|
|
7
|
+
*
|
|
8
|
+
* Learning phases can be package-wide (no applianceId) or tied to a specific appliance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const learningPhase = energyApp.useLearningPhase();
|
|
13
|
+
*
|
|
14
|
+
* // Register a learning phase for a specific appliance
|
|
15
|
+
* const phaseId = await learningPhase.registerLearningPhase({
|
|
16
|
+
* name: 'heating-curve-optimization',
|
|
17
|
+
* applianceId: 'heatpump-001',
|
|
18
|
+
* reason: [
|
|
19
|
+
* { language: 'en', value: 'Optimizing heating curve' },
|
|
20
|
+
* { language: 'de', value: 'Optimierung der Heizkurve' }
|
|
21
|
+
* ],
|
|
22
|
+
* description: [
|
|
23
|
+
* { language: 'en', value: 'The heatpump is learning the optimal heating curve for your home.' },
|
|
24
|
+
* { language: 'de', value: 'Die Wärmepumpe lernt die optimale Heizkurve für Ihr Zuhause.' }
|
|
25
|
+
* ]
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Check if still learning
|
|
29
|
+
* const isLearning = await learningPhase.isInLearningPhase(phaseId);
|
|
30
|
+
*
|
|
31
|
+
* // Complete the learning phase
|
|
32
|
+
* await learningPhase.completeLearningPhase(phaseId);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface EnergyAppLearningPhase {
|
|
36
|
+
/**
|
|
37
|
+
* Registers a new learning phase and starts tracking it.
|
|
38
|
+
* The learning phase starts immediately upon registration.
|
|
39
|
+
*
|
|
40
|
+
* @param registration - The learning phase registration details including name, optional applianceId, reason, and description
|
|
41
|
+
* @returns Promise that resolves to the unique ID of the newly created learning phase
|
|
42
|
+
*/
|
|
43
|
+
registerLearningPhase(registration: EnyoLearningPhaseRegistration): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Marks a learning phase as completed by setting its end date.
|
|
46
|
+
*
|
|
47
|
+
* @param learningPhaseId - The unique ID of the learning phase to complete
|
|
48
|
+
* @returns Promise that resolves when the learning phase is marked as completed
|
|
49
|
+
*/
|
|
50
|
+
completeLearningPhase(learningPhaseId: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether a specific learning phase is still active (not yet completed).
|
|
53
|
+
*
|
|
54
|
+
* @param learningPhaseId - The unique ID of the learning phase to check
|
|
55
|
+
* @returns Promise that resolves to `true` if the learning phase is still active, `false` otherwise
|
|
56
|
+
*/
|
|
57
|
+
isInLearningPhase(learningPhaseId: string): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Checks whether a specific learning phase has been completed.
|
|
60
|
+
*
|
|
61
|
+
* @param learningPhaseId - The unique ID of the learning phase to check
|
|
62
|
+
* @returns Promise that resolves to `true` if the learning phase is completed, `false` otherwise
|
|
63
|
+
*/
|
|
64
|
+
isLearningPhaseCompleted(learningPhaseId: string): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves all learning phases registered by this package.
|
|
67
|
+
* Returns both active and completed learning phases with their current duration.
|
|
68
|
+
*
|
|
69
|
+
* @returns Promise that resolves to an array of all learning phases
|
|
70
|
+
*/
|
|
71
|
+
getLearningPhases(): Promise<EnyoLearningPhase[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves all learning phases associated with a specific appliance.
|
|
74
|
+
* Returns both active and completed learning phases for the given appliance.
|
|
75
|
+
*
|
|
76
|
+
* @param applianceId - The appliance ID to filter learning phases by
|
|
77
|
+
* @returns Promise that resolves to an array of learning phases for the specified appliance
|
|
78
|
+
*/
|
|
79
|
+
getLearningPhasesByApplianceId(applianceId: string): Promise<EnyoLearningPhase[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Removes a learning phase from the system.
|
|
82
|
+
* This permanently deletes the learning phase record regardless of its active/completed status.
|
|
83
|
+
*
|
|
84
|
+
* @param learningPhaseId - The unique ID of the learning phase to remove
|
|
85
|
+
* @returns Promise that resolves when the learning phase is removed
|
|
86
|
+
*/
|
|
87
|
+
removeLearningPhase(learningPhaseId: string): Promise<void>;
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare enum EnyoHeatpumpApplianceAvailableFeaturesEnum {
|
|
2
2
|
/** If the heatpump is capable of domestic hot water*/
|
|
3
3
|
DomesticHotWater = "DomesticHotWater",
|
|
4
|
-
/** If the heatpump is capable of domestic hot water boost to use more pv energy*/
|
|
5
|
-
DomesticHotWaterBoost = "DomesticHotWaterBoost",
|
|
6
4
|
/** If the heatpump has a heating rod*/
|
|
7
5
|
HeatingRod = "HeatingRod",
|
|
8
6
|
/** If the heatpump supports room overheating via heating circuits */
|
|
@@ -2,8 +2,6 @@ export var EnyoHeatpumpApplianceAvailableFeaturesEnum;
|
|
|
2
2
|
(function (EnyoHeatpumpApplianceAvailableFeaturesEnum) {
|
|
3
3
|
/** If the heatpump is capable of domestic hot water*/
|
|
4
4
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["DomesticHotWater"] = "DomesticHotWater";
|
|
5
|
-
/** If the heatpump is capable of domestic hot water boost to use more pv energy*/
|
|
6
|
-
EnyoHeatpumpApplianceAvailableFeaturesEnum["DomesticHotWaterBoost"] = "DomesticHotWaterBoost";
|
|
7
5
|
/** If the heatpump has a heating rod*/
|
|
8
6
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["HeatingRod"] = "HeatingRod";
|
|
9
7
|
/** If the heatpump supports room overheating via heating circuits */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EnyoPackageConfigurationTranslatedValue } from "./enyo-settings.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a learning phase tracked by an Energy App.
|
|
4
|
+
* A learning phase is a period during which an app or appliance is calibrating,
|
|
5
|
+
* gathering data, or optimizing its behavior (e.g., a heatpump learning optimal heating curves).
|
|
6
|
+
*/
|
|
7
|
+
export interface EnyoLearningPhase {
|
|
8
|
+
/** Unique identifier of the learning phase */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Name identifying the learning phase (e.g., 'heating-curve-optimization') */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Optional appliance ID — if omitted, the learning phase applies to the entire package */
|
|
13
|
+
applianceId?: string;
|
|
14
|
+
/** Optional translated reason explaining why this learning phase is needed */
|
|
15
|
+
reason?: EnyoPackageConfigurationTranslatedValue[];
|
|
16
|
+
/** Optional translated description providing details about what is being learned */
|
|
17
|
+
description?: EnyoPackageConfigurationTranslatedValue[];
|
|
18
|
+
/** ISO 8601 date string of when the learning phase started */
|
|
19
|
+
startDate: string;
|
|
20
|
+
/** ISO 8601 date string of when the learning phase ended — undefined if still active */
|
|
21
|
+
endDate?: string;
|
|
22
|
+
/** Duration of the learning phase in hours (elapsed if active, total if completed) */
|
|
23
|
+
durationInHours: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registration parameters for creating a new learning phase.
|
|
27
|
+
*/
|
|
28
|
+
export interface EnyoLearningPhaseRegistration {
|
|
29
|
+
/** Name identifying the learning phase (e.g., 'heating-curve-optimization') */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Optional appliance ID — if omitted, the learning phase applies to the entire package */
|
|
32
|
+
applianceId?: string;
|
|
33
|
+
/** Optional translated reason explaining why this learning phase is needed */
|
|
34
|
+
reason?: EnyoPackageConfigurationTranslatedValue[];
|
|
35
|
+
/** Optional translated description providing details about what is being learned */
|
|
36
|
+
description?: EnyoPackageConfigurationTranslatedValue[];
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED