@enyo-energy/energy-app-sdk 0.0.115 → 0.0.116
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-package-definition.d.cts +45 -0
- 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 +8 -0
- package/dist/cjs/energy-app.d.cts +7 -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-bluetooth.cjs +2 -0
- package/dist/cjs/packages/energy-app-bluetooth.d.cts +155 -0
- package/dist/cjs/packages/energy-app-interval.d.cts +1 -1
- package/dist/cjs/packages/energy-app-onboarding.d.cts +28 -0
- package/dist/cjs/types/enyo-bluetooth.cjs +2 -0
- package/dist/cjs/types/enyo-bluetooth.d.cts +96 -0
- package/dist/cjs/types/enyo-heatpump-appliance.cjs +16 -1
- package/dist/cjs/types/enyo-heatpump-appliance.d.cts +22 -1
- package/dist/cjs/types/enyo-onboarding.cjs +7 -0
- package/dist/cjs/types/enyo-onboarding.d.cts +91 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/energy-app-package-definition.d.ts +45 -0
- 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 +7 -0
- package/dist/energy-app.js +8 -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-bluetooth.d.ts +155 -0
- package/dist/packages/energy-app-bluetooth.js +1 -0
- package/dist/packages/energy-app-interval.d.ts +1 -1
- package/dist/packages/energy-app-onboarding.d.ts +28 -0
- package/dist/types/enyo-bluetooth.d.ts +96 -0
- package/dist/types/enyo-bluetooth.js +1 -0
- package/dist/types/enyo-heatpump-appliance.d.ts +22 -1
- package/dist/types/enyo-heatpump-appliance.js +15 -0
- package/dist/types/enyo-onboarding.d.ts +91 -1
- package/dist/types/enyo-onboarding.js +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -137,6 +137,43 @@ export interface EnergyAppPackagePermission {
|
|
|
137
137
|
/** Internal documentation describing what this permission is used for */
|
|
138
138
|
internalComment: string;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* A specific device model supported by an Energy App package.
|
|
142
|
+
* Used inside {@link EnergyAppPackageCompatibilityVendor.models} to enumerate
|
|
143
|
+
* the concrete models the package has been verified to work with.
|
|
144
|
+
*/
|
|
145
|
+
export interface EnergyAppPackageCompatibilityModel {
|
|
146
|
+
/** Human-readable model name as marketed by the vendor (e.g. "SE10K-RW0TEBNN4") */
|
|
147
|
+
modelName: string;
|
|
148
|
+
/**
|
|
149
|
+
* Optional internal display name shown in the enyo Store / Admin UI when
|
|
150
|
+
* different from the official `modelName` (e.g. a friendlier label).
|
|
151
|
+
*/
|
|
152
|
+
displayName?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Optional minimum firmware version the package supports for this model.
|
|
155
|
+
* Free-form string compared lexicographically by hosts that need it.
|
|
156
|
+
*/
|
|
157
|
+
minimumFirmwareVersion?: string;
|
|
158
|
+
/** Optional internal note explaining model-specific caveats or limitations */
|
|
159
|
+
internalComment?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A vendor and the list of its models supported by an Energy App package.
|
|
163
|
+
* Used inside {@link EnergyAppPackageDefinition.compatibility} to declare
|
|
164
|
+
* which manufacturers and product models the package targets.
|
|
165
|
+
*/
|
|
166
|
+
export interface EnergyAppPackageCompatibilityVendor {
|
|
167
|
+
/** Human-readable vendor name (e.g. "SolarEdge", "Fronius") */
|
|
168
|
+
vendorName: string;
|
|
169
|
+
/**
|
|
170
|
+
* Optional vendor logo path, mirroring the package-level `logo` field.
|
|
171
|
+
* Useful when the host wants to render a vendor list in the store.
|
|
172
|
+
*/
|
|
173
|
+
logo?: string;
|
|
174
|
+
/** Models from this vendor that the package supports */
|
|
175
|
+
models: EnergyAppPackageCompatibilityModel[];
|
|
176
|
+
}
|
|
140
177
|
/**
|
|
141
178
|
* Complete definition for a enyo Energy App package.
|
|
142
179
|
* This interface defines all the metadata, permissions, and configuration
|
|
@@ -163,6 +200,14 @@ export interface EnergyAppPackageDefinition {
|
|
|
163
200
|
sdkVersion: string;
|
|
164
201
|
/** If the energy app should be visible in the enyo store. Default is true*/
|
|
165
202
|
showInStore?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Optional declaration of vendors and models this package is compatible with.
|
|
205
|
+
* Each entry pairs a vendor with the concrete models the package supports,
|
|
206
|
+
* allowing the enyo Store and onboarding flows to surface accurate
|
|
207
|
+
* compatibility information to users. Omit when the package targets a
|
|
208
|
+
* single vendor implicitly or has no fixed compatibility surface.
|
|
209
|
+
*/
|
|
210
|
+
compatibility?: EnergyAppPackageCompatibilityVendor[];
|
|
166
211
|
}
|
|
167
212
|
/**
|
|
168
213
|
* Defines an Energy App package with automatic SDK version injection.
|
|
@@ -40,5 +40,6 @@ var EnergyAppPermissionTypeEnum;
|
|
|
40
40
|
EnergyAppPermissionTypeEnum["EebusDataAccess"] = "EebusDataAccess";
|
|
41
41
|
EnergyAppPermissionTypeEnum["EebusControl"] = "EebusControl";
|
|
42
42
|
EnergyAppPermissionTypeEnum["Mqtt"] = "Mqtt";
|
|
43
|
+
EnergyAppPermissionTypeEnum["Bluetooth"] = "Bluetooth";
|
|
43
44
|
EnergyAppPermissionTypeEnum["ChildProcess"] = "ChildProcess";
|
|
44
45
|
})(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' | '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' | 'ChildProcess';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -37,5 +37,6 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
37
37
|
EebusDataAccess = "EebusDataAccess",
|
|
38
38
|
EebusControl = "EebusControl",
|
|
39
39
|
Mqtt = "Mqtt",
|
|
40
|
+
Bluetooth = "Bluetooth",
|
|
40
41
|
ChildProcess = "ChildProcess"
|
|
41
42
|
}
|
package/dist/cjs/energy-app.cjs
CHANGED
|
@@ -211,6 +211,14 @@ class EnergyApp {
|
|
|
211
211
|
useMqtt() {
|
|
212
212
|
return this.energyAppSdk.useMqtt();
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Gets the Bluetooth Low Energy API for scanning peripherals and
|
|
216
|
+
* performing GATT operations against them.
|
|
217
|
+
* @returns The Bluetooth API instance
|
|
218
|
+
*/
|
|
219
|
+
useBluetooth() {
|
|
220
|
+
return this.energyAppSdk.useBluetooth();
|
|
221
|
+
}
|
|
214
222
|
/**
|
|
215
223
|
* Gets the Diagnostics API for submitting energy manager diagnostics data.
|
|
216
224
|
* Allows energy managers to report current state, forecast, and control plan
|
|
@@ -27,6 +27,7 @@ import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-gener
|
|
|
27
27
|
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
|
+
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.cjs";
|
|
30
31
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
31
32
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
32
33
|
/**
|
|
@@ -155,6 +156,12 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
155
156
|
* @returns The MQTT API instance
|
|
156
157
|
*/
|
|
157
158
|
useMqtt(): EnergyAppMqtt;
|
|
159
|
+
/**
|
|
160
|
+
* Gets the Bluetooth Low Energy API for scanning peripherals and
|
|
161
|
+
* performing GATT operations against them.
|
|
162
|
+
* @returns The Bluetooth API instance
|
|
163
|
+
*/
|
|
164
|
+
useBluetooth(): EnergyAppBluetooth;
|
|
158
165
|
/**
|
|
159
166
|
* Gets the Diagnostics API for submitting energy manager diagnostics data.
|
|
160
167
|
* Allows energy managers to report current state, forecast, and control plan
|
|
@@ -26,6 +26,7 @@ import { EnergyAppSequenceGenerator } from "./packages/energy-app-sequence-gener
|
|
|
26
26
|
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
|
+
import { EnergyAppBluetooth } from "./packages/energy-app-bluetooth.cjs";
|
|
29
30
|
import { EnergyAppDiagnostics } from "./packages/energy-app-diagnostics.cjs";
|
|
30
31
|
import { EnergyAppLearningPhase } from "./packages/energy-app-learning-phase.cjs";
|
|
31
32
|
export declare enum EnergyAppStateEnum {
|
|
@@ -108,6 +109,8 @@ export interface EnyoEnergyAppSdk {
|
|
|
108
109
|
useEebus: () => EnergyAppEebus;
|
|
109
110
|
/** Get the MQTT communication API for connecting to internal or external MQTT brokers */
|
|
110
111
|
useMqtt: () => EnergyAppMqtt;
|
|
112
|
+
/** Get the Bluetooth Low Energy API for scanning and GATT communication with peripherals */
|
|
113
|
+
useBluetooth: () => EnergyAppBluetooth;
|
|
111
114
|
/** Get the Diagnostics API for submitting energy manager diagnostics data */
|
|
112
115
|
useDiagnostics: () => EnergyAppDiagnostics;
|
|
113
116
|
/** Get the Learning Phase API for registering and tracking learning phases */
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -51,6 +51,8 @@ __exportStar(require("./types/enyo-eebus.cjs"), exports);
|
|
|
51
51
|
__exportStar(require("./packages/energy-app-eebus.cjs"), exports);
|
|
52
52
|
__exportStar(require("./types/enyo-mqtt.cjs"), exports);
|
|
53
53
|
__exportStar(require("./packages/energy-app-mqtt.cjs"), exports);
|
|
54
|
+
__exportStar(require("./types/enyo-bluetooth.cjs"), exports);
|
|
55
|
+
__exportStar(require("./packages/energy-app-bluetooth.cjs"), exports);
|
|
54
56
|
__exportStar(require("./types/enyo-diagnostics.cjs"), exports);
|
|
55
57
|
__exportStar(require("./packages/energy-app-diagnostics.cjs"), exports);
|
|
56
58
|
__exportStar(require("./types/enyo-learning-phase.cjs"), exports);
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -35,6 +35,8 @@ export * from './types/enyo-eebus.cjs';
|
|
|
35
35
|
export * from './packages/energy-app-eebus.cjs';
|
|
36
36
|
export * from './types/enyo-mqtt.cjs';
|
|
37
37
|
export * from './packages/energy-app-mqtt.cjs';
|
|
38
|
+
export * from './types/enyo-bluetooth.cjs';
|
|
39
|
+
export * from './packages/energy-app-bluetooth.cjs';
|
|
38
40
|
export * from './types/enyo-diagnostics.cjs';
|
|
39
41
|
export * from './packages/energy-app-diagnostics.cjs';
|
|
40
42
|
export * from './types/enyo-learning-phase.cjs';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { EnergyAppBluetoothConnectOptions, EnergyAppBluetoothDevice, EnergyAppBluetoothScanOptions } from "../types/enyo-bluetooth.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Three consumption styles for the same notify channel — pick whichever fits
|
|
4
|
+
* the protocol you are implementing.
|
|
5
|
+
*
|
|
6
|
+
* - `onValue` is push-based and ideal for fire-and-forget event handling.
|
|
7
|
+
* - `next` is pull-based and convenient for request/response style protocols.
|
|
8
|
+
* - `values` exposes the same stream as an async iterator usable in
|
|
9
|
+
* `for await` loops; the iterator ends automatically when the underlying
|
|
10
|
+
* session disconnects.
|
|
11
|
+
*
|
|
12
|
+
* The three styles share the same underlying subscription, so calling
|
|
13
|
+
* {@link stop} cancels the notification subscription regardless of which
|
|
14
|
+
* style was used to consume values.
|
|
15
|
+
*/
|
|
16
|
+
export interface EnergyAppBluetoothNotifications {
|
|
17
|
+
/**
|
|
18
|
+
* Push-style consumption: the listener is invoked for every notification.
|
|
19
|
+
*
|
|
20
|
+
* @param listener - Callback invoked with each notification payload.
|
|
21
|
+
* @returns Promise resolving to an unsubscribe function. Calling it stops
|
|
22
|
+
* delivering notifications to this listener but does not
|
|
23
|
+
* terminate the underlying subscription — use {@link stop} for
|
|
24
|
+
* that.
|
|
25
|
+
*/
|
|
26
|
+
onValue(listener: (value: Uint8Array) => void): Promise<() => Promise<void>>;
|
|
27
|
+
/**
|
|
28
|
+
* Pull-style consumption: resolves with the next single notification.
|
|
29
|
+
*
|
|
30
|
+
* @param timeoutMs - Optional timeout. When provided and no notification
|
|
31
|
+
* arrives in time, the promise rejects with an
|
|
32
|
+
* `EnergyAppBluetoothError` of code `timeout`.
|
|
33
|
+
* @returns Promise resolving with the next received notification payload.
|
|
34
|
+
*/
|
|
35
|
+
next(timeoutMs?: number): Promise<Uint8Array>;
|
|
36
|
+
/**
|
|
37
|
+
* Stream-style consumption usable with `for await` loops.
|
|
38
|
+
* The iterator ends automatically when the session disconnects.
|
|
39
|
+
*/
|
|
40
|
+
values(): AsyncIterableIterator<Uint8Array>;
|
|
41
|
+
/**
|
|
42
|
+
* Stop notifications regardless of consumption style.
|
|
43
|
+
* Subsequent calls to {@link next} will reject and {@link values} will
|
|
44
|
+
* complete. Idempotent.
|
|
45
|
+
*/
|
|
46
|
+
stop(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One open connection to a Bluetooth peripheral.
|
|
50
|
+
*
|
|
51
|
+
* All GATT operations are scoped to this object — there is no need to repeat
|
|
52
|
+
* the device address on every call. A session must NOT be reused after
|
|
53
|
+
* {@link disconnect} has been awaited or after the callback passed to
|
|
54
|
+
* {@link EnergyAppBluetooth.withDevice} has returned.
|
|
55
|
+
*/
|
|
56
|
+
export interface EnergyAppBluetoothSession {
|
|
57
|
+
/** MAC address of the peripheral this session is connected to. */
|
|
58
|
+
readonly address: string;
|
|
59
|
+
/**
|
|
60
|
+
* `true` until the connection is closed, either locally via
|
|
61
|
+
* {@link disconnect} or because the peripheral disconnected.
|
|
62
|
+
*/
|
|
63
|
+
readonly connected: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Read the current value of a GATT characteristic.
|
|
66
|
+
*
|
|
67
|
+
* @param serviceUuid - UUID of the GATT service that owns the characteristic.
|
|
68
|
+
* @param charUuid - UUID of the characteristic to read.
|
|
69
|
+
* @returns Promise resolving with the raw characteristic bytes.
|
|
70
|
+
*/
|
|
71
|
+
read(serviceUuid: string, charUuid: string): Promise<Uint8Array>;
|
|
72
|
+
/**
|
|
73
|
+
* Write a value to a GATT characteristic. Defaults to write-with-response.
|
|
74
|
+
*
|
|
75
|
+
* @param serviceUuid - UUID of the GATT service that owns the characteristic.
|
|
76
|
+
* @param charUuid - UUID of the characteristic to write.
|
|
77
|
+
* @param value - Bytes to write.
|
|
78
|
+
* @param options - Pass `withoutResponse: true` to use write-without-response.
|
|
79
|
+
*/
|
|
80
|
+
write(serviceUuid: string, charUuid: string, value: Uint8Array, options?: {
|
|
81
|
+
withoutResponse?: boolean;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Subscribe to notifications/indications on a characteristic.
|
|
85
|
+
* The returned object exposes three interchangeable consumption styles
|
|
86
|
+
* — see {@link EnergyAppBluetoothNotifications}.
|
|
87
|
+
*
|
|
88
|
+
* @param serviceUuid - UUID of the GATT service that owns the characteristic.
|
|
89
|
+
* @param charUuid - UUID of the characteristic to subscribe to.
|
|
90
|
+
*/
|
|
91
|
+
notifications(serviceUuid: string, charUuid: string): EnergyAppBluetoothNotifications;
|
|
92
|
+
/**
|
|
93
|
+
* Close the connection. Idempotent — calling it more than once is safe
|
|
94
|
+
* and resolves immediately on subsequent calls.
|
|
95
|
+
*/
|
|
96
|
+
disconnect(): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Bluetooth Low Energy API for enyo packages.
|
|
100
|
+
*
|
|
101
|
+
* Provides device discovery (scan) and GATT connection management. All
|
|
102
|
+
* operations require the package to declare the `Bluetooth` permission.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const bluetooth = energyApp.useBluetooth();
|
|
107
|
+
*
|
|
108
|
+
* // Discover nearby Shelly devices
|
|
109
|
+
* const devices = await bluetooth.scan({
|
|
110
|
+
* durationMs: 5000,
|
|
111
|
+
* filter: { manufacturerIds: [0x0BA9] },
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* // Talk to one of them, with guaranteed cleanup
|
|
115
|
+
* await bluetooth.withDevice(devices[0].address, async (session) => {
|
|
116
|
+
* const value = await session.read('1800', '2a00');
|
|
117
|
+
* console.log(new TextDecoder().decode(value));
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export interface EnergyAppBluetooth {
|
|
122
|
+
/**
|
|
123
|
+
* Run a discovery on the device's HCI controller.
|
|
124
|
+
*
|
|
125
|
+
* @param options - Optional filter and duration. Without options the host
|
|
126
|
+
* uses default duration and returns every advertisement.
|
|
127
|
+
* @returns Promise resolving with the discovered devices.
|
|
128
|
+
*/
|
|
129
|
+
scan(options?: EnergyAppBluetoothScanOptions): Promise<EnergyAppBluetoothDevice[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Open a connection to a peripheral.
|
|
132
|
+
*
|
|
133
|
+
* The caller is responsible for invoking {@link EnergyAppBluetoothSession.disconnect}.
|
|
134
|
+
* Prefer {@link withDevice} for typical use cases — it guarantees cleanup
|
|
135
|
+
* even when the callback throws.
|
|
136
|
+
*
|
|
137
|
+
* @param address - MAC address as returned by {@link scan}.
|
|
138
|
+
* @param options - Optional connection timeout configuration.
|
|
139
|
+
* @returns Promise resolving with an active {@link EnergyAppBluetoothSession}.
|
|
140
|
+
*/
|
|
141
|
+
connect(address: string, options?: EnergyAppBluetoothConnectOptions): Promise<EnergyAppBluetoothSession>;
|
|
142
|
+
/**
|
|
143
|
+
* Convenience scope: connects to the peripheral, runs `fn`, and always
|
|
144
|
+
* disconnects (even if `fn` throws). Strongly preferred over manual
|
|
145
|
+
* connect/disconnect because it eliminates the risk of leaking sessions
|
|
146
|
+
* when error paths short-circuit cleanup.
|
|
147
|
+
*
|
|
148
|
+
* @param address - MAC address as returned by {@link scan}.
|
|
149
|
+
* @param fn - Callback invoked with the live session. Its return value is
|
|
150
|
+
* forwarded as the result of `withDevice`.
|
|
151
|
+
* @param options - Optional connection timeout configuration.
|
|
152
|
+
* @returns Promise resolving with the value returned by `fn`.
|
|
153
|
+
*/
|
|
154
|
+
withDevice<T>(address: string, fn: (session: EnergyAppBluetoothSession) => Promise<T>, options?: EnergyAppBluetoothConnectOptions): Promise<T>;
|
|
155
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Supported interval durations for scheduled tasks.
|
|
3
3
|
* Provides predefined time intervals from 1 second to 1 hour.
|
|
4
4
|
*/
|
|
5
|
-
export type IntervalDuration = '10s' | '30s' | '1m' | '5m' | '1hr';
|
|
5
|
+
export type IntervalDuration = '1s' | '5s' | '10s' | '30s' | '1m' | '5m' | '1hr';
|
|
6
6
|
/**
|
|
7
7
|
* Interface for managing scheduled intervals in enyo packages.
|
|
8
8
|
* Provides functionality to create and manage recurring tasks.
|
|
@@ -119,6 +119,34 @@ export interface EnergyAppOnboarding {
|
|
|
119
119
|
* @returns Promise that resolves when navigation is complete
|
|
120
120
|
*/
|
|
121
121
|
moveToPreviousStep(guideName: string): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Jumps to a specific step within the onboarding guide by its `name`.
|
|
124
|
+
*
|
|
125
|
+
* Useful when implementing dynamic onboarding routes — for example, after
|
|
126
|
+
* receiving a step submission the package can decide programmatically
|
|
127
|
+
* which step to show next based on the submitted data, rather than
|
|
128
|
+
* relying on the declarative `branches` configuration on the step.
|
|
129
|
+
*
|
|
130
|
+
* If the target step does not exist within the guide the call is a no-op.
|
|
131
|
+
*
|
|
132
|
+
* @param guideName - The unique name of the guide to navigate
|
|
133
|
+
* @param stepName - The `name` of the target step to display
|
|
134
|
+
* @returns Promise that resolves when navigation is complete
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* onboarding.listenForStepSubmission(async (submission) => {
|
|
139
|
+
* if (submission.stepName === 'choose-route') {
|
|
140
|
+
* const route = submission.data?.route;
|
|
141
|
+
* await onboarding.moveToStep(submission.guideName,
|
|
142
|
+
* route === 'cloud' ? 'cloud-credentials' : 'local-network');
|
|
143
|
+
* return { state: 'success' };
|
|
144
|
+
* }
|
|
145
|
+
* return { state: 'success' };
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
moveToStep(guideName: string, stepName: string): Promise<void>;
|
|
122
150
|
/**
|
|
123
151
|
* Marks the onboarding as complete and clears the ConfigurationRequired state.
|
|
124
152
|
* This updates the state for the specified guide.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter clause applied during a Bluetooth scan.
|
|
3
|
+
* The clauses inside this object are OR-combined: a device matches when at
|
|
4
|
+
* least one populated clause matches its advertisement. An empty filter
|
|
5
|
+
* (no populated clauses) returns every advertised device.
|
|
6
|
+
*/
|
|
7
|
+
export interface EnergyAppBluetoothScanFilter {
|
|
8
|
+
/**
|
|
9
|
+
* Match if any advertised GATT service UUID is in this list.
|
|
10
|
+
* Comparison is case-insensitive.
|
|
11
|
+
*/
|
|
12
|
+
serviceUuids?: string[];
|
|
13
|
+
/** Match if any of the advertised manufacturer IDs is in this list. */
|
|
14
|
+
manufacturerIds?: number[];
|
|
15
|
+
/** Match if the BLE local name starts with this prefix (case-sensitive). */
|
|
16
|
+
namePrefix?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options controlling a single Bluetooth discovery run.
|
|
20
|
+
*/
|
|
21
|
+
export interface EnergyAppBluetoothScanOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Wall-clock duration of the scan in milliseconds. Defaults to 5000;
|
|
24
|
+
* the host caps this value at 15000 to protect the HCI controller.
|
|
25
|
+
*/
|
|
26
|
+
durationMs?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional filter narrowing which advertisements are returned. When
|
|
29
|
+
* omitted or empty, every advertised device is returned.
|
|
30
|
+
*/
|
|
31
|
+
filter?: EnergyAppBluetoothScanFilter;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A device discovered during a Bluetooth scan.
|
|
35
|
+
*
|
|
36
|
+
* The shape mirrors what is available in the BLE advertisement; values that
|
|
37
|
+
* are not present in the advertisement are omitted rather than zeroed.
|
|
38
|
+
*/
|
|
39
|
+
export interface EnergyAppBluetoothDevice {
|
|
40
|
+
/**
|
|
41
|
+
* Uppercase, colon-separated MAC address (e.g. "AA:BB:CC:DD:EE:FF").
|
|
42
|
+
* Use this value as the `address` argument to {@link EnergyAppBluetooth.connect}
|
|
43
|
+
* or {@link EnergyAppBluetooth.withDevice}.
|
|
44
|
+
*/
|
|
45
|
+
address: string;
|
|
46
|
+
/** BLE local name (advertised). May be undefined for nameless beacons. */
|
|
47
|
+
name?: string;
|
|
48
|
+
/** Last received signal strength indicator in dBm. */
|
|
49
|
+
rssi?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Manufacturer-specific advertisement data, keyed by manufacturer ID.
|
|
52
|
+
* Values are the raw bytes as advertised.
|
|
53
|
+
*/
|
|
54
|
+
manufacturerData?: Record<number, Uint8Array>;
|
|
55
|
+
/** Advertised service UUIDs in lowercase. */
|
|
56
|
+
serviceUuids?: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options applied when opening a GATT connection to a peripheral.
|
|
60
|
+
*/
|
|
61
|
+
export interface EnergyAppBluetoothConnectOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Maximum total time (milliseconds) to spend on the BlueZ `Connect` call
|
|
64
|
+
* plus `ServicesResolved`. Defaults to 15000.
|
|
65
|
+
*/
|
|
66
|
+
timeoutMs?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Closed set of error codes raised by the Bluetooth API.
|
|
70
|
+
*
|
|
71
|
+
* - `permission_denied`: package is missing the `Bluetooth` permission.
|
|
72
|
+
* - `controller_unavailable`: BlueZ is down or the HCI device is not up.
|
|
73
|
+
* - `scan_in_progress`: a concurrent scan request was rejected.
|
|
74
|
+
* - `not_connected`: a GATT operation was issued on a stale session.
|
|
75
|
+
* - `service_not_found`: the requested service UUID could not be resolved.
|
|
76
|
+
* - `characteristic_not_found`: the characteristic UUID could not be resolved.
|
|
77
|
+
* - `authentication_required`: the characteristic requires pairing/encryption.
|
|
78
|
+
* - `timeout`: an operation exceeded its allotted time.
|
|
79
|
+
* - `invalid_address`: the MAC address argument is malformed.
|
|
80
|
+
*/
|
|
81
|
+
export type EnergyAppBluetoothErrorCode = 'permission_denied' | 'controller_unavailable' | 'scan_in_progress' | 'not_connected' | 'service_not_found' | 'characteristic_not_found' | 'authentication_required' | 'timeout' | 'invalid_address';
|
|
82
|
+
/**
|
|
83
|
+
* Error subtype thrown by the Bluetooth API.
|
|
84
|
+
* Always carries a structured {@link EnergyAppBluetoothErrorCode}; callers
|
|
85
|
+
* should branch on `code` rather than parsing the human-readable message.
|
|
86
|
+
*/
|
|
87
|
+
export interface EnergyAppBluetoothError extends Error {
|
|
88
|
+
/** Machine-readable error code. */
|
|
89
|
+
readonly code: EnergyAppBluetoothErrorCode;
|
|
90
|
+
/**
|
|
91
|
+
* MAC address of the device the failed operation targeted, when relevant.
|
|
92
|
+
* Omitted for errors that are not tied to a specific device (e.g.
|
|
93
|
+
* `controller_unavailable`).
|
|
94
|
+
*/
|
|
95
|
+
readonly address?: string;
|
|
96
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnyoHeatpumpApplianceModeEnum = exports.EnyoHeatpumpApplianceAvailableFeaturesEnum = void 0;
|
|
3
|
+
exports.EnyoHeatpumpApplianceConnectionTypeEnum = exports.EnyoHeatpumpApplianceModeEnum = exports.EnyoHeatpumpApplianceAvailableFeaturesEnum = void 0;
|
|
4
4
|
var EnyoHeatpumpApplianceAvailableFeaturesEnum;
|
|
5
5
|
(function (EnyoHeatpumpApplianceAvailableFeaturesEnum) {
|
|
6
6
|
/** If the heatpump is capable of domestic hot water*/
|
|
@@ -15,6 +15,8 @@ var EnyoHeatpumpApplianceAvailableFeaturesEnum;
|
|
|
15
15
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["DomesticHotWaterOverheating"] = "DomesticHotWaterOverheating";
|
|
16
16
|
/** If the heatpump supports available power announcements */
|
|
17
17
|
EnyoHeatpumpApplianceAvailableFeaturesEnum["AvailablePowerAnnouncement"] = "AvailablePowerAnnouncement";
|
|
18
|
+
/** If the heatpump reports power values (e.g. electrical power consumption in watts) */
|
|
19
|
+
EnyoHeatpumpApplianceAvailableFeaturesEnum["Power"] = "Power";
|
|
18
20
|
})(EnyoHeatpumpApplianceAvailableFeaturesEnum || (exports.EnyoHeatpumpApplianceAvailableFeaturesEnum = EnyoHeatpumpApplianceAvailableFeaturesEnum = {}));
|
|
19
21
|
var EnyoHeatpumpApplianceModeEnum;
|
|
20
22
|
(function (EnyoHeatpumpApplianceModeEnum) {
|
|
@@ -23,3 +25,16 @@ var EnyoHeatpumpApplianceModeEnum;
|
|
|
23
25
|
EnyoHeatpumpApplianceModeEnum["DomesticHotWater"] = "DomesticHotWater";
|
|
24
26
|
EnyoHeatpumpApplianceModeEnum["EmergencyOperation"] = "EmergencyOperation";
|
|
25
27
|
})(EnyoHeatpumpApplianceModeEnum || (exports.EnyoHeatpumpApplianceModeEnum = EnyoHeatpumpApplianceModeEnum = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Describes how an enyo Hub physically/logically connects to the heatpump.
|
|
30
|
+
* Used by hosts and energy managers to reason about the integration's
|
|
31
|
+
* capabilities (e.g. SG-Ready offers only coarse 4-state control while an API
|
|
32
|
+
* connection typically exposes fine-grained read/write access).
|
|
33
|
+
*/
|
|
34
|
+
var EnyoHeatpumpApplianceConnectionTypeEnum;
|
|
35
|
+
(function (EnyoHeatpumpApplianceConnectionTypeEnum) {
|
|
36
|
+
/** Connected via the SG-Ready interface (two relay inputs, four states) */
|
|
37
|
+
EnyoHeatpumpApplianceConnectionTypeEnum["SgReady"] = "sg-ready";
|
|
38
|
+
/** Connected via a vendor or local API (e.g. REST, Modbus, EEBus) */
|
|
39
|
+
EnyoHeatpumpApplianceConnectionTypeEnum["Api"] = "api";
|
|
40
|
+
})(EnyoHeatpumpApplianceConnectionTypeEnum || (exports.EnyoHeatpumpApplianceConnectionTypeEnum = EnyoHeatpumpApplianceConnectionTypeEnum = {}));
|
|
@@ -10,7 +10,9 @@ export declare enum EnyoHeatpumpApplianceAvailableFeaturesEnum {
|
|
|
10
10
|
/** If the heatpump supports domestic hot water overheating */
|
|
11
11
|
DomesticHotWaterOverheating = "DomesticHotWaterOverheating",
|
|
12
12
|
/** If the heatpump supports available power announcements */
|
|
13
|
-
AvailablePowerAnnouncement = "AvailablePowerAnnouncement"
|
|
13
|
+
AvailablePowerAnnouncement = "AvailablePowerAnnouncement",
|
|
14
|
+
/** If the heatpump reports power values (e.g. electrical power consumption in watts) */
|
|
15
|
+
Power = "Power"
|
|
14
16
|
}
|
|
15
17
|
export declare enum EnyoHeatpumpApplianceModeEnum {
|
|
16
18
|
Idle = "Idle",
|
|
@@ -18,6 +20,18 @@ export declare enum EnyoHeatpumpApplianceModeEnum {
|
|
|
18
20
|
DomesticHotWater = "DomesticHotWater",
|
|
19
21
|
EmergencyOperation = "EmergencyOperation"
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Describes how an enyo Hub physically/logically connects to the heatpump.
|
|
25
|
+
* Used by hosts and energy managers to reason about the integration's
|
|
26
|
+
* capabilities (e.g. SG-Ready offers only coarse 4-state control while an API
|
|
27
|
+
* connection typically exposes fine-grained read/write access).
|
|
28
|
+
*/
|
|
29
|
+
export declare enum EnyoHeatpumpApplianceConnectionTypeEnum {
|
|
30
|
+
/** Connected via the SG-Ready interface (two relay inputs, four states) */
|
|
31
|
+
SgReady = "sg-ready",
|
|
32
|
+
/** Connected via a vendor or local API (e.g. REST, Modbus, EEBus) */
|
|
33
|
+
Api = "api"
|
|
34
|
+
}
|
|
21
35
|
export interface EnyoHeatpumpApplianceDomesticHotWater {
|
|
22
36
|
index: number;
|
|
23
37
|
tankSizeLiter?: number;
|
|
@@ -44,4 +58,11 @@ export interface EnyoHeatpumpApplianceMetadata {
|
|
|
44
58
|
bufferTanks?: EnyoHeatpumpApplianceBufferTank[];
|
|
45
59
|
compressors?: EnyoHeatpumpApplianceCompressor[];
|
|
46
60
|
heatingCircuits?: EnyoHeatpumpApplianceHeatingCircuit[];
|
|
61
|
+
/**
|
|
62
|
+
* Optional indicator of how the package connects to the heatpump.
|
|
63
|
+
* Helps consumers (UI, energy manager) understand the control surface
|
|
64
|
+
* available — e.g. an SG-Ready connection is limited to four discrete
|
|
65
|
+
* states, while an API connection typically allows direct read/write.
|
|
66
|
+
*/
|
|
67
|
+
connectionType?: EnyoHeatpumpApplianceConnectionTypeEnum;
|
|
47
68
|
}
|
|
@@ -32,4 +32,11 @@ var EnyoOnboardingSectionType;
|
|
|
32
32
|
EnyoOnboardingSectionType["Url"] = "url";
|
|
33
33
|
/** A dropdown/select section */
|
|
34
34
|
EnyoOnboardingSectionType["Select"] = "select";
|
|
35
|
+
/**
|
|
36
|
+
* A branching decision section.
|
|
37
|
+
* Renders as a switch/segmented control or radio group; the user's
|
|
38
|
+
* selection determines which step is shown next, enabling dynamic routes
|
|
39
|
+
* within a single onboarding guide.
|
|
40
|
+
*/
|
|
41
|
+
EnyoOnboardingSectionType["Branch"] = "branch";
|
|
35
42
|
})(EnyoOnboardingSectionType || (exports.EnyoOnboardingSectionType = EnyoOnboardingSectionType = {}));
|