@enyo-energy/energy-app-sdk 0.0.166 → 0.0.168
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/dist/cjs/energy-app-appliance-type.enum.cjs +1 -0
- package/dist/cjs/energy-app-appliance-type.enum.d.cts +2 -1
- package/dist/cjs/energy-app-package-definition.cjs +1 -0
- package/dist/cjs/energy-app-package-definition.d.cts +1 -0
- package/dist/cjs/energy-app-permission.type.cjs +1 -0
- package/dist/cjs/energy-app-permission.type.d.cts +3 -2
- package/dist/cjs/energy-app.cjs +13 -0
- package/dist/cjs/energy-app.d.cts +12 -0
- package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -0
- package/dist/cjs/implementations/appliances/appliance-manager.cjs +2 -0
- package/dist/cjs/implementations/appliances/appliance-manager.d.cts +5 -1
- package/dist/cjs/implementations/appliances/in-memory-appliance-manager.cjs +17 -4
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.d.cts +3 -0
- package/dist/cjs/packages/energy-app-file.cjs +2 -0
- package/dist/cjs/packages/energy-app-file.d.cts +90 -0
- package/dist/cjs/types/enyo-appliance.cjs +1 -0
- package/dist/cjs/types/enyo-appliance.d.cts +5 -1
- package/dist/cjs/types/enyo-data-bus-value.cjs +1 -0
- package/dist/cjs/types/enyo-data-bus-value.d.cts +19 -0
- package/dist/cjs/types/enyo-file.cjs +2 -0
- package/dist/cjs/types/enyo-file.d.cts +108 -0
- package/dist/cjs/types/enyo-heating-rod-appliance.cjs +24 -0
- package/dist/cjs/types/enyo-heating-rod-appliance.d.cts +37 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/energy-app-appliance-type.enum.d.ts +2 -1
- package/dist/energy-app-appliance-type.enum.js +1 -0
- package/dist/energy-app-package-definition.d.ts +1 -0
- package/dist/energy-app-package-definition.js +1 -0
- package/dist/energy-app-permission.type.d.ts +3 -2
- package/dist/energy-app-permission.type.js +1 -0
- package/dist/energy-app.d.ts +12 -0
- package/dist/energy-app.js +13 -0
- package/dist/enyo-energy-app-sdk.d.ts +3 -0
- package/dist/implementations/appliances/appliance-manager.d.ts +5 -1
- package/dist/implementations/appliances/appliance-manager.js +2 -0
- package/dist/implementations/appliances/in-memory-appliance-manager.js +17 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/packages/energy-app-file.d.ts +90 -0
- package/dist/packages/energy-app-file.js +1 -0
- package/dist/types/enyo-appliance.d.ts +5 -1
- package/dist/types/enyo-appliance.js +1 -0
- package/dist/types/enyo-data-bus-value.d.ts +19 -0
- package/dist/types/enyo-data-bus-value.js +1 -0
- package/dist/types/enyo-file.d.ts +108 -0
- package/dist/types/enyo-file.js +1 -0
- package/dist/types/enyo-heating-rod-appliance.d.ts +37 -0
- package/dist/types/enyo-heating-rod-appliance.js +21 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -20,4 +20,5 @@ var EnergyAppApplianceTypeEnum;
|
|
|
20
20
|
EnergyAppApplianceTypeEnum["Oven"] = "oven";
|
|
21
21
|
EnergyAppApplianceTypeEnum["Freezer"] = "freezer";
|
|
22
22
|
EnergyAppApplianceTypeEnum["AirConditioning"] = "air-conditioning";
|
|
23
|
+
EnergyAppApplianceTypeEnum["HeatingRod"] = "heating-rod";
|
|
23
24
|
})(EnergyAppApplianceTypeEnum || (exports.EnergyAppApplianceTypeEnum = EnergyAppApplianceTypeEnum = {}));
|
|
@@ -17,6 +17,7 @@ var EnergyAppPackageCategory;
|
|
|
17
17
|
EnergyAppPackageCategory["StaticElectricityTariff"] = "static-electricity-tariff";
|
|
18
18
|
EnergyAppPackageCategory["TemperatureSensor"] = "temperature-sensor";
|
|
19
19
|
EnergyAppPackageCategory["SmartPlug"] = "smart-plug";
|
|
20
|
+
EnergyAppPackageCategory["HeatingRod"] = "heating-rod";
|
|
20
21
|
EnergyAppPackageCategory["Other"] = "other";
|
|
21
22
|
})(EnergyAppPackageCategory || (exports.EnergyAppPackageCategory = EnergyAppPackageCategory = {}));
|
|
22
23
|
/**
|
|
@@ -48,4 +48,5 @@ var EnergyAppPermissionTypeEnum;
|
|
|
48
48
|
EnergyAppPermissionTypeEnum["Wifi"] = "Wifi";
|
|
49
49
|
EnergyAppPermissionTypeEnum["ChildProcess"] = "ChildProcess";
|
|
50
50
|
EnergyAppPermissionTypeEnum["Udp"] = "Udp";
|
|
51
|
+
EnergyAppPermissionTypeEnum["ProvidedFiles"] = "ProvidedFiles";
|
|
51
52
|
})(EnergyAppPermissionTypeEnum || (exports.EnergyAppPermissionTypeEnum = EnergyAppPermissionTypeEnum = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'AllNetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'DynamicPriceForecastRegister' | 'DynamicPriceForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'BatteryStorageState' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'Wifi' | 'ChildProcess' | 'Udp';
|
|
1
|
+
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'AllNetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'DynamicPriceForecastRegister' | 'DynamicPriceForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'BatteryStorageState' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'Wifi' | 'ChildProcess' | 'Udp' | 'ProvidedFiles';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -44,5 +44,6 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
44
44
|
Bluetooth = "Bluetooth",
|
|
45
45
|
Wifi = "Wifi",
|
|
46
46
|
ChildProcess = "ChildProcess",
|
|
47
|
-
Udp = "Udp"
|
|
47
|
+
Udp = "Udp",
|
|
48
|
+
ProvidedFiles = "ProvidedFiles"
|
|
48
49
|
}
|
package/dist/cjs/energy-app.cjs
CHANGED
|
@@ -323,6 +323,19 @@ class EnergyApp {
|
|
|
323
323
|
useBatteries() {
|
|
324
324
|
return this.energyAppSdk.useBatteries();
|
|
325
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Gets the File API for providing user-facing files.
|
|
328
|
+
* Files are registered with a translated display name and optional
|
|
329
|
+
* translated explanation; their content (base64 + MIME type + concrete
|
|
330
|
+
* file name) is produced on demand by the registered handler when the user
|
|
331
|
+
* chooses to store the file.
|
|
332
|
+
* @returns The File API instance
|
|
333
|
+
* @throws {EnergyAppPermissionNotGrantedError} If the `ProvidedFiles`
|
|
334
|
+
* permission is not granted.
|
|
335
|
+
*/
|
|
336
|
+
useFiles() {
|
|
337
|
+
return this.energyAppSdk.useFiles();
|
|
338
|
+
}
|
|
326
339
|
/**
|
|
327
340
|
* Gets the current SDK version.
|
|
328
341
|
* @returns The semantic version string of the SDK
|
|
@@ -37,6 +37,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
|
|
|
37
37
|
import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.cjs";
|
|
38
38
|
import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.cjs";
|
|
39
39
|
import { EnergyAppBattery } from "./packages/energy-app-battery.cjs";
|
|
40
|
+
import { EnergyAppFile } from "./packages/energy-app-file.cjs";
|
|
40
41
|
import { UseFetchOptions } from "./types/enyo-fetch.cjs";
|
|
41
42
|
/**
|
|
42
43
|
* Concrete implementation of {@link EnyoEnergyAppSdk} that delegates every call
|
|
@@ -256,6 +257,17 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
256
257
|
* @returns The Battery API instance
|
|
257
258
|
*/
|
|
258
259
|
useBatteries(): EnergyAppBattery;
|
|
260
|
+
/**
|
|
261
|
+
* Gets the File API for providing user-facing files.
|
|
262
|
+
* Files are registered with a translated display name and optional
|
|
263
|
+
* translated explanation; their content (base64 + MIME type + concrete
|
|
264
|
+
* file name) is produced on demand by the registered handler when the user
|
|
265
|
+
* chooses to store the file.
|
|
266
|
+
* @returns The File API instance
|
|
267
|
+
* @throws {EnergyAppPermissionNotGrantedError} If the `ProvidedFiles`
|
|
268
|
+
* permission is not granted.
|
|
269
|
+
*/
|
|
270
|
+
useFiles(): EnergyAppFile;
|
|
259
271
|
/**
|
|
260
272
|
* Gets the current SDK version.
|
|
261
273
|
* @returns The semantic version string of the SDK
|
|
@@ -36,6 +36,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
|
|
|
36
36
|
import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.cjs";
|
|
37
37
|
import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.cjs";
|
|
38
38
|
import { EnergyAppBattery } from "./packages/energy-app-battery.cjs";
|
|
39
|
+
import { EnergyAppFile } from "./packages/energy-app-file.cjs";
|
|
39
40
|
import { UseFetchOptions } from "./types/enyo-fetch.cjs";
|
|
40
41
|
export declare enum EnergyAppStateEnum {
|
|
41
42
|
Launching = "launching",
|
|
@@ -137,4 +138,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
137
138
|
useApplianceEnergyManagerForecast: () => EnergyAppApplianceEnergyManagerForecast;
|
|
138
139
|
/** Get the Battery API for retrieving the current runtime state of each battery storage (SoC, stored kWh, average price per kWh, optional solar share) */
|
|
139
140
|
useBatteries: () => EnergyAppBattery;
|
|
141
|
+
/** Get the File API for providing user-facing files whose translated names/explanations are shown by the host and whose content is produced on demand when the user stores them */
|
|
142
|
+
useFiles: () => EnergyAppFile;
|
|
140
143
|
}
|
|
@@ -59,6 +59,7 @@ const MERGEABLE_METADATA_KEYS = [
|
|
|
59
59
|
'meter',
|
|
60
60
|
'temperatureSensor',
|
|
61
61
|
'airConditioning',
|
|
62
|
+
'heatingRod',
|
|
62
63
|
];
|
|
63
64
|
/**
|
|
64
65
|
* Manages appliances in the energy system with configurable identification strategies.
|
|
@@ -207,6 +208,7 @@ class ApplianceManager {
|
|
|
207
208
|
inverter: appliance.inverter,
|
|
208
209
|
temperatureSensor: appliance.temperatureSensor,
|
|
209
210
|
airConditioning: appliance.airConditioning,
|
|
211
|
+
heatingRod: appliance.heatingRod,
|
|
210
212
|
// Conditionally spread the two optional top-level fields that are NOT
|
|
211
213
|
// covered by MERGEABLE_METADATA_KEYS. If they were always materialized
|
|
212
214
|
// as explicit keys, an omitted (undefined) value would clobber the
|
|
@@ -8,6 +8,7 @@ import type { EnyoInverterApplianceMetadata } from "../../types/enyo-inverter-ap
|
|
|
8
8
|
import type { EnyoMeterAppliance } from "../../types/enyo-meter-appliance.cjs";
|
|
9
9
|
import type { EnyoTemperatureSensorApplianceMetadata } from "../../types/enyo-temperature-sensor-appliance.cjs";
|
|
10
10
|
import type { EnyoAirConditioningApplianceMetadata } from "../../types/enyo-air-conditioning-appliance.cjs";
|
|
11
|
+
import type { EnyoHeatingRodApplianceMetadata } from "../../types/enyo-heating-rod-appliance.cjs";
|
|
11
12
|
import { IdentifierStrategy } from "./identifier-strategies.cjs";
|
|
12
13
|
/**
|
|
13
14
|
* Thrown when {@link ApplianceManager.createOrUpdateAppliance} is called with
|
|
@@ -59,6 +60,7 @@ export interface ApplianceConfig {
|
|
|
59
60
|
battery?: EnyoBatteryApplianceMetadata;
|
|
60
61
|
temperatureSensor?: EnyoTemperatureSensorApplianceMetadata;
|
|
61
62
|
airConditioning?: EnyoAirConditioningApplianceMetadata;
|
|
63
|
+
heatingRod?: EnyoHeatingRodApplianceMetadata;
|
|
62
64
|
availableFeatures?: EnyoApplianceAvailableFeaturesEnum[];
|
|
63
65
|
/**
|
|
64
66
|
* Optional identifier of the cloud-deployed energy app package that manages
|
|
@@ -140,7 +142,7 @@ export declare class ApplianceManager {
|
|
|
140
142
|
* @param update The partial update data to merge
|
|
141
143
|
* @returns The merged appliance data (without `id`)
|
|
142
144
|
*/
|
|
143
|
-
|
|
145
|
+
protected mergeApplianceData(existing: EnyoAppliance, update: Partial<Omit<PartialEnyoAppliance, 'id'>>): Omit<EnyoAppliance, 'id'>;
|
|
144
146
|
/**
|
|
145
147
|
* Creates a new ApplianceManager instance.
|
|
146
148
|
*
|
|
@@ -418,6 +420,8 @@ export interface PartialEnyoAppliance {
|
|
|
418
420
|
temperatureSensor?: Partial<EnyoTemperatureSensorApplianceMetadata>;
|
|
419
421
|
/** Optional Metadata of the Appliance if of type AirConditioning */
|
|
420
422
|
airConditioning?: Partial<EnyoAirConditioningApplianceMetadata>;
|
|
423
|
+
/** Optional Metadata of the Appliance if of type HeatingRod */
|
|
424
|
+
heatingRod?: Partial<EnyoHeatingRodApplianceMetadata>;
|
|
421
425
|
/** Optional custom name for the appliance, defined by the user */
|
|
422
426
|
customName?: string;
|
|
423
427
|
/**
|
|
@@ -52,10 +52,12 @@ class InMemoryApplianceManager extends appliance_manager_js_1.ApplianceManager {
|
|
|
52
52
|
enyo_appliance_js_1.EnyoApplianceStateEnum.Connected,
|
|
53
53
|
...appliance.metadata
|
|
54
54
|
};
|
|
55
|
-
// Build appliance data
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
// Build the incoming appliance data covering every ApplianceConfig field.
|
|
56
|
+
// The two optional top-level fields that are NOT shallow-merged by
|
|
57
|
+
// mergeApplianceData (`cloudPackageId`, `availableFeatures`) are only
|
|
58
|
+
// materialized when provided so an omitted value cannot clobber the stored
|
|
59
|
+
// one during an update; pass an explicit value (e.g. `[]`) to clear them.
|
|
60
|
+
const newApplianceData = {
|
|
59
61
|
name: appliance.name,
|
|
60
62
|
type: appliance.type,
|
|
61
63
|
networkDeviceIds,
|
|
@@ -66,7 +68,18 @@ class InMemoryApplianceManager extends appliance_manager_js_1.ApplianceManager {
|
|
|
66
68
|
battery: appliance.battery,
|
|
67
69
|
charger: appliance.charger,
|
|
68
70
|
inverter: appliance.inverter,
|
|
71
|
+
temperatureSensor: appliance.temperatureSensor,
|
|
72
|
+
airConditioning: appliance.airConditioning,
|
|
73
|
+
heatingRod: appliance.heatingRod,
|
|
74
|
+
...(appliance.cloudPackageId !== undefined && { cloudPackageId: appliance.cloudPackageId }),
|
|
75
|
+
...(appliance.availableFeatures !== undefined && { availableFeatures: appliance.availableFeatures }),
|
|
69
76
|
};
|
|
77
|
+
// On update, merge onto the stored appliance so type-specific metadata and
|
|
78
|
+
// top-level fields that were not supplied in this call are preserved.
|
|
79
|
+
const applianceId = existingAppliance?.id || (0, node_crypto_1.randomUUID)();
|
|
80
|
+
const applianceData = existingAppliance
|
|
81
|
+
? { ...this.mergeApplianceData(existingAppliance, newApplianceData), id: applianceId }
|
|
82
|
+
: { id: applianceId, ...newApplianceData };
|
|
70
83
|
// Save to memory store
|
|
71
84
|
this.memoryStore.set(applianceId, applianceData);
|
|
72
85
|
// Store network devices if provided
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -74,6 +74,7 @@ __exportStar(require("./packages/energy-app-grid-connection-point.cjs"), exports
|
|
|
74
74
|
__exportStar(require("./types/enyo-configuration-manager.cjs"), exports);
|
|
75
75
|
__exportStar(require("./packages/energy-app-configuration-manager.cjs"), exports);
|
|
76
76
|
__exportStar(require("./types/enyo-air-conditioning-appliance.cjs"), exports);
|
|
77
|
+
__exportStar(require("./types/enyo-heating-rod-appliance.cjs"), exports);
|
|
77
78
|
__exportStar(require("./types/enyo-onboarding.cjs"), exports);
|
|
78
79
|
__exportStar(require("./packages/energy-app-onboarding.cjs"), exports);
|
|
79
80
|
__exportStar(require("./types/enyo-retry-manager.cjs"), exports);
|
|
@@ -103,3 +104,5 @@ __exportStar(require("./implementations/energy-manager-diagnostics/energy-manage
|
|
|
103
104
|
__exportStar(require("./types/enyo-battery-state.cjs"), exports);
|
|
104
105
|
__exportStar(require("./packages/energy-app-battery.cjs"), exports);
|
|
105
106
|
__exportStar(require("./types/enyo-fetch.cjs"), exports);
|
|
107
|
+
__exportStar(require("./types/enyo-file.cjs"), exports);
|
|
108
|
+
__exportStar(require("./packages/energy-app-file.cjs"), exports);
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './packages/energy-app-grid-connection-point.cjs';
|
|
|
58
58
|
export * from './types/enyo-configuration-manager.cjs';
|
|
59
59
|
export * from './packages/energy-app-configuration-manager.cjs';
|
|
60
60
|
export * from './types/enyo-air-conditioning-appliance.cjs';
|
|
61
|
+
export * from './types/enyo-heating-rod-appliance.cjs';
|
|
61
62
|
export * from './types/enyo-onboarding.cjs';
|
|
62
63
|
export * from './packages/energy-app-onboarding.cjs';
|
|
63
64
|
export * from './types/enyo-retry-manager.cjs';
|
|
@@ -87,3 +88,5 @@ export * from './implementations/energy-manager-diagnostics/energy-manager-diagn
|
|
|
87
88
|
export * from './types/enyo-battery-state.cjs';
|
|
88
89
|
export * from './packages/energy-app-battery.cjs';
|
|
89
90
|
export * from './types/enyo-fetch.cjs';
|
|
91
|
+
export * from './types/enyo-file.cjs';
|
|
92
|
+
export * from './packages/energy-app-file.cjs';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EnyoFileRegistration, EnyoFileContentHandler, EnyoFileInfo } from "../types/enyo-file.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for providing files to the user from within an Energy App package.
|
|
4
|
+
*
|
|
5
|
+
* A package registers files it can produce; the host renders each file's
|
|
6
|
+
* translated name (and optional explanation) in its UI. The file's bytes are
|
|
7
|
+
* NOT supplied at registration time — instead the package registers an
|
|
8
|
+
* {@link EnyoFileContentHandler} that the host invokes lazily when the user
|
|
9
|
+
* chooses to store/save the file. This allows large or expensive payloads
|
|
10
|
+
* (reports, CSV/PDF exports, diagnostic bundles) to be generated on demand.
|
|
11
|
+
*
|
|
12
|
+
* Registration uses upsert semantics keyed by `fileId`: re-registering the same
|
|
13
|
+
* `fileId` replaces both the translations and the content handler.
|
|
14
|
+
*
|
|
15
|
+
* Access to this API requires the `ProvidedFiles` permission
|
|
16
|
+
* ({@link EnergyAppPermissionType}); {@link EnergyApp.useFiles} throws when it
|
|
17
|
+
* has not been granted.
|
|
18
|
+
*/
|
|
19
|
+
export interface EnergyAppFile {
|
|
20
|
+
/**
|
|
21
|
+
* Registers a provided file with the host, or updates an existing one.
|
|
22
|
+
*
|
|
23
|
+
* Uses upsert logic based on `registration.fileId`: if a file with the same
|
|
24
|
+
* ID is already registered it is replaced (both its translations and its
|
|
25
|
+
* content handler); otherwise a new entry is created. The `handler` is
|
|
26
|
+
* stored by the host and invoked later — once per store action — when the
|
|
27
|
+
* user decides to save the file.
|
|
28
|
+
*
|
|
29
|
+
* @param registration - Descriptive metadata for the file: its `fileId`,
|
|
30
|
+
* translated `name`, optional translated `explanation`, and optional
|
|
31
|
+
* `applianceId` scoping.
|
|
32
|
+
* @param handler - Callback invoked lazily by the host when the user stores
|
|
33
|
+
* the file; resolves to the file's base64 content, MIME type and concrete
|
|
34
|
+
* file name.
|
|
35
|
+
* @returns Promise that resolves once the file has been registered with the
|
|
36
|
+
* host.
|
|
37
|
+
* @throws {EnergyAppPermissionNotGrantedError} If the `ProvidedFiles`
|
|
38
|
+
* permission is not granted.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* await file.registerFile(
|
|
43
|
+
* {
|
|
44
|
+
* fileId: 'monthly-charging-report',
|
|
45
|
+
* name: [
|
|
46
|
+
* { language: 'en', value: 'Monthly charging report' },
|
|
47
|
+
* { language: 'de', value: 'Monatlicher Ladebericht' }
|
|
48
|
+
* ],
|
|
49
|
+
* explanation: [
|
|
50
|
+
* { language: 'en', value: 'A PDF summary of this month\'s charging sessions.' },
|
|
51
|
+
* { language: 'de', value: 'Eine PDF-Zusammenfassung der Ladevorgänge dieses Monats.' }
|
|
52
|
+
* ]
|
|
53
|
+
* },
|
|
54
|
+
* async () => ({
|
|
55
|
+
* base64: await buildReportPdfBase64(),
|
|
56
|
+
* mimeType: 'application/pdf',
|
|
57
|
+
* fileName: 'charging-report-2026-07.pdf'
|
|
58
|
+
* })
|
|
59
|
+
* );
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
registerFile(registration: EnyoFileRegistration, handler: EnyoFileContentHandler): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Removes a previously registered provided file by its ID.
|
|
65
|
+
*
|
|
66
|
+
* After deregistration the host no longer shows the file and will not invoke
|
|
67
|
+
* its content handler. If no file with the given ID is registered this
|
|
68
|
+
* operation is a no-op.
|
|
69
|
+
*
|
|
70
|
+
* @param fileId - The identifier the file was registered under.
|
|
71
|
+
* @returns Promise that resolves once the file has been removed.
|
|
72
|
+
*/
|
|
73
|
+
deregisterFile(fileId: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves all files currently registered by this package.
|
|
76
|
+
*
|
|
77
|
+
* Returns descriptive metadata only (ids, translated names and
|
|
78
|
+
* explanations, optional appliance scoping); the file content is never
|
|
79
|
+
* included and is always produced on demand via the registered handler.
|
|
80
|
+
*
|
|
81
|
+
* @returns Promise resolving to an array of registered file descriptors.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const files = await file.listFiles();
|
|
86
|
+
* files.forEach(f => console.log(f.fileId));
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
listFiles(): Promise<EnyoFileInfo[]>;
|
|
90
|
+
}
|
|
@@ -10,6 +10,7 @@ var EnyoApplianceTypeEnum;
|
|
|
10
10
|
EnyoApplianceTypeEnum["Heatpump"] = "Heatpump";
|
|
11
11
|
EnyoApplianceTypeEnum["AirConditioning"] = "AirConditioning";
|
|
12
12
|
EnyoApplianceTypeEnum["TemperatureSensor"] = "TemperatureSensor";
|
|
13
|
+
EnyoApplianceTypeEnum["HeatingRod"] = "HeatingRod";
|
|
13
14
|
})(EnyoApplianceTypeEnum || (exports.EnyoApplianceTypeEnum = EnyoApplianceTypeEnum = {}));
|
|
14
15
|
var EnyoApplianceStateEnum;
|
|
15
16
|
(function (EnyoApplianceStateEnum) {
|
|
@@ -6,6 +6,7 @@ import { EnyoInverterApplianceMetadata } from "./enyo-inverter-appliance.cjs";
|
|
|
6
6
|
import { EnyoMeterAppliance } from "./enyo-meter-appliance.cjs";
|
|
7
7
|
import { EnyoTemperatureSensorApplianceMetadata } from "./enyo-temperature-sensor-appliance.cjs";
|
|
8
8
|
import { EnyoAirConditioningApplianceMetadata } from "./enyo-air-conditioning-appliance.cjs";
|
|
9
|
+
import { EnyoHeatingRodApplianceMetadata } from "./enyo-heating-rod-appliance.cjs";
|
|
9
10
|
export declare enum EnyoApplianceTypeEnum {
|
|
10
11
|
Inverter = "Inverter",
|
|
11
12
|
Charger = "Charger",
|
|
@@ -13,7 +14,8 @@ export declare enum EnyoApplianceTypeEnum {
|
|
|
13
14
|
Meter = "Meter",
|
|
14
15
|
Heatpump = "Heatpump",
|
|
15
16
|
AirConditioning = "AirConditioning",
|
|
16
|
-
TemperatureSensor = "TemperatureSensor"
|
|
17
|
+
TemperatureSensor = "TemperatureSensor",
|
|
18
|
+
HeatingRod = "HeatingRod"
|
|
17
19
|
}
|
|
18
20
|
export interface EnyoApplianceName {
|
|
19
21
|
language: EnergyAppPackageLanguage;
|
|
@@ -247,6 +249,8 @@ export interface EnyoAppliance {
|
|
|
247
249
|
temperatureSensor?: EnyoTemperatureSensorApplianceMetadata;
|
|
248
250
|
/** Optional Metadata of the Appliance if of type AirConditioning */
|
|
249
251
|
airConditioning?: EnyoAirConditioningApplianceMetadata;
|
|
252
|
+
/** Optional Metadata of the Appliance if of type HeatingRod */
|
|
253
|
+
heatingRod?: EnyoHeatingRodApplianceMetadata;
|
|
250
254
|
/** Optional custom name for the appliance, defined by the user */
|
|
251
255
|
customName?: string;
|
|
252
256
|
/**
|
|
@@ -219,6 +219,7 @@ var EnyoDataBusMessageEnum;
|
|
|
219
219
|
EnyoDataBusMessageEnum["ClearChargingProfilesV1"] = "ClearChargingProfilesV1";
|
|
220
220
|
EnyoDataBusMessageEnum["HeatpumpOverheatingV1"] = "HeatpumpOverheatingV1";
|
|
221
221
|
EnyoDataBusMessageEnum["HeatpumpAvailablePowerAnnouncementV1"] = "HeatpumpAvailablePowerAnnouncementV1";
|
|
222
|
+
EnyoDataBusMessageEnum["HeatingRodAvailablePowerAnnouncementV1"] = "HeatingRodAvailablePowerAnnouncementV1";
|
|
222
223
|
EnyoDataBusMessageEnum["AirConditioningValuesUpdateV1"] = "AirConditioningValuesUpdateV1";
|
|
223
224
|
EnyoDataBusMessageEnum["AirConditioningTemperaturesUpdateV1"] = "AirConditioningTemperaturesUpdateV1";
|
|
224
225
|
EnyoDataBusMessageEnum["StartAirConditioningV1"] = "StartAirConditioningV1";
|
|
@@ -251,6 +251,7 @@ export declare enum EnyoDataBusMessageEnum {
|
|
|
251
251
|
ClearChargingProfilesV1 = "ClearChargingProfilesV1",
|
|
252
252
|
HeatpumpOverheatingV1 = "HeatpumpOverheatingV1",
|
|
253
253
|
HeatpumpAvailablePowerAnnouncementV1 = "HeatpumpAvailablePowerAnnouncementV1",
|
|
254
|
+
HeatingRodAvailablePowerAnnouncementV1 = "HeatingRodAvailablePowerAnnouncementV1",
|
|
254
255
|
AirConditioningValuesUpdateV1 = "AirConditioningValuesUpdateV1",
|
|
255
256
|
AirConditioningTemperaturesUpdateV1 = "AirConditioningTemperaturesUpdateV1",
|
|
256
257
|
StartAirConditioningV1 = "StartAirConditioningV1",
|
|
@@ -341,6 +342,8 @@ export interface EnyoDataBusHeatpumpValuesV1 extends EnyoDataBusMessage {
|
|
|
341
342
|
operationMode: EnyoHeatpumpApplianceModeEnum;
|
|
342
343
|
/** current power consumption in W */
|
|
343
344
|
powerW?: number;
|
|
345
|
+
/** Cumulative energy meter reading of the heatpump in Wh (meter value)*/
|
|
346
|
+
meterValueWh?: number;
|
|
344
347
|
/** Power consumption for heating in Wh (meter value)*/
|
|
345
348
|
powerConsumptionHeatingWh?: number;
|
|
346
349
|
/** Power consumption for domestic hot water in Wh (meter value)*/
|
|
@@ -1594,6 +1597,22 @@ export interface EnyoDataBusHeatpumpAvailablePowerAnnouncementV1 extends EnyoDat
|
|
|
1594
1597
|
reason?: EnyoDataBusCommandReason;
|
|
1595
1598
|
};
|
|
1596
1599
|
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Data bus message announcing available power for a heating rod appliance.
|
|
1602
|
+
* Used to inform the heating rod about how much power is available for consumption.
|
|
1603
|
+
*/
|
|
1604
|
+
export interface EnyoDataBusHeatingRodAvailablePowerAnnouncementV1 extends EnyoDataBusMessage {
|
|
1605
|
+
type: 'message';
|
|
1606
|
+
message: EnyoDataBusMessageEnum.HeatingRodAvailablePowerAnnouncementV1;
|
|
1607
|
+
/** ID of the heating rod appliance */
|
|
1608
|
+
applianceId: string;
|
|
1609
|
+
data: {
|
|
1610
|
+
/** Available power for the heating rod to use (in Watt) */
|
|
1611
|
+
powerW: number;
|
|
1612
|
+
/** Optional reason why this announcement was issued */
|
|
1613
|
+
reason?: EnyoDataBusCommandReason;
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1597
1616
|
/**
|
|
1598
1617
|
* Data bus message for reporting air conditioning power values.
|
|
1599
1618
|
* Contains the current operating mode and power consumption.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { EnergyAppPackageLanguage } from "../energy-app-package-definition.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* A translated, human-readable string used when presenting a provided file to
|
|
4
|
+
* the user (e.g. its display name or explanation).
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the translation shape used elsewhere in the SDK (see
|
|
7
|
+
* {@link EnyoPackageConfigurationTranslatedValue}): the host picks the entry
|
|
8
|
+
* whose {@link language} matches the active UI language, falling back to another
|
|
9
|
+
* available language when no exact match exists.
|
|
10
|
+
*/
|
|
11
|
+
export interface EnyoFileTranslation {
|
|
12
|
+
/** Language code this translation applies to. */
|
|
13
|
+
language: EnergyAppPackageLanguage;
|
|
14
|
+
/** The displayed text in the given language. */
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The concrete, on-demand content of a provided file.
|
|
19
|
+
*
|
|
20
|
+
* Produced by an {@link EnyoFileContentHandler} at the moment the user chooses
|
|
21
|
+
* to store the file. The payload is transferred as a base64-encoded string so
|
|
22
|
+
* that arbitrary binary content (PDF, ZIP, images, ...) can cross the app/host
|
|
23
|
+
* boundary safely.
|
|
24
|
+
*/
|
|
25
|
+
export interface EnyoFileContent {
|
|
26
|
+
/**
|
|
27
|
+
* File payload, base64-encoded. For text formats this is the base64 of the
|
|
28
|
+
* UTF-8 bytes; for binary formats the base64 of the raw bytes. Must NOT
|
|
29
|
+
* include a `data:` URI prefix.
|
|
30
|
+
*/
|
|
31
|
+
base64: string;
|
|
32
|
+
/**
|
|
33
|
+
* IANA MIME type describing the payload, e.g. `application/pdf`,
|
|
34
|
+
* `text/csv`, `application/zip`. Used by the host to choose which
|
|
35
|
+
* application opens the file and to set download headers.
|
|
36
|
+
*/
|
|
37
|
+
mimeType: string;
|
|
38
|
+
/**
|
|
39
|
+
* Concrete file name including extension used when the file is written to
|
|
40
|
+
* disk, e.g. `charging-report-2026-07.pdf`. This is the technical on-disk
|
|
41
|
+
* file name and is distinct from the translated display name shown in the
|
|
42
|
+
* UI (see {@link EnyoFileRegistration.name}).
|
|
43
|
+
*/
|
|
44
|
+
fileName: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Handler invoked by the host when the user chooses to store/save a previously
|
|
48
|
+
* registered provided file.
|
|
49
|
+
*
|
|
50
|
+
* The handler is called lazily — content is produced on demand rather than at
|
|
51
|
+
* registration time — which lets the app generate large or expensive payloads
|
|
52
|
+
* (reports, exports, log bundles) only when actually requested. The returned
|
|
53
|
+
* promise must resolve to the file's {@link EnyoFileContent}; rejecting it
|
|
54
|
+
* signals to the host that the content could not be produced and that the store
|
|
55
|
+
* action should fail gracefully.
|
|
56
|
+
*
|
|
57
|
+
* @returns A promise resolving to the file's base64 content, MIME type and
|
|
58
|
+
* concrete file name.
|
|
59
|
+
*/
|
|
60
|
+
export type EnyoFileContentHandler = () => Promise<EnyoFileContent>;
|
|
61
|
+
/**
|
|
62
|
+
* Registration payload describing a file the app offers to the user.
|
|
63
|
+
*
|
|
64
|
+
* The translated {@link name} (and optional {@link explanation}) are stored by
|
|
65
|
+
* the host and shown in the UI without the app needing to ship per-host UI
|
|
66
|
+
* strings. The actual bytes are supplied later by the
|
|
67
|
+
* {@link EnyoFileContentHandler} passed alongside this registration to
|
|
68
|
+
* {@link EnergyAppFile.registerFile}.
|
|
69
|
+
*/
|
|
70
|
+
export interface EnyoFileRegistration {
|
|
71
|
+
/**
|
|
72
|
+
* Stable, app-chosen identifier for this file. Used for upsert semantics on
|
|
73
|
+
* {@link EnergyAppFile.registerFile} and as the key for
|
|
74
|
+
* {@link EnergyAppFile.deregisterFile}. Must be unique within the package.
|
|
75
|
+
*/
|
|
76
|
+
fileId: string;
|
|
77
|
+
/** Translated display name shown to the user in the host UI. */
|
|
78
|
+
name: EnyoFileTranslation[];
|
|
79
|
+
/**
|
|
80
|
+
* Optional translated explanation giving the user more context about what
|
|
81
|
+
* the file contains and why they might want to store it.
|
|
82
|
+
*/
|
|
83
|
+
explanation?: EnyoFileTranslation[];
|
|
84
|
+
/**
|
|
85
|
+
* Optional appliance ID scoping this file to a specific appliance. When
|
|
86
|
+
* set, the host may surface the file on that appliance's screen; when
|
|
87
|
+
* omitted the file is treated as package-level.
|
|
88
|
+
*/
|
|
89
|
+
applianceId?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Read-only view of a currently registered provided file, as returned by
|
|
93
|
+
* {@link EnergyAppFile.listFiles}.
|
|
94
|
+
*
|
|
95
|
+
* Contains only the descriptive metadata registered by the app — never the file
|
|
96
|
+
* content itself, which is always produced on demand via the registered
|
|
97
|
+
* {@link EnyoFileContentHandler}.
|
|
98
|
+
*/
|
|
99
|
+
export interface EnyoFileInfo {
|
|
100
|
+
/** Identifier the file was registered under. */
|
|
101
|
+
fileId: string;
|
|
102
|
+
/** Translated display name shown to the user. */
|
|
103
|
+
name: EnyoFileTranslation[];
|
|
104
|
+
/** Optional translated explanation shown alongside the name. */
|
|
105
|
+
explanation?: EnyoFileTranslation[];
|
|
106
|
+
/** Optional appliance ID this file is scoped to, if any. */
|
|
107
|
+
applianceId?: string;
|
|
108
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnyoHeatingRodApplianceModeEnum = exports.EnyoHeatingRodApplianceAvailableFeaturesEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Available features for a heating rod (immersion / electric resistive heating
|
|
6
|
+
* element) appliance.
|
|
7
|
+
*/
|
|
8
|
+
var EnyoHeatingRodApplianceAvailableFeaturesEnum;
|
|
9
|
+
(function (EnyoHeatingRodApplianceAvailableFeaturesEnum) {
|
|
10
|
+
/** If the heating rod reports electrical power values (e.g. consumption in watts) */
|
|
11
|
+
EnyoHeatingRodApplianceAvailableFeaturesEnum["Power"] = "Power";
|
|
12
|
+
/** If the heating rod supports available power announcements */
|
|
13
|
+
EnyoHeatingRodApplianceAvailableFeaturesEnum["AvailablePowerAnnouncement"] = "AvailablePowerAnnouncement";
|
|
14
|
+
})(EnyoHeatingRodApplianceAvailableFeaturesEnum || (exports.EnyoHeatingRodApplianceAvailableFeaturesEnum = EnyoHeatingRodApplianceAvailableFeaturesEnum = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Operating modes for a heating rod appliance.
|
|
17
|
+
*/
|
|
18
|
+
var EnyoHeatingRodApplianceModeEnum;
|
|
19
|
+
(function (EnyoHeatingRodApplianceModeEnum) {
|
|
20
|
+
/** The heating rod is idle (not consuming power) */
|
|
21
|
+
EnyoHeatingRodApplianceModeEnum["Idle"] = "Idle";
|
|
22
|
+
/** The heating rod is actively heating */
|
|
23
|
+
EnyoHeatingRodApplianceModeEnum["Heating"] = "Heating";
|
|
24
|
+
})(EnyoHeatingRodApplianceModeEnum || (exports.EnyoHeatingRodApplianceModeEnum = EnyoHeatingRodApplianceModeEnum = {}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available features for a heating rod (immersion / electric resistive heating
|
|
3
|
+
* element) appliance.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum EnyoHeatingRodApplianceAvailableFeaturesEnum {
|
|
6
|
+
/** If the heating rod reports electrical power values (e.g. consumption in watts) */
|
|
7
|
+
Power = "Power",
|
|
8
|
+
/** If the heating rod supports available power announcements */
|
|
9
|
+
AvailablePowerAnnouncement = "AvailablePowerAnnouncement"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Operating modes for a heating rod appliance.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum EnyoHeatingRodApplianceModeEnum {
|
|
15
|
+
/** The heating rod is idle (not consuming power) */
|
|
16
|
+
Idle = "Idle",
|
|
17
|
+
/** The heating rod is actively heating */
|
|
18
|
+
Heating = "Heating"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Type-specific metadata for a heating rod appliance.
|
|
22
|
+
* Contains available features, current operating mode, rated power, and an
|
|
23
|
+
* optional reference to the heat pump the heating rod is associated with.
|
|
24
|
+
*/
|
|
25
|
+
export interface EnyoHeatingRodApplianceMetadata {
|
|
26
|
+
/** List of features supported by this heating rod */
|
|
27
|
+
availableFeatures: EnyoHeatingRodApplianceAvailableFeaturesEnum[];
|
|
28
|
+
/** Current operating mode of the heating rod */
|
|
29
|
+
mode?: EnyoHeatingRodApplianceModeEnum;
|
|
30
|
+
/** Rated electrical power of the heating rod in watts */
|
|
31
|
+
ratedPowerW?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional identifier of the heat pump appliance this heating rod is
|
|
34
|
+
* associated with. References the `id` of an EnyoAppliance of type Heatpump.
|
|
35
|
+
*/
|
|
36
|
+
heatpumpApplianceId?: string;
|
|
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.168';
|
|
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
|
@@ -17,4 +17,5 @@ export var EnergyAppApplianceTypeEnum;
|
|
|
17
17
|
EnergyAppApplianceTypeEnum["Oven"] = "oven";
|
|
18
18
|
EnergyAppApplianceTypeEnum["Freezer"] = "freezer";
|
|
19
19
|
EnergyAppApplianceTypeEnum["AirConditioning"] = "air-conditioning";
|
|
20
|
+
EnergyAppApplianceTypeEnum["HeatingRod"] = "heating-rod";
|
|
20
21
|
})(EnergyAppApplianceTypeEnum || (EnergyAppApplianceTypeEnum = {}));
|