@enyo-energy/energy-app-sdk 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/cjs/packages/energy-app-vehicle.d.cts +7 -0
- package/dist/cjs/types/enyo-data-bus-value.cjs +2 -0
- package/dist/cjs/types/enyo-data-bus-value.d.cts +65 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/packages/energy-app-vehicle.d.ts +7 -0
- package/dist/types/enyo-data-bus-value.d.ts +65 -1
- package/dist/types/enyo-data-bus-value.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -860,6 +860,8 @@ energyApp.useDataBus().sendMessage([{
|
|
|
860
860
|
data: {
|
|
861
861
|
vehicleId,
|
|
862
862
|
socPercent: 62,
|
|
863
|
+
// optional: remaining range in km, when the source reports it (e.g. Smartcar)
|
|
864
|
+
rangeKm: 280,
|
|
863
865
|
// omit only when the reading came straight off the wire
|
|
864
866
|
measuredAtIso: new Date().toISOString(),
|
|
865
867
|
},
|
|
@@ -870,6 +872,19 @@ That message is the only write path for a state of charge; it needs the
|
|
|
870
872
|
`SendDataBusValues` permission. `getSoc()` resolves to `undefined` when nothing
|
|
871
873
|
is known — an ordinary answer for a car with no SoC source, not an error.
|
|
872
874
|
|
|
875
|
+
The vehicle's battery size is written the same way: publish
|
|
876
|
+
`VehicleBatterySizeUpdateV1` with the usable capacity in watt-hours, and the
|
|
877
|
+
host stores it on the vehicle (replacing the previous value, including one the
|
|
878
|
+
user entered). It is read back as `batterySizeKwh`.
|
|
879
|
+
|
|
880
|
+
```typescript
|
|
881
|
+
energyApp.useDataBus().sendMessage([{
|
|
882
|
+
type: 'message',
|
|
883
|
+
message: 'VehicleBatterySizeUpdateV1',
|
|
884
|
+
data: {vehicleId, batterySizeWh: 75_000},
|
|
885
|
+
}]);
|
|
886
|
+
```
|
|
887
|
+
|
|
873
888
|
##### Car integrations: pairing a vehicle
|
|
874
889
|
|
|
875
890
|
A package in the `vehicle` category talks to a manufacturer's cloud and links
|
|
@@ -29,6 +29,13 @@ import { EnyoLinkedVehicle, EnyoVehicle, EnyoVehiclePackageUnpairReasonEnum, Eny
|
|
|
29
29
|
* That message is the only write path for a state of charge; publishing it
|
|
30
30
|
* requires the `SendDataBusValues` permission.
|
|
31
31
|
*
|
|
32
|
+
* ## Writing a battery size
|
|
33
|
+
*
|
|
34
|
+
* The same holds for the vehicle's battery size: an app that knows it publishes
|
|
35
|
+
* `EnyoDataBusVehicleBatterySizeUpdateV1` with `batterySizeWh`, and the host
|
|
36
|
+
* stores it on the vehicle, replacing the previous value. It is read back as
|
|
37
|
+
* {@link EnyoVehicle.batterySizeKwh}.
|
|
38
|
+
*
|
|
32
39
|
* ## Pairing a car integration
|
|
33
40
|
*
|
|
34
41
|
* A package in the `vehicle` category — a manufacturer cloud integration —
|
|
@@ -847,6 +847,8 @@ var EnyoDataBusMessageEnum;
|
|
|
847
847
|
EnyoDataBusMessageEnum["StopAirConditioningV1"] = "StopAirConditioningV1";
|
|
848
848
|
EnyoDataBusMessageEnum["ChangeAirConditioningOptimizationModeV1"] = "ChangeAirConditioningOptimizationModeV1";
|
|
849
849
|
EnyoDataBusMessageEnum["VehicleSocUpdateV1"] = "VehicleSocUpdateV1";
|
|
850
|
+
/** Provide or update the usable traction battery capacity of a vehicle, in Wh. */
|
|
851
|
+
EnyoDataBusMessageEnum["VehicleBatterySizeUpdateV1"] = "VehicleBatterySizeUpdateV1";
|
|
850
852
|
/** Request the current or estimated state of charge of a vehicle, by vehicle id. */
|
|
851
853
|
EnyoDataBusMessageEnum["RequestVehicleSocEstimateV1"] = "RequestVehicleSocEstimateV1";
|
|
852
854
|
/** Answer to {@link RequestVehicleSocEstimateV1} — the estimate with its age and source, or why none could be given. */
|
|
@@ -1542,6 +1542,8 @@ export declare enum EnyoDataBusMessageEnum {
|
|
|
1542
1542
|
StopAirConditioningV1 = "StopAirConditioningV1",
|
|
1543
1543
|
ChangeAirConditioningOptimizationModeV1 = "ChangeAirConditioningOptimizationModeV1",
|
|
1544
1544
|
VehicleSocUpdateV1 = "VehicleSocUpdateV1",
|
|
1545
|
+
/** Provide or update the usable traction battery capacity of a vehicle, in Wh. */
|
|
1546
|
+
VehicleBatterySizeUpdateV1 = "VehicleBatterySizeUpdateV1",
|
|
1545
1547
|
/** Request the current or estimated state of charge of a vehicle, by vehicle id. */
|
|
1546
1548
|
RequestVehicleSocEstimateV1 = "RequestVehicleSocEstimateV1",
|
|
1547
1549
|
/** Answer to {@link RequestVehicleSocEstimateV1} — the estimate with its age and source, or why none could be given. */
|
|
@@ -4922,7 +4924,8 @@ export interface EnyoDataBusChangeAirConditioningOptimizationModeV1 extends Enyo
|
|
|
4922
4924
|
};
|
|
4923
4925
|
}
|
|
4924
4926
|
/**
|
|
4925
|
-
* Informational message reporting the state of charge of an electric vehicle
|
|
4927
|
+
* Informational message reporting the state of charge of an electric vehicle,
|
|
4928
|
+
* optionally with its remaining driving range.
|
|
4926
4929
|
*
|
|
4927
4930
|
* **This message is the write path for a state of charge.** `EnergyAppVehicle`
|
|
4928
4931
|
* is read-only by design — there is no `vehicles.update()` — so an app that can
|
|
@@ -4942,6 +4945,7 @@ export interface EnyoDataBusChangeAirConditioningOptimizationModeV1 extends Enyo
|
|
|
4942
4945
|
* data: {
|
|
4943
4946
|
* vehicleId,
|
|
4944
4947
|
* socPercent: 62,
|
|
4948
|
+
* rangeKm: 280, // optional, when the source reports it
|
|
4945
4949
|
* measuredAtIso: new Date().toISOString(),
|
|
4946
4950
|
* },
|
|
4947
4951
|
* }]);
|
|
@@ -4957,6 +4961,15 @@ export interface EnyoDataBusVehicleSocUpdateV1 extends EnyoDataBusMessage {
|
|
|
4957
4961
|
vehicleId: string;
|
|
4958
4962
|
/** Current state of charge of the vehicle's traction battery in percent (0-100) */
|
|
4959
4963
|
socPercent: number;
|
|
4964
|
+
/**
|
|
4965
|
+
* Remaining driving range in kilometres at this state of charge, as the
|
|
4966
|
+
* vehicle or its cloud API estimates it — e.g. the `range` Smartcar's
|
|
4967
|
+
* battery endpoint returns alongside the percentage. Convert from miles
|
|
4968
|
+
* before sending, and omit it rather than deriving one from
|
|
4969
|
+
* {@link socPercent}: a range depends on the car's consumption, which
|
|
4970
|
+
* only the car knows.
|
|
4971
|
+
*/
|
|
4972
|
+
rangeKm?: number;
|
|
4960
4973
|
/** Total usable capacity of the vehicle's traction battery in kWh, if known */
|
|
4961
4974
|
batterySizeKwh?: number;
|
|
4962
4975
|
/**
|
|
@@ -4978,6 +4991,57 @@ export interface EnyoDataBusVehicleSocUpdateV1 extends EnyoDataBusMessage {
|
|
|
4978
4991
|
source?: EnyoVehicleSocSourceEnum;
|
|
4979
4992
|
};
|
|
4980
4993
|
}
|
|
4994
|
+
/**
|
|
4995
|
+
* Provides or updates the usable capacity of a vehicle's traction battery.
|
|
4996
|
+
*
|
|
4997
|
+
* **This message is the write path for a vehicle's battery size.**
|
|
4998
|
+
* `EnergyAppVehicle` is read-only, so an app that knows the capacity — a
|
|
4999
|
+
* manufacturer or Smartcar cloud integration, a wallbox reading it over
|
|
5000
|
+
* ISO 15118 — publishes it here and the host stores it on the vehicle. It is
|
|
5001
|
+
* read back as `EnyoVehicle.batterySizeKwh` (the value divided by 1000).
|
|
5002
|
+
*
|
|
5003
|
+
* Unlike {@link EnyoDataBusVehicleSocUpdateV1.data.batterySizeKwh}, which only
|
|
5004
|
+
* travels with one reading, this updates the vehicle itself and replaces the
|
|
5005
|
+
* value stored on it — including one the user entered — because it is what
|
|
5006
|
+
* every charging plan for the car is sized against. Send it when the app first
|
|
5007
|
+
* learns the capacity and whenever it changes (e.g. the vendor reports a
|
|
5008
|
+
* degraded usable capacity); there is no need to repeat an unchanged value.
|
|
5009
|
+
*
|
|
5010
|
+
* Only send a value you actually read. An invented or rounded-up capacity is
|
|
5011
|
+
* planned against as if it were measured, and the car is charged short.
|
|
5012
|
+
*
|
|
5013
|
+
* ```typescript
|
|
5014
|
+
* energyApp.useDataBus().sendMessage([{
|
|
5015
|
+
* type: 'message',
|
|
5016
|
+
* message: 'VehicleBatterySizeUpdateV1',
|
|
5017
|
+
* data: {
|
|
5018
|
+
* vehicleId,
|
|
5019
|
+
* batterySizeWh: 75_000,
|
|
5020
|
+
* },
|
|
5021
|
+
* }]);
|
|
5022
|
+
* ```
|
|
5023
|
+
*
|
|
5024
|
+
* Requires the `SendDataBusValues` permission.
|
|
5025
|
+
*/
|
|
5026
|
+
export interface EnyoDataBusVehicleBatterySizeUpdateV1 extends EnyoDataBusMessage {
|
|
5027
|
+
type: 'message';
|
|
5028
|
+
message: EnyoDataBusMessageEnum.VehicleBatterySizeUpdateV1;
|
|
5029
|
+
data: {
|
|
5030
|
+
/** ID of the vehicle the battery size belongs to */
|
|
5031
|
+
vehicleId: string;
|
|
5032
|
+
/**
|
|
5033
|
+
* Usable (net) capacity of the traction battery in watt-hours — what
|
|
5034
|
+
* can actually be charged, not the gross capacity on the spec sheet.
|
|
5035
|
+
* Must be greater than 0.
|
|
5036
|
+
*/
|
|
5037
|
+
batterySizeWh: number;
|
|
5038
|
+
/**
|
|
5039
|
+
* Where the value came from. A manufacturer or Smartcar cloud reading
|
|
5040
|
+
* is {@link EnyoVehicleSocSourceEnum.Vehicle}.
|
|
5041
|
+
*/
|
|
5042
|
+
source?: EnyoVehicleSocSourceEnum;
|
|
5043
|
+
};
|
|
5044
|
+
}
|
|
4981
5045
|
/**
|
|
4982
5046
|
* Request the current or estimated state of charge of a vehicle, by id.
|
|
4983
5047
|
*
|
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 = '1.
|
|
12
|
+
exports.SDK_VERSION = '1.41.0';
|
|
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
|
@@ -29,6 +29,13 @@ import { EnyoLinkedVehicle, EnyoVehicle, EnyoVehiclePackageUnpairReasonEnum, Eny
|
|
|
29
29
|
* That message is the only write path for a state of charge; publishing it
|
|
30
30
|
* requires the `SendDataBusValues` permission.
|
|
31
31
|
*
|
|
32
|
+
* ## Writing a battery size
|
|
33
|
+
*
|
|
34
|
+
* The same holds for the vehicle's battery size: an app that knows it publishes
|
|
35
|
+
* `EnyoDataBusVehicleBatterySizeUpdateV1` with `batterySizeWh`, and the host
|
|
36
|
+
* stores it on the vehicle, replacing the previous value. It is read back as
|
|
37
|
+
* {@link EnyoVehicle.batterySizeKwh}.
|
|
38
|
+
*
|
|
32
39
|
* ## Pairing a car integration
|
|
33
40
|
*
|
|
34
41
|
* A package in the `vehicle` category — a manufacturer cloud integration —
|
|
@@ -1542,6 +1542,8 @@ export declare enum EnyoDataBusMessageEnum {
|
|
|
1542
1542
|
StopAirConditioningV1 = "StopAirConditioningV1",
|
|
1543
1543
|
ChangeAirConditioningOptimizationModeV1 = "ChangeAirConditioningOptimizationModeV1",
|
|
1544
1544
|
VehicleSocUpdateV1 = "VehicleSocUpdateV1",
|
|
1545
|
+
/** Provide or update the usable traction battery capacity of a vehicle, in Wh. */
|
|
1546
|
+
VehicleBatterySizeUpdateV1 = "VehicleBatterySizeUpdateV1",
|
|
1545
1547
|
/** Request the current or estimated state of charge of a vehicle, by vehicle id. */
|
|
1546
1548
|
RequestVehicleSocEstimateV1 = "RequestVehicleSocEstimateV1",
|
|
1547
1549
|
/** Answer to {@link RequestVehicleSocEstimateV1} — the estimate with its age and source, or why none could be given. */
|
|
@@ -4922,7 +4924,8 @@ export interface EnyoDataBusChangeAirConditioningOptimizationModeV1 extends Enyo
|
|
|
4922
4924
|
};
|
|
4923
4925
|
}
|
|
4924
4926
|
/**
|
|
4925
|
-
* Informational message reporting the state of charge of an electric vehicle
|
|
4927
|
+
* Informational message reporting the state of charge of an electric vehicle,
|
|
4928
|
+
* optionally with its remaining driving range.
|
|
4926
4929
|
*
|
|
4927
4930
|
* **This message is the write path for a state of charge.** `EnergyAppVehicle`
|
|
4928
4931
|
* is read-only by design — there is no `vehicles.update()` — so an app that can
|
|
@@ -4942,6 +4945,7 @@ export interface EnyoDataBusChangeAirConditioningOptimizationModeV1 extends Enyo
|
|
|
4942
4945
|
* data: {
|
|
4943
4946
|
* vehicleId,
|
|
4944
4947
|
* socPercent: 62,
|
|
4948
|
+
* rangeKm: 280, // optional, when the source reports it
|
|
4945
4949
|
* measuredAtIso: new Date().toISOString(),
|
|
4946
4950
|
* },
|
|
4947
4951
|
* }]);
|
|
@@ -4957,6 +4961,15 @@ export interface EnyoDataBusVehicleSocUpdateV1 extends EnyoDataBusMessage {
|
|
|
4957
4961
|
vehicleId: string;
|
|
4958
4962
|
/** Current state of charge of the vehicle's traction battery in percent (0-100) */
|
|
4959
4963
|
socPercent: number;
|
|
4964
|
+
/**
|
|
4965
|
+
* Remaining driving range in kilometres at this state of charge, as the
|
|
4966
|
+
* vehicle or its cloud API estimates it — e.g. the `range` Smartcar's
|
|
4967
|
+
* battery endpoint returns alongside the percentage. Convert from miles
|
|
4968
|
+
* before sending, and omit it rather than deriving one from
|
|
4969
|
+
* {@link socPercent}: a range depends on the car's consumption, which
|
|
4970
|
+
* only the car knows.
|
|
4971
|
+
*/
|
|
4972
|
+
rangeKm?: number;
|
|
4960
4973
|
/** Total usable capacity of the vehicle's traction battery in kWh, if known */
|
|
4961
4974
|
batterySizeKwh?: number;
|
|
4962
4975
|
/**
|
|
@@ -4978,6 +4991,57 @@ export interface EnyoDataBusVehicleSocUpdateV1 extends EnyoDataBusMessage {
|
|
|
4978
4991
|
source?: EnyoVehicleSocSourceEnum;
|
|
4979
4992
|
};
|
|
4980
4993
|
}
|
|
4994
|
+
/**
|
|
4995
|
+
* Provides or updates the usable capacity of a vehicle's traction battery.
|
|
4996
|
+
*
|
|
4997
|
+
* **This message is the write path for a vehicle's battery size.**
|
|
4998
|
+
* `EnergyAppVehicle` is read-only, so an app that knows the capacity — a
|
|
4999
|
+
* manufacturer or Smartcar cloud integration, a wallbox reading it over
|
|
5000
|
+
* ISO 15118 — publishes it here and the host stores it on the vehicle. It is
|
|
5001
|
+
* read back as `EnyoVehicle.batterySizeKwh` (the value divided by 1000).
|
|
5002
|
+
*
|
|
5003
|
+
* Unlike {@link EnyoDataBusVehicleSocUpdateV1.data.batterySizeKwh}, which only
|
|
5004
|
+
* travels with one reading, this updates the vehicle itself and replaces the
|
|
5005
|
+
* value stored on it — including one the user entered — because it is what
|
|
5006
|
+
* every charging plan for the car is sized against. Send it when the app first
|
|
5007
|
+
* learns the capacity and whenever it changes (e.g. the vendor reports a
|
|
5008
|
+
* degraded usable capacity); there is no need to repeat an unchanged value.
|
|
5009
|
+
*
|
|
5010
|
+
* Only send a value you actually read. An invented or rounded-up capacity is
|
|
5011
|
+
* planned against as if it were measured, and the car is charged short.
|
|
5012
|
+
*
|
|
5013
|
+
* ```typescript
|
|
5014
|
+
* energyApp.useDataBus().sendMessage([{
|
|
5015
|
+
* type: 'message',
|
|
5016
|
+
* message: 'VehicleBatterySizeUpdateV1',
|
|
5017
|
+
* data: {
|
|
5018
|
+
* vehicleId,
|
|
5019
|
+
* batterySizeWh: 75_000,
|
|
5020
|
+
* },
|
|
5021
|
+
* }]);
|
|
5022
|
+
* ```
|
|
5023
|
+
*
|
|
5024
|
+
* Requires the `SendDataBusValues` permission.
|
|
5025
|
+
*/
|
|
5026
|
+
export interface EnyoDataBusVehicleBatterySizeUpdateV1 extends EnyoDataBusMessage {
|
|
5027
|
+
type: 'message';
|
|
5028
|
+
message: EnyoDataBusMessageEnum.VehicleBatterySizeUpdateV1;
|
|
5029
|
+
data: {
|
|
5030
|
+
/** ID of the vehicle the battery size belongs to */
|
|
5031
|
+
vehicleId: string;
|
|
5032
|
+
/**
|
|
5033
|
+
* Usable (net) capacity of the traction battery in watt-hours — what
|
|
5034
|
+
* can actually be charged, not the gross capacity on the spec sheet.
|
|
5035
|
+
* Must be greater than 0.
|
|
5036
|
+
*/
|
|
5037
|
+
batterySizeWh: number;
|
|
5038
|
+
/**
|
|
5039
|
+
* Where the value came from. A manufacturer or Smartcar cloud reading
|
|
5040
|
+
* is {@link EnyoVehicleSocSourceEnum.Vehicle}.
|
|
5041
|
+
*/
|
|
5042
|
+
source?: EnyoVehicleSocSourceEnum;
|
|
5043
|
+
};
|
|
5044
|
+
}
|
|
4981
5045
|
/**
|
|
4982
5046
|
* Request the current or estimated state of charge of a vehicle, by id.
|
|
4983
5047
|
*
|
|
@@ -844,6 +844,8 @@ export var EnyoDataBusMessageEnum;
|
|
|
844
844
|
EnyoDataBusMessageEnum["StopAirConditioningV1"] = "StopAirConditioningV1";
|
|
845
845
|
EnyoDataBusMessageEnum["ChangeAirConditioningOptimizationModeV1"] = "ChangeAirConditioningOptimizationModeV1";
|
|
846
846
|
EnyoDataBusMessageEnum["VehicleSocUpdateV1"] = "VehicleSocUpdateV1";
|
|
847
|
+
/** Provide or update the usable traction battery capacity of a vehicle, in Wh. */
|
|
848
|
+
EnyoDataBusMessageEnum["VehicleBatterySizeUpdateV1"] = "VehicleBatterySizeUpdateV1";
|
|
847
849
|
/** Request the current or estimated state of charge of a vehicle, by vehicle id. */
|
|
848
850
|
EnyoDataBusMessageEnum["RequestVehicleSocEstimateV1"] = "RequestVehicleSocEstimateV1";
|
|
849
851
|
/** Answer to {@link RequestVehicleSocEstimateV1} — the estimate with its age and source, or why none could be given. */
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED