@enyo-energy/sunspec-sdk 0.0.43 → 0.0.45
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/sunspec-devices.cjs +68 -3
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/sunspec-devices.js +68 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -166,7 +166,7 @@ class SunspecInverter extends BaseSunspecDevice {
|
|
|
166
166
|
serialNumber: commonData?.serialNumber,
|
|
167
167
|
modelName: commonData?.model,
|
|
168
168
|
vendorName: commonData?.manufacturer,
|
|
169
|
-
modbus: { unitId: this.unitId },
|
|
169
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
170
170
|
},
|
|
171
171
|
inverter: {
|
|
172
172
|
dcStrings: this.mapDcStringToApplianceMetadata(this.mapMPPTToStrings(mpptDataList)),
|
|
@@ -179,6 +179,28 @@ class SunspecInverter extends BaseSunspecDevice {
|
|
|
179
179
|
console.error(`Failed to create inverter appliance: ${error}`);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
+
else {
|
|
183
|
+
try {
|
|
184
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
185
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
186
|
+
metadata: {
|
|
187
|
+
...existingAppliance?.metadata,
|
|
188
|
+
connectionType: enyo_appliance_js_1.EnyoApplianceConnectionType.Connector,
|
|
189
|
+
state: enyo_appliance_js_1.EnyoApplianceStateEnum.Connected,
|
|
190
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
191
|
+
},
|
|
192
|
+
inverter: {
|
|
193
|
+
...existingAppliance?.inverter,
|
|
194
|
+
dcStrings: this.mapDcStringToApplianceMetadata(this.mapMPPTToStrings(mpptDataList)),
|
|
195
|
+
maxPvProductionW: inverterSettings?.WMax
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
console.log(`Sunspec Inverter connected: ${this.networkDevice.hostname} (${this.applianceId})`);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
console.error(`Failed to update inverter appliance: ${error}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
182
204
|
// Check for MPPT models
|
|
183
205
|
const mpptModel = this.sunspecClient.findModel(sunspec_interfaces_js_1.SunspecModelId.MPPT);
|
|
184
206
|
if (mpptModel) {
|
|
@@ -415,7 +437,7 @@ class SunspecBattery extends BaseSunspecDevice {
|
|
|
415
437
|
serialNumber: commonData?.serialNumber,
|
|
416
438
|
modelName: commonData?.model,
|
|
417
439
|
vendorName: commonData?.manufacturer,
|
|
418
|
-
modbus: { unitId: this.unitId },
|
|
440
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
419
441
|
},
|
|
420
442
|
battery: {
|
|
421
443
|
connectedToApplianceId: inverterApplianceId,
|
|
@@ -432,6 +454,32 @@ class SunspecBattery extends BaseSunspecDevice {
|
|
|
432
454
|
console.error(`Failed to create battery appliance: ${error}`);
|
|
433
455
|
}
|
|
434
456
|
}
|
|
457
|
+
else {
|
|
458
|
+
try {
|
|
459
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
460
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
461
|
+
metadata: {
|
|
462
|
+
...existingAppliance?.metadata,
|
|
463
|
+
connectionType: enyo_appliance_js_1.EnyoApplianceConnectionType.Connector,
|
|
464
|
+
state: enyo_appliance_js_1.EnyoApplianceStateEnum.Connected,
|
|
465
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
466
|
+
},
|
|
467
|
+
battery: {
|
|
468
|
+
...existingAppliance?.battery,
|
|
469
|
+
connectedToApplianceId: inverterApplianceId,
|
|
470
|
+
storageMode: this.mapToEnyoStorageMode(storageMode),
|
|
471
|
+
maxChargingPowerW: batteryData && batteryData.wChaMax !== undefined && batteryData.inWRte !== undefined ? batteryData.wChaMax * batteryData.inWRte : undefined,
|
|
472
|
+
maxDischargePowerW: batteryData && batteryData.wChaMax !== undefined && batteryData.outWRte !== undefined ? batteryData.wChaMax * batteryData.outWRte : undefined,
|
|
473
|
+
features,
|
|
474
|
+
gridChargingEnabled: batteryData?.chaGriSet === 1
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
console.log(`Sunspec Battery connected: ${this.networkDevice.hostname} (${this.applianceId})`);
|
|
478
|
+
}
|
|
479
|
+
catch (error) {
|
|
480
|
+
console.error(`Failed to update battery appliance: ${error}`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
435
483
|
this.startDataBusListening();
|
|
436
484
|
}
|
|
437
485
|
async disconnect() {
|
|
@@ -906,7 +954,7 @@ class SunspecMeter extends BaseSunspecDevice {
|
|
|
906
954
|
serialNumber: commonData?.serialNumber,
|
|
907
955
|
modelName: commonData?.model,
|
|
908
956
|
vendorName: commonData?.manufacturer,
|
|
909
|
-
modbus: { unitId: this.unitId },
|
|
957
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
910
958
|
},
|
|
911
959
|
topology: {
|
|
912
960
|
features: [enyo_appliance_js_1.EnyoApplianceTopologyFeatureEnum.IntermediateOfPrimaryMeter]
|
|
@@ -921,6 +969,23 @@ class SunspecMeter extends BaseSunspecDevice {
|
|
|
921
969
|
console.error(`Failed to create meter appliance: ${error}`);
|
|
922
970
|
}
|
|
923
971
|
}
|
|
972
|
+
else {
|
|
973
|
+
try {
|
|
974
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
975
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
976
|
+
metadata: {
|
|
977
|
+
...existingAppliance?.metadata,
|
|
978
|
+
connectionType: enyo_appliance_js_1.EnyoApplianceConnectionType.Connector,
|
|
979
|
+
state: enyo_appliance_js_1.EnyoApplianceStateEnum.Connected,
|
|
980
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
console.log(`Sunspec Meter connected: ${this.networkDevice.hostname} unit ${this.unitId} (${this.applianceId})`);
|
|
984
|
+
}
|
|
985
|
+
catch (error) {
|
|
986
|
+
console.error(`Failed to update meter appliance: ${error}`);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
924
989
|
}
|
|
925
990
|
/**
|
|
926
991
|
* Disconnect from the meter and update appliance state
|
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.45';
|
|
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
package/dist/sunspec-devices.js
CHANGED
|
@@ -162,7 +162,7 @@ export class SunspecInverter extends BaseSunspecDevice {
|
|
|
162
162
|
serialNumber: commonData?.serialNumber,
|
|
163
163
|
modelName: commonData?.model,
|
|
164
164
|
vendorName: commonData?.manufacturer,
|
|
165
|
-
modbus: { unitId: this.unitId },
|
|
165
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
166
166
|
},
|
|
167
167
|
inverter: {
|
|
168
168
|
dcStrings: this.mapDcStringToApplianceMetadata(this.mapMPPTToStrings(mpptDataList)),
|
|
@@ -175,6 +175,28 @@ export class SunspecInverter extends BaseSunspecDevice {
|
|
|
175
175
|
console.error(`Failed to create inverter appliance: ${error}`);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
+
else {
|
|
179
|
+
try {
|
|
180
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
181
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
182
|
+
metadata: {
|
|
183
|
+
...existingAppliance?.metadata,
|
|
184
|
+
connectionType: EnyoApplianceConnectionType.Connector,
|
|
185
|
+
state: EnyoApplianceStateEnum.Connected,
|
|
186
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
187
|
+
},
|
|
188
|
+
inverter: {
|
|
189
|
+
...existingAppliance?.inverter,
|
|
190
|
+
dcStrings: this.mapDcStringToApplianceMetadata(this.mapMPPTToStrings(mpptDataList)),
|
|
191
|
+
maxPvProductionW: inverterSettings?.WMax
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
console.log(`Sunspec Inverter connected: ${this.networkDevice.hostname} (${this.applianceId})`);
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
console.error(`Failed to update inverter appliance: ${error}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
178
200
|
// Check for MPPT models
|
|
179
201
|
const mpptModel = this.sunspecClient.findModel(SunspecModelId.MPPT);
|
|
180
202
|
if (mpptModel) {
|
|
@@ -410,7 +432,7 @@ export class SunspecBattery extends BaseSunspecDevice {
|
|
|
410
432
|
serialNumber: commonData?.serialNumber,
|
|
411
433
|
modelName: commonData?.model,
|
|
412
434
|
vendorName: commonData?.manufacturer,
|
|
413
|
-
modbus: { unitId: this.unitId },
|
|
435
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
414
436
|
},
|
|
415
437
|
battery: {
|
|
416
438
|
connectedToApplianceId: inverterApplianceId,
|
|
@@ -427,6 +449,32 @@ export class SunspecBattery extends BaseSunspecDevice {
|
|
|
427
449
|
console.error(`Failed to create battery appliance: ${error}`);
|
|
428
450
|
}
|
|
429
451
|
}
|
|
452
|
+
else {
|
|
453
|
+
try {
|
|
454
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
455
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
456
|
+
metadata: {
|
|
457
|
+
...existingAppliance?.metadata,
|
|
458
|
+
connectionType: EnyoApplianceConnectionType.Connector,
|
|
459
|
+
state: EnyoApplianceStateEnum.Connected,
|
|
460
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
461
|
+
},
|
|
462
|
+
battery: {
|
|
463
|
+
...existingAppliance?.battery,
|
|
464
|
+
connectedToApplianceId: inverterApplianceId,
|
|
465
|
+
storageMode: this.mapToEnyoStorageMode(storageMode),
|
|
466
|
+
maxChargingPowerW: batteryData && batteryData.wChaMax !== undefined && batteryData.inWRte !== undefined ? batteryData.wChaMax * batteryData.inWRte : undefined,
|
|
467
|
+
maxDischargePowerW: batteryData && batteryData.wChaMax !== undefined && batteryData.outWRte !== undefined ? batteryData.wChaMax * batteryData.outWRte : undefined,
|
|
468
|
+
features,
|
|
469
|
+
gridChargingEnabled: batteryData?.chaGriSet === 1
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
console.log(`Sunspec Battery connected: ${this.networkDevice.hostname} (${this.applianceId})`);
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
console.error(`Failed to update battery appliance: ${error}`);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
430
478
|
this.startDataBusListening();
|
|
431
479
|
}
|
|
432
480
|
async disconnect() {
|
|
@@ -900,7 +948,7 @@ export class SunspecMeter extends BaseSunspecDevice {
|
|
|
900
948
|
serialNumber: commonData?.serialNumber,
|
|
901
949
|
modelName: commonData?.model,
|
|
902
950
|
vendorName: commonData?.manufacturer,
|
|
903
|
-
modbus: { unitId: this.unitId },
|
|
951
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
904
952
|
},
|
|
905
953
|
topology: {
|
|
906
954
|
features: [EnyoApplianceTopologyFeatureEnum.IntermediateOfPrimaryMeter]
|
|
@@ -915,6 +963,23 @@ export class SunspecMeter extends BaseSunspecDevice {
|
|
|
915
963
|
console.error(`Failed to create meter appliance: ${error}`);
|
|
916
964
|
}
|
|
917
965
|
}
|
|
966
|
+
else {
|
|
967
|
+
try {
|
|
968
|
+
const existingAppliance = await this.applianceManager.findApplianceById(this.applianceId);
|
|
969
|
+
await this.applianceManager.updateAppliance(this.applianceId, {
|
|
970
|
+
metadata: {
|
|
971
|
+
...existingAppliance?.metadata,
|
|
972
|
+
connectionType: EnyoApplianceConnectionType.Connector,
|
|
973
|
+
state: EnyoApplianceStateEnum.Connected,
|
|
974
|
+
modbus: { unitId: this.unitId, baseAddress: this.baseAddress },
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
console.log(`Sunspec Meter connected: ${this.networkDevice.hostname} unit ${this.unitId} (${this.applianceId})`);
|
|
978
|
+
}
|
|
979
|
+
catch (error) {
|
|
980
|
+
console.error(`Failed to update meter appliance: ${error}`);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
918
983
|
}
|
|
919
984
|
/**
|
|
920
985
|
* Disconnect from the meter and update appliance state
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enyo-energy/sunspec-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "enyo Energy Sunspec SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^5.8.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@enyo-energy/energy-app-sdk": "^0.0.
|
|
40
|
+
"@enyo-energy/energy-app-sdk": "^0.0.94"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"node": "22.17.0"
|