@enyo-energy/energy-app-sdk 0.0.116 → 0.0.118
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-permission.type.cjs +1 -0
- package/dist/cjs/energy-app-permission.type.d.cts +2 -1
- package/dist/cjs/energy-app.cjs +9 -0
- package/dist/cjs/energy-app.d.cts +8 -0
- package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/packages/energy-app-onboarding.d.cts +42 -0
- package/dist/cjs/packages/energy-app-wifi.cjs +2 -0
- package/dist/cjs/packages/energy-app-wifi.d.cts +38 -0
- package/dist/cjs/types/enyo-charger-appliance.cjs +2 -0
- package/dist/cjs/types/enyo-charger-appliance.d.cts +3 -1
- package/dist/cjs/types/enyo-wifi.cjs +2 -0
- package/dist/cjs/types/enyo-wifi.d.cts +80 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/energy-app-permission.type.d.ts +2 -1
- package/dist/energy-app-permission.type.js +1 -0
- package/dist/energy-app.d.ts +8 -0
- package/dist/energy-app.js +9 -0
- package/dist/enyo-energy-app-sdk.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/packages/energy-app-onboarding.d.ts +42 -0
- package/dist/packages/energy-app-wifi.d.ts +38 -0
- package/dist/packages/energy-app-wifi.js +1 -0
- package/dist/types/enyo-charger-appliance.d.ts +3 -1
- package/dist/types/enyo-charger-appliance.js +2 -0
- package/dist/types/enyo-wifi.d.ts +80 -0
- package/dist/types/enyo-wifi.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -41,5 +41,6 @@ var EnergyAppPermissionTypeEnum;
|
|
|
41
41
|
EnergyAppPermissionTypeEnum["EebusControl"] = "EebusControl";
|
|
42
42
|
EnergyAppPermissionTypeEnum["Mqtt"] = "Mqtt";
|
|
43
43
|
EnergyAppPermissionTypeEnum["Bluetooth"] = "Bluetooth";
|
|
44
|
+
EnergyAppPermissionTypeEnum["Wifi"] = "Wifi";
|
|
44
45
|
EnergyAppPermissionTypeEnum["ChildProcess"] = "ChildProcess";
|
|
45
46
|
})(EnergyAppPermissionTypeEnum || (exports.EnergyAppPermissionTypeEnum = EnergyAppPermissionTypeEnum = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'ChildProcess';
|
|
1
|
+
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'Wifi' | 'ChildProcess';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -38,5 +38,6 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
38
38
|
EebusControl = "EebusControl",
|
|
39
39
|
Mqtt = "Mqtt",
|
|
40
40
|
Bluetooth = "Bluetooth",
|
|
41
|
+
Wifi = "Wifi",
|
|
41
42
|
ChildProcess = "ChildProcess"
|
|
42
43
|
}
|
package/dist/cjs/energy-app.cjs
CHANGED
|
@@ -237,6 +237,15 @@ class EnergyApp {
|
|
|
237
237
|
useLearningPhase() {
|
|
238
238
|
return this.energyAppSdk.useLearningPhase();
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Gets the WiFi API for scanning and listing known WiFi networks (SSIDs).
|
|
242
|
+
* Provides methods to discover saved/known SSIDs that are currently
|
|
243
|
+
* in range of the device's WiFi adapter.
|
|
244
|
+
* @returns The WiFi API instance
|
|
245
|
+
*/
|
|
246
|
+
useWifi() {
|
|
247
|
+
return this.energyAppSdk.useWifi();
|
|
248
|
+
}
|
|
240
249
|
/**
|
|
241
250
|
* Gets the current SDK version.
|
|
242
251
|
* @returns The semantic version string of the SDK
|
|
@@ -30,6 +30,7 @@ import { EnergyAppMqtt } from "./packages/energy-app-mqtt.cjs";
|
|
|
30
30
|
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.cjs";
|
|
31
31
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
32
32
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
33
|
+
import { EnergyAppWifi } from "./packages/energy-app-wifi.cjs";
|
|
33
34
|
/**
|
|
34
35
|
* Concrete implementation of {@link EnyoEnergyAppSdk} that delegates every call
|
|
35
36
|
* to the runtime-provided `energyAppSdkInstance` global.
|
|
@@ -176,6 +177,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
176
177
|
* @returns The Learning Phase API instance
|
|
177
178
|
*/
|
|
178
179
|
useLearningPhase(): EnergyAppLearningPhase;
|
|
180
|
+
/**
|
|
181
|
+
* Gets the WiFi API for scanning and listing known WiFi networks (SSIDs).
|
|
182
|
+
* Provides methods to discover saved/known SSIDs that are currently
|
|
183
|
+
* in range of the device's WiFi adapter.
|
|
184
|
+
* @returns The WiFi API instance
|
|
185
|
+
*/
|
|
186
|
+
useWifi(): EnergyAppWifi;
|
|
179
187
|
/**
|
|
180
188
|
* Gets the current SDK version.
|
|
181
189
|
* @returns The semantic version string of the SDK
|
|
@@ -29,6 +29,7 @@ import { EnergyAppMqtt } from "./packages/energy-app-mqtt.cjs";
|
|
|
29
29
|
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.cjs";
|
|
30
30
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
31
31
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
32
|
+
import { EnergyAppWifi } from "./packages/energy-app-wifi.cjs";
|
|
32
33
|
export declare enum EnergyAppStateEnum {
|
|
33
34
|
Launching = "launching",
|
|
34
35
|
Running = "running",
|
|
@@ -115,4 +116,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
115
116
|
useDiagnostics: () => EnergyAppDiagnostics;
|
|
116
117
|
/** Get the Learning Phase API for registering and tracking learning phases */
|
|
117
118
|
useLearningPhase: () => EnergyAppLearningPhase;
|
|
119
|
+
/** Get the WiFi API for scanning and listing known SSIDs */
|
|
120
|
+
useWifi: () => EnergyAppWifi;
|
|
118
121
|
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -57,6 +57,8 @@ __exportStar(require("./types/enyo-diagnostics.cjs"), exports);
|
|
|
57
57
|
__exportStar(require("./packages/energy-app-diagnostics.cjs"), exports);
|
|
58
58
|
__exportStar(require("./types/enyo-learning-phase.cjs"), exports);
|
|
59
59
|
__exportStar(require("./packages/energy-app-learning-phase.cjs"), exports);
|
|
60
|
+
__exportStar(require("./types/enyo-wifi.cjs"), exports);
|
|
61
|
+
__exportStar(require("./packages/energy-app-wifi.cjs"), exports);
|
|
60
62
|
__exportStar(require("./types/enyo-air-conditioning-appliance.cjs"), exports);
|
|
61
63
|
__exportStar(require("./types/enyo-onboarding.cjs"), exports);
|
|
62
64
|
__exportStar(require("./packages/energy-app-onboarding.cjs"), exports);
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -41,6 +41,8 @@ export * from './types/enyo-diagnostics.cjs';
|
|
|
41
41
|
export * from './packages/energy-app-diagnostics.cjs';
|
|
42
42
|
export * from './types/enyo-learning-phase.cjs';
|
|
43
43
|
export * from './packages/energy-app-learning-phase.cjs';
|
|
44
|
+
export * from './types/enyo-wifi.cjs';
|
|
45
|
+
export * from './packages/energy-app-wifi.cjs';
|
|
44
46
|
export * from './types/enyo-air-conditioning-appliance.cjs';
|
|
45
47
|
export * from './types/enyo-onboarding.cjs';
|
|
46
48
|
export * from './packages/energy-app-onboarding.cjs';
|
|
@@ -147,6 +147,48 @@ export interface EnergyAppOnboarding {
|
|
|
147
147
|
* ```
|
|
148
148
|
*/
|
|
149
149
|
moveToStep(guideName: string, stepName: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Adds a new step to an existing onboarding guide at runtime.
|
|
152
|
+
*
|
|
153
|
+
* Intended for flows where the next step cannot be known up front — for
|
|
154
|
+
* example when a step submission produces data that determines which (or
|
|
155
|
+
* how many) follow-up steps are needed. Combine with {@link moveToStep}
|
|
156
|
+
* to route the user into the freshly added step.
|
|
157
|
+
*
|
|
158
|
+
* The new step's `name` must be unique within the guide; calls that would
|
|
159
|
+
* introduce a duplicate `name` are rejected. When `options.after` is
|
|
160
|
+
* provided, the step is inserted immediately after the step with that
|
|
161
|
+
* name; if no step matches, or `options` is omitted, the step is appended
|
|
162
|
+
* at the end of the guide.
|
|
163
|
+
*
|
|
164
|
+
* @param guideName - The unique name of the guide to extend
|
|
165
|
+
* @param step - The new step to add to the guide
|
|
166
|
+
* @param options - Optional positioning; `after` inserts the new step
|
|
167
|
+
* immediately after the step with the given `name`. Omit to append.
|
|
168
|
+
* @returns Promise that resolves once the step has been added
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* onboarding.listenForStepSubmission(async (submission) => {
|
|
173
|
+
* if (submission.stepName === 'discover-devices') {
|
|
174
|
+
* const devices = await scanForDevices();
|
|
175
|
+
* for (const device of devices) {
|
|
176
|
+
* await onboarding.addStep(submission.guideName, {
|
|
177
|
+
* name: `configure-${device.id}`,
|
|
178
|
+
* sections: buildSectionsFor(device),
|
|
179
|
+
* nextButtonLabel: [{ language: 'en', value: 'Continue' }],
|
|
180
|
+
* }, { after: 'discover-devices' });
|
|
181
|
+
* }
|
|
182
|
+
* await onboarding.moveToStep(submission.guideName, `configure-${devices[0].id}`);
|
|
183
|
+
* return { state: 'success' };
|
|
184
|
+
* }
|
|
185
|
+
* return { state: 'success' };
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
addStep(guideName: string, step: EnyoOnboardingStep, options?: {
|
|
190
|
+
after?: string;
|
|
191
|
+
}): Promise<void>;
|
|
150
192
|
/**
|
|
151
193
|
* Marks the onboarding as complete and clears the ConfigurationRequired state.
|
|
152
194
|
* This updates the state for the specified guide.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EnergyAppWifiSsid } from "../types/enyo-wifi.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* WiFi API for enyo packages.
|
|
4
|
+
*
|
|
5
|
+
* Provides discovery of WiFi networks (SSIDs) currently visible to the
|
|
6
|
+
* device's WiFi adapter. All operations require the package to declare the
|
|
7
|
+
* `Wifi` permission.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const wifi = energyApp.useWifi();
|
|
12
|
+
*
|
|
13
|
+
* // Discover all known SSIDs that are currently in range
|
|
14
|
+
* const knownNetworks = await wifi.getKnownSsids();
|
|
15
|
+
* for (const network of knownNetworks) {
|
|
16
|
+
* console.log(`${network.ssid} @ ${network.rssi} dBm`);
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export interface EnergyAppWifi {
|
|
21
|
+
/**
|
|
22
|
+
* Run a WiFi scan and return all known SSIDs that were discovered.
|
|
23
|
+
*
|
|
24
|
+
* "Known" means the network is currently saved on the device — i.e. the
|
|
25
|
+
* device has previously joined it and credentials are stored. Networks
|
|
26
|
+
* that are visible but not saved are not returned by this method.
|
|
27
|
+
*
|
|
28
|
+
* The scan is synchronous from the caller's perspective: the returned
|
|
29
|
+
* promise resolves once the underlying WiFi stack has finished its
|
|
30
|
+
* discovery sweep. Each call performs a fresh scan; results are not
|
|
31
|
+
* cached between calls.
|
|
32
|
+
*
|
|
33
|
+
* @returns Promise resolving with the list of known SSIDs that were
|
|
34
|
+
* discovered during the scan. The list is empty when no known
|
|
35
|
+
* networks are currently in range.
|
|
36
|
+
*/
|
|
37
|
+
getKnownSsids(): Promise<EnergyAppWifiSsid[]>;
|
|
38
|
+
}
|
|
@@ -45,4 +45,6 @@ var EnyoChargerApplianceAvailableFeaturesEnum;
|
|
|
45
45
|
EnyoChargerApplianceAvailableFeaturesEnum["RebootCharger"] = "RebootCharger";
|
|
46
46
|
/** If the charger supports requesting log file uploads */
|
|
47
47
|
EnyoChargerApplianceAvailableFeaturesEnum["RequestLogFiles"] = "RequestLogFiles";
|
|
48
|
+
/** If the Charger supprots a pv surplus mode */
|
|
49
|
+
EnyoChargerApplianceAvailableFeaturesEnum["PvSurplusMode"] = "PvSurplusMode";
|
|
48
50
|
})(EnyoChargerApplianceAvailableFeaturesEnum || (exports.EnyoChargerApplianceAvailableFeaturesEnum = EnyoChargerApplianceAvailableFeaturesEnum = {}));
|
|
@@ -58,7 +58,9 @@ export declare enum EnyoChargerApplianceAvailableFeaturesEnum {
|
|
|
58
58
|
/** If the charger supports being rebooted */
|
|
59
59
|
RebootCharger = "RebootCharger",
|
|
60
60
|
/** If the charger supports requesting log file uploads */
|
|
61
|
-
RequestLogFiles = "RequestLogFiles"
|
|
61
|
+
RequestLogFiles = "RequestLogFiles",
|
|
62
|
+
/** If the Charger supprots a pv surplus mode */
|
|
63
|
+
PvSurplusMode = "PvSurplusMode"
|
|
62
64
|
}
|
|
63
65
|
export interface EnyoChargerApplianceMetadata {
|
|
64
66
|
availableFeatures: EnyoChargerApplianceAvailableFeaturesEnum[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closed set of error codes raised by the WiFi API.
|
|
3
|
+
*
|
|
4
|
+
* - `permission_denied`: package is missing the `Wifi` permission.
|
|
5
|
+
* - `adapter_unavailable`: no WiFi adapter is present or the radio is disabled.
|
|
6
|
+
* - `scan_in_progress`: a concurrent scan request was rejected.
|
|
7
|
+
* - `scan_failed`: the underlying WiFi stack reported a failure during scanning.
|
|
8
|
+
* - `timeout`: the scan exceeded its allotted time.
|
|
9
|
+
*/
|
|
10
|
+
export type EnergyAppWifiErrorCode = 'permission_denied' | 'adapter_unavailable' | 'scan_in_progress' | 'scan_failed' | 'timeout';
|
|
11
|
+
/**
|
|
12
|
+
* Error subtype thrown by the WiFi API.
|
|
13
|
+
* Always carries a structured {@link EnergyAppWifiErrorCode}; callers
|
|
14
|
+
* should branch on `code` rather than parsing the human-readable message.
|
|
15
|
+
*/
|
|
16
|
+
export interface EnergyAppWifiError extends Error {
|
|
17
|
+
/** Machine-readable error code. */
|
|
18
|
+
readonly code: EnergyAppWifiErrorCode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Security mode advertised by a discovered WiFi network.
|
|
22
|
+
*
|
|
23
|
+
* - `open`: no encryption; the network is unprotected.
|
|
24
|
+
* - `wep`: deprecated WEP encryption.
|
|
25
|
+
* - `wpa`: WPA-Personal (TKIP/AES).
|
|
26
|
+
* - `wpa2`: WPA2-Personal.
|
|
27
|
+
* - `wpa3`: WPA3-Personal.
|
|
28
|
+
* - `wpa2_enterprise`: WPA2-Enterprise (802.1X).
|
|
29
|
+
* - `wpa3_enterprise`: WPA3-Enterprise (802.1X).
|
|
30
|
+
* - `unknown`: the security mode could not be determined from the beacon.
|
|
31
|
+
*/
|
|
32
|
+
export type EnergyAppWifiSecurity = 'open' | 'wep' | 'wpa' | 'wpa2' | 'wpa3' | 'wpa2_enterprise' | 'wpa3_enterprise' | 'unknown';
|
|
33
|
+
/**
|
|
34
|
+
* A WiFi network (SSID) discovered during a scan.
|
|
35
|
+
*
|
|
36
|
+
* The shape mirrors what is available in the WiFi beacon/probe response;
|
|
37
|
+
* values that are not present are omitted rather than zeroed.
|
|
38
|
+
*/
|
|
39
|
+
export interface EnergyAppWifiSsid {
|
|
40
|
+
/**
|
|
41
|
+
* The network name (SSID) as broadcast by the access point.
|
|
42
|
+
* Empty string for hidden networks that do not broadcast their SSID.
|
|
43
|
+
*/
|
|
44
|
+
ssid: string;
|
|
45
|
+
/**
|
|
46
|
+
* BSSID of the access point in uppercase, colon-separated form
|
|
47
|
+
* (e.g. "AA:BB:CC:DD:EE:FF"). When multiple APs broadcast the same SSID
|
|
48
|
+
* (roaming), the strongest one is reported.
|
|
49
|
+
*/
|
|
50
|
+
bssid?: string;
|
|
51
|
+
/** Last received signal strength indicator in dBm. */
|
|
52
|
+
rssi?: number;
|
|
53
|
+
/** Operating channel number on which the network was observed. */
|
|
54
|
+
channel?: number;
|
|
55
|
+
/** Operating frequency in MHz on which the network was observed. */
|
|
56
|
+
frequencyMhz?: number;
|
|
57
|
+
/** Security mode advertised by the access point. */
|
|
58
|
+
security?: EnergyAppWifiSecurity;
|
|
59
|
+
/**
|
|
60
|
+
* `true` when the network is currently saved/known on the device, meaning
|
|
61
|
+
* credentials are stored and the device can auto-connect.
|
|
62
|
+
*/
|
|
63
|
+
known?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Options controlling a single WiFi discovery run.
|
|
67
|
+
*/
|
|
68
|
+
export interface EnergyAppWifiScanOptions {
|
|
69
|
+
/**
|
|
70
|
+
* Wall-clock duration of the scan in milliseconds. Defaults to 5000;
|
|
71
|
+
* the host caps this value at 30000 to protect the WiFi adapter.
|
|
72
|
+
*/
|
|
73
|
+
durationMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, restrict the result to networks that are currently saved
|
|
76
|
+
* on the device (i.e. SSIDs the device has previously joined).
|
|
77
|
+
* Defaults to `false`.
|
|
78
|
+
*/
|
|
79
|
+
onlyKnown?: boolean;
|
|
80
|
+
}
|
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.118';
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'ChildProcess';
|
|
1
|
+
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates' | 'Timeseries' | 'EnergyManagerInfo' | 'ElectricityTariff' | 'WeatherForecastRegister' | 'WeatherForecastUse' | 'PvForecastRegister' | 'PvForecastUse' | 'PvSystemRegister' | 'PvSystemUse' | 'InverterControlCommands' | 'BatteryControlCommands' | 'ChargerControlCommands' | 'ModbusRtu' | 'EnergyPrices' | 'EnergyManager' | 'EebusDeviceManagement' | 'EebusDataAccess' | 'EebusControl' | 'Mqtt' | 'Bluetooth' | 'Wifi' | 'ChildProcess';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -38,5 +38,6 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
38
38
|
EebusControl = "EebusControl",
|
|
39
39
|
Mqtt = "Mqtt",
|
|
40
40
|
Bluetooth = "Bluetooth",
|
|
41
|
+
Wifi = "Wifi",
|
|
41
42
|
ChildProcess = "ChildProcess"
|
|
42
43
|
}
|
|
@@ -38,5 +38,6 @@ export var EnergyAppPermissionTypeEnum;
|
|
|
38
38
|
EnergyAppPermissionTypeEnum["EebusControl"] = "EebusControl";
|
|
39
39
|
EnergyAppPermissionTypeEnum["Mqtt"] = "Mqtt";
|
|
40
40
|
EnergyAppPermissionTypeEnum["Bluetooth"] = "Bluetooth";
|
|
41
|
+
EnergyAppPermissionTypeEnum["Wifi"] = "Wifi";
|
|
41
42
|
EnergyAppPermissionTypeEnum["ChildProcess"] = "ChildProcess";
|
|
42
43
|
})(EnergyAppPermissionTypeEnum || (EnergyAppPermissionTypeEnum = {}));
|
package/dist/energy-app.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { EnergyAppMqtt } from "./packages/energy-app-mqtt.js";
|
|
|
30
30
|
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.js";
|
|
31
31
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.js";
|
|
32
32
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.js";
|
|
33
|
+
import { EnergyAppWifi } from "./packages/energy-app-wifi.js";
|
|
33
34
|
/**
|
|
34
35
|
* Concrete implementation of {@link EnyoEnergyAppSdk} that delegates every call
|
|
35
36
|
* to the runtime-provided `energyAppSdkInstance` global.
|
|
@@ -176,6 +177,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
176
177
|
* @returns The Learning Phase API instance
|
|
177
178
|
*/
|
|
178
179
|
useLearningPhase(): EnergyAppLearningPhase;
|
|
180
|
+
/**
|
|
181
|
+
* Gets the WiFi API for scanning and listing known WiFi networks (SSIDs).
|
|
182
|
+
* Provides methods to discover saved/known SSIDs that are currently
|
|
183
|
+
* in range of the device's WiFi adapter.
|
|
184
|
+
* @returns The WiFi API instance
|
|
185
|
+
*/
|
|
186
|
+
useWifi(): EnergyAppWifi;
|
|
179
187
|
/**
|
|
180
188
|
* Gets the current SDK version.
|
|
181
189
|
* @returns The semantic version string of the SDK
|
package/dist/energy-app.js
CHANGED
|
@@ -234,6 +234,15 @@ export class EnergyApp {
|
|
|
234
234
|
useLearningPhase() {
|
|
235
235
|
return this.energyAppSdk.useLearningPhase();
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Gets the WiFi API for scanning and listing known WiFi networks (SSIDs).
|
|
239
|
+
* Provides methods to discover saved/known SSIDs that are currently
|
|
240
|
+
* in range of the device's WiFi adapter.
|
|
241
|
+
* @returns The WiFi API instance
|
|
242
|
+
*/
|
|
243
|
+
useWifi() {
|
|
244
|
+
return this.energyAppSdk.useWifi();
|
|
245
|
+
}
|
|
237
246
|
/**
|
|
238
247
|
* Gets the current SDK version.
|
|
239
248
|
* @returns The semantic version string of the SDK
|
|
@@ -29,6 +29,7 @@ import { EnergyAppMqtt } from "./packages/energy-app-mqtt.js";
|
|
|
29
29
|
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.js";
|
|
30
30
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.js";
|
|
31
31
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.js";
|
|
32
|
+
import { EnergyAppWifi } from "./packages/energy-app-wifi.js";
|
|
32
33
|
export declare enum EnergyAppStateEnum {
|
|
33
34
|
Launching = "launching",
|
|
34
35
|
Running = "running",
|
|
@@ -115,4 +116,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
115
116
|
useDiagnostics: () => EnergyAppDiagnostics;
|
|
116
117
|
/** Get the Learning Phase API for registering and tracking learning phases */
|
|
117
118
|
useLearningPhase: () => EnergyAppLearningPhase;
|
|
119
|
+
/** Get the WiFi API for scanning and listing known SSIDs */
|
|
120
|
+
useWifi: () => EnergyAppWifi;
|
|
118
121
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export * from './types/enyo-diagnostics.js';
|
|
|
41
41
|
export * from './packages/energy-app-diagnostics.js';
|
|
42
42
|
export * from './types/enyo-learning-phase.js';
|
|
43
43
|
export * from './packages/energy-app-learning-phase.js';
|
|
44
|
+
export * from './types/enyo-wifi.js';
|
|
45
|
+
export * from './packages/energy-app-wifi.js';
|
|
44
46
|
export * from './types/enyo-air-conditioning-appliance.js';
|
|
45
47
|
export * from './types/enyo-onboarding.js';
|
|
46
48
|
export * from './packages/energy-app-onboarding.js';
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,8 @@ export * from './types/enyo-diagnostics.js';
|
|
|
41
41
|
export * from './packages/energy-app-diagnostics.js';
|
|
42
42
|
export * from './types/enyo-learning-phase.js';
|
|
43
43
|
export * from './packages/energy-app-learning-phase.js';
|
|
44
|
+
export * from './types/enyo-wifi.js';
|
|
45
|
+
export * from './packages/energy-app-wifi.js';
|
|
44
46
|
export * from './types/enyo-air-conditioning-appliance.js';
|
|
45
47
|
export * from './types/enyo-onboarding.js';
|
|
46
48
|
export * from './packages/energy-app-onboarding.js';
|
|
@@ -147,6 +147,48 @@ export interface EnergyAppOnboarding {
|
|
|
147
147
|
* ```
|
|
148
148
|
*/
|
|
149
149
|
moveToStep(guideName: string, stepName: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Adds a new step to an existing onboarding guide at runtime.
|
|
152
|
+
*
|
|
153
|
+
* Intended for flows where the next step cannot be known up front — for
|
|
154
|
+
* example when a step submission produces data that determines which (or
|
|
155
|
+
* how many) follow-up steps are needed. Combine with {@link moveToStep}
|
|
156
|
+
* to route the user into the freshly added step.
|
|
157
|
+
*
|
|
158
|
+
* The new step's `name` must be unique within the guide; calls that would
|
|
159
|
+
* introduce a duplicate `name` are rejected. When `options.after` is
|
|
160
|
+
* provided, the step is inserted immediately after the step with that
|
|
161
|
+
* name; if no step matches, or `options` is omitted, the step is appended
|
|
162
|
+
* at the end of the guide.
|
|
163
|
+
*
|
|
164
|
+
* @param guideName - The unique name of the guide to extend
|
|
165
|
+
* @param step - The new step to add to the guide
|
|
166
|
+
* @param options - Optional positioning; `after` inserts the new step
|
|
167
|
+
* immediately after the step with the given `name`. Omit to append.
|
|
168
|
+
* @returns Promise that resolves once the step has been added
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* onboarding.listenForStepSubmission(async (submission) => {
|
|
173
|
+
* if (submission.stepName === 'discover-devices') {
|
|
174
|
+
* const devices = await scanForDevices();
|
|
175
|
+
* for (const device of devices) {
|
|
176
|
+
* await onboarding.addStep(submission.guideName, {
|
|
177
|
+
* name: `configure-${device.id}`,
|
|
178
|
+
* sections: buildSectionsFor(device),
|
|
179
|
+
* nextButtonLabel: [{ language: 'en', value: 'Continue' }],
|
|
180
|
+
* }, { after: 'discover-devices' });
|
|
181
|
+
* }
|
|
182
|
+
* await onboarding.moveToStep(submission.guideName, `configure-${devices[0].id}`);
|
|
183
|
+
* return { state: 'success' };
|
|
184
|
+
* }
|
|
185
|
+
* return { state: 'success' };
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
addStep(guideName: string, step: EnyoOnboardingStep, options?: {
|
|
190
|
+
after?: string;
|
|
191
|
+
}): Promise<void>;
|
|
150
192
|
/**
|
|
151
193
|
* Marks the onboarding as complete and clears the ConfigurationRequired state.
|
|
152
194
|
* This updates the state for the specified guide.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EnergyAppWifiSsid } from "../types/enyo-wifi.js";
|
|
2
|
+
/**
|
|
3
|
+
* WiFi API for enyo packages.
|
|
4
|
+
*
|
|
5
|
+
* Provides discovery of WiFi networks (SSIDs) currently visible to the
|
|
6
|
+
* device's WiFi adapter. All operations require the package to declare the
|
|
7
|
+
* `Wifi` permission.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const wifi = energyApp.useWifi();
|
|
12
|
+
*
|
|
13
|
+
* // Discover all known SSIDs that are currently in range
|
|
14
|
+
* const knownNetworks = await wifi.getKnownSsids();
|
|
15
|
+
* for (const network of knownNetworks) {
|
|
16
|
+
* console.log(`${network.ssid} @ ${network.rssi} dBm`);
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export interface EnergyAppWifi {
|
|
21
|
+
/**
|
|
22
|
+
* Run a WiFi scan and return all known SSIDs that were discovered.
|
|
23
|
+
*
|
|
24
|
+
* "Known" means the network is currently saved on the device — i.e. the
|
|
25
|
+
* device has previously joined it and credentials are stored. Networks
|
|
26
|
+
* that are visible but not saved are not returned by this method.
|
|
27
|
+
*
|
|
28
|
+
* The scan is synchronous from the caller's perspective: the returned
|
|
29
|
+
* promise resolves once the underlying WiFi stack has finished its
|
|
30
|
+
* discovery sweep. Each call performs a fresh scan; results are not
|
|
31
|
+
* cached between calls.
|
|
32
|
+
*
|
|
33
|
+
* @returns Promise resolving with the list of known SSIDs that were
|
|
34
|
+
* discovered during the scan. The list is empty when no known
|
|
35
|
+
* networks are currently in range.
|
|
36
|
+
*/
|
|
37
|
+
getKnownSsids(): Promise<EnergyAppWifiSsid[]>;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -58,7 +58,9 @@ export declare enum EnyoChargerApplianceAvailableFeaturesEnum {
|
|
|
58
58
|
/** If the charger supports being rebooted */
|
|
59
59
|
RebootCharger = "RebootCharger",
|
|
60
60
|
/** If the charger supports requesting log file uploads */
|
|
61
|
-
RequestLogFiles = "RequestLogFiles"
|
|
61
|
+
RequestLogFiles = "RequestLogFiles",
|
|
62
|
+
/** If the Charger supprots a pv surplus mode */
|
|
63
|
+
PvSurplusMode = "PvSurplusMode"
|
|
62
64
|
}
|
|
63
65
|
export interface EnyoChargerApplianceMetadata {
|
|
64
66
|
availableFeatures: EnyoChargerApplianceAvailableFeaturesEnum[];
|
|
@@ -42,4 +42,6 @@ export var EnyoChargerApplianceAvailableFeaturesEnum;
|
|
|
42
42
|
EnyoChargerApplianceAvailableFeaturesEnum["RebootCharger"] = "RebootCharger";
|
|
43
43
|
/** If the charger supports requesting log file uploads */
|
|
44
44
|
EnyoChargerApplianceAvailableFeaturesEnum["RequestLogFiles"] = "RequestLogFiles";
|
|
45
|
+
/** If the Charger supprots a pv surplus mode */
|
|
46
|
+
EnyoChargerApplianceAvailableFeaturesEnum["PvSurplusMode"] = "PvSurplusMode";
|
|
45
47
|
})(EnyoChargerApplianceAvailableFeaturesEnum || (EnyoChargerApplianceAvailableFeaturesEnum = {}));
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closed set of error codes raised by the WiFi API.
|
|
3
|
+
*
|
|
4
|
+
* - `permission_denied`: package is missing the `Wifi` permission.
|
|
5
|
+
* - `adapter_unavailable`: no WiFi adapter is present or the radio is disabled.
|
|
6
|
+
* - `scan_in_progress`: a concurrent scan request was rejected.
|
|
7
|
+
* - `scan_failed`: the underlying WiFi stack reported a failure during scanning.
|
|
8
|
+
* - `timeout`: the scan exceeded its allotted time.
|
|
9
|
+
*/
|
|
10
|
+
export type EnergyAppWifiErrorCode = 'permission_denied' | 'adapter_unavailable' | 'scan_in_progress' | 'scan_failed' | 'timeout';
|
|
11
|
+
/**
|
|
12
|
+
* Error subtype thrown by the WiFi API.
|
|
13
|
+
* Always carries a structured {@link EnergyAppWifiErrorCode}; callers
|
|
14
|
+
* should branch on `code` rather than parsing the human-readable message.
|
|
15
|
+
*/
|
|
16
|
+
export interface EnergyAppWifiError extends Error {
|
|
17
|
+
/** Machine-readable error code. */
|
|
18
|
+
readonly code: EnergyAppWifiErrorCode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Security mode advertised by a discovered WiFi network.
|
|
22
|
+
*
|
|
23
|
+
* - `open`: no encryption; the network is unprotected.
|
|
24
|
+
* - `wep`: deprecated WEP encryption.
|
|
25
|
+
* - `wpa`: WPA-Personal (TKIP/AES).
|
|
26
|
+
* - `wpa2`: WPA2-Personal.
|
|
27
|
+
* - `wpa3`: WPA3-Personal.
|
|
28
|
+
* - `wpa2_enterprise`: WPA2-Enterprise (802.1X).
|
|
29
|
+
* - `wpa3_enterprise`: WPA3-Enterprise (802.1X).
|
|
30
|
+
* - `unknown`: the security mode could not be determined from the beacon.
|
|
31
|
+
*/
|
|
32
|
+
export type EnergyAppWifiSecurity = 'open' | 'wep' | 'wpa' | 'wpa2' | 'wpa3' | 'wpa2_enterprise' | 'wpa3_enterprise' | 'unknown';
|
|
33
|
+
/**
|
|
34
|
+
* A WiFi network (SSID) discovered during a scan.
|
|
35
|
+
*
|
|
36
|
+
* The shape mirrors what is available in the WiFi beacon/probe response;
|
|
37
|
+
* values that are not present are omitted rather than zeroed.
|
|
38
|
+
*/
|
|
39
|
+
export interface EnergyAppWifiSsid {
|
|
40
|
+
/**
|
|
41
|
+
* The network name (SSID) as broadcast by the access point.
|
|
42
|
+
* Empty string for hidden networks that do not broadcast their SSID.
|
|
43
|
+
*/
|
|
44
|
+
ssid: string;
|
|
45
|
+
/**
|
|
46
|
+
* BSSID of the access point in uppercase, colon-separated form
|
|
47
|
+
* (e.g. "AA:BB:CC:DD:EE:FF"). When multiple APs broadcast the same SSID
|
|
48
|
+
* (roaming), the strongest one is reported.
|
|
49
|
+
*/
|
|
50
|
+
bssid?: string;
|
|
51
|
+
/** Last received signal strength indicator in dBm. */
|
|
52
|
+
rssi?: number;
|
|
53
|
+
/** Operating channel number on which the network was observed. */
|
|
54
|
+
channel?: number;
|
|
55
|
+
/** Operating frequency in MHz on which the network was observed. */
|
|
56
|
+
frequencyMhz?: number;
|
|
57
|
+
/** Security mode advertised by the access point. */
|
|
58
|
+
security?: EnergyAppWifiSecurity;
|
|
59
|
+
/**
|
|
60
|
+
* `true` when the network is currently saved/known on the device, meaning
|
|
61
|
+
* credentials are stored and the device can auto-connect.
|
|
62
|
+
*/
|
|
63
|
+
known?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Options controlling a single WiFi discovery run.
|
|
67
|
+
*/
|
|
68
|
+
export interface EnergyAppWifiScanOptions {
|
|
69
|
+
/**
|
|
70
|
+
* Wall-clock duration of the scan in milliseconds. Defaults to 5000;
|
|
71
|
+
* the host caps this value at 30000 to protect the WiFi adapter.
|
|
72
|
+
*/
|
|
73
|
+
durationMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, restrict the result to networks that are currently saved
|
|
76
|
+
* on the device (i.e. SSIDs the device has previously joined).
|
|
77
|
+
* Defaults to `false`.
|
|
78
|
+
*/
|
|
79
|
+
onlyKnown?: boolean;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED