@enyo-energy/sunspec-sdk 0.0.40 → 0.0.42
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-modbus-client.cjs +30 -12
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/sunspec-modbus-client.js +30 -12
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -563,6 +563,7 @@ class SunspecModbusClient {
|
|
|
563
563
|
data.acEnergy = !this.isUnimplementedValue(acEnergy, 'acc32')
|
|
564
564
|
? acEnergy * Math.pow(10, scaleFactors.WH_SF)
|
|
565
565
|
: undefined;
|
|
566
|
+
console.debug('[Model 103] Inverter Data:', data);
|
|
566
567
|
return data;
|
|
567
568
|
}
|
|
568
569
|
catch (error) {
|
|
@@ -605,7 +606,7 @@ class SunspecModbusClient {
|
|
|
605
606
|
const dcPowerRaw = this.extractValue(buffer, 20, 'int16');
|
|
606
607
|
const stateRaw = this.extractValue(buffer, 24, 'uint16');
|
|
607
608
|
this.logRegisterRead(101, 24, 'Operating State', stateRaw, 'enum16');
|
|
608
|
-
|
|
609
|
+
const data = {
|
|
609
610
|
blockNumber: 101,
|
|
610
611
|
voltageAN: this.applyScaleFactor(voltageRaw, scaleFactors.V_SF, 'uint16', 'Voltage AN', 7, 101),
|
|
611
612
|
acCurrent: this.applyScaleFactor(acCurrentRaw, scaleFactors.A_SF, 'uint16', 'AC Current', 2, 101),
|
|
@@ -616,6 +617,8 @@ class SunspecModbusClient {
|
|
|
616
617
|
dcPower: this.applyScaleFactor(dcPowerRaw, scaleFactors.DCW_SF, 'int16', 'DC Power', 20, 101),
|
|
617
618
|
operatingState: stateRaw
|
|
618
619
|
};
|
|
620
|
+
console.debug('[Model 101] Single Phase Inverter Data:', data);
|
|
621
|
+
return data;
|
|
619
622
|
}
|
|
620
623
|
catch (error) {
|
|
621
624
|
console.error(`Error reading single phase inverter data: ${error}`);
|
|
@@ -667,26 +670,26 @@ class SunspecModbusClient {
|
|
|
667
670
|
// Log the raw and scaled values
|
|
668
671
|
if (offset !== undefined && modelId !== undefined && fieldName) {
|
|
669
672
|
const hex = value >= 0 ? value.toString(16).toUpperCase() : (value >>> 0).toString(16).toUpperCase();
|
|
670
|
-
console.
|
|
673
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} raw=${value} (0x${hex}), SF=${scaleFactor}, scaled=${scaledValue}`);
|
|
671
674
|
}
|
|
672
675
|
else {
|
|
673
676
|
const fieldPrefix = fieldName ? `${fieldName}: ` : '';
|
|
674
|
-
console.
|
|
677
|
+
console.debug(`Scale Factor Applied - ${fieldPrefix}raw=${value} (decimal), SF=${scaleFactor}, scaled=${scaledValue}`);
|
|
675
678
|
}
|
|
676
679
|
return scaledValue;
|
|
677
680
|
}
|
|
678
681
|
logRegisterRead(modelId, offset, fieldName, rawValue, dataType) {
|
|
679
682
|
const typeInfo = dataType ? ` (${dataType})` : '';
|
|
680
683
|
if (rawValue === undefined) {
|
|
681
|
-
console.
|
|
684
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = -${typeInfo}`);
|
|
682
685
|
return;
|
|
683
686
|
}
|
|
684
687
|
if (typeof rawValue === 'number') {
|
|
685
688
|
const hex = rawValue >= 0 ? rawValue.toString(16).toUpperCase() : (rawValue >>> 0).toString(16).toUpperCase();
|
|
686
|
-
console.
|
|
689
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = ${rawValue} (0x${hex})${typeInfo}`);
|
|
687
690
|
}
|
|
688
691
|
else {
|
|
689
|
-
console.
|
|
692
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = "${rawValue}"${typeInfo}`);
|
|
690
693
|
}
|
|
691
694
|
}
|
|
692
695
|
/**
|
|
@@ -761,7 +764,7 @@ class SunspecModbusClient {
|
|
|
761
764
|
const timestampRaw = this.extractValue(buffer, moduleOffset + 14, 'uint32', 2);
|
|
762
765
|
this.logRegisterRead(160, 14, `MPPT ${moduleId} Timestamp`, timestampRaw, 'uint32');
|
|
763
766
|
this.logRegisterRead(160, 17, `MPPT ${moduleId} Operating State`, dcst, 'enum16');
|
|
764
|
-
|
|
767
|
+
const data = {
|
|
765
768
|
blockNumber: 160,
|
|
766
769
|
blockAddress: model.address,
|
|
767
770
|
blockLength: model.length,
|
|
@@ -782,6 +785,8 @@ class SunspecModbusClient {
|
|
|
782
785
|
temperatureSF: temperatureScaleFactor,
|
|
783
786
|
operatingState: dcst,
|
|
784
787
|
};
|
|
788
|
+
console.debug(`[Model 160] MPPT Module ${moduleId} Data:`, data);
|
|
789
|
+
return data;
|
|
785
790
|
}
|
|
786
791
|
/**
|
|
787
792
|
* Read MPPT data from Model 160
|
|
@@ -1103,6 +1108,7 @@ class SunspecModbusClient {
|
|
|
1103
1108
|
setOp: !this.isUnimplementedValue(setOpRaw, 'enum16') ? setOpRaw : undefined,
|
|
1104
1109
|
setInvState: !this.isUnimplementedValue(setInvStateRaw, 'enum16') ? setInvStateRaw : undefined,
|
|
1105
1110
|
};
|
|
1111
|
+
console.debug('[Model 802] Battery Base Data:', data);
|
|
1106
1112
|
return data;
|
|
1107
1113
|
}
|
|
1108
1114
|
catch (error) {
|
|
@@ -1228,6 +1234,7 @@ class SunspecModbusClient {
|
|
|
1228
1234
|
data.dischargePower = Math.abs((data.outWRte / 100) * data.wChaMax);
|
|
1229
1235
|
console.log(`Calculated Discharge Power (inWRte: ${data.outWRte}, wChaMax: ${data.wChaMax}): ${data.dischargePower?.toFixed(2)} W`);
|
|
1230
1236
|
}
|
|
1237
|
+
console.debug('[Model 124] Battery Data:', data);
|
|
1231
1238
|
return data;
|
|
1232
1239
|
}
|
|
1233
1240
|
else if (model.id === 802) {
|
|
@@ -1250,7 +1257,7 @@ class SunspecModbusClient {
|
|
|
1250
1257
|
dischargePower = Math.abs(baseData.w);
|
|
1251
1258
|
}
|
|
1252
1259
|
}
|
|
1253
|
-
|
|
1260
|
+
const result = {
|
|
1254
1261
|
blockNumber: 802,
|
|
1255
1262
|
blockAddress: model.address,
|
|
1256
1263
|
blockLength: model.length,
|
|
@@ -1264,6 +1271,8 @@ class SunspecModbusClient {
|
|
|
1264
1271
|
chargePower,
|
|
1265
1272
|
dischargePower,
|
|
1266
1273
|
};
|
|
1274
|
+
console.debug('[Model 802] Battery Data:', result);
|
|
1275
|
+
return result;
|
|
1267
1276
|
}
|
|
1268
1277
|
else {
|
|
1269
1278
|
// Handle other battery models (803) if needed
|
|
@@ -1411,7 +1420,7 @@ class SunspecModbusClient {
|
|
|
1411
1420
|
this.logRegisterRead(124, 5, 'storCtlMod', storCtlModRaw, 'bitfield16');
|
|
1412
1421
|
this.logRegisterRead(124, 17, 'chaGriSet', chaGriSetRaw, 'enum16');
|
|
1413
1422
|
// Apply scale factors and return control settings
|
|
1414
|
-
|
|
1423
|
+
const controls = {
|
|
1415
1424
|
storCtlMod: !this.isUnimplementedValue(storCtlModRaw, 'bitfield16') ? storCtlModRaw : undefined,
|
|
1416
1425
|
chaGriSet: !this.isUnimplementedValue(chaGriSetRaw, 'enum16') ? chaGriSetRaw : undefined,
|
|
1417
1426
|
wChaMax: this.applyScaleFactor(wChaMaxRaw, scaleFactors.WChaMax_SF, 'uint16', 'Max Charge Power', 2, 124),
|
|
@@ -1419,6 +1428,8 @@ class SunspecModbusClient {
|
|
|
1419
1428
|
outWRte: this.applyScaleFactor(outWRteRaw, scaleFactors.InOutWRte_SF, 'int16', 'Discharge Rate', 12, 124),
|
|
1420
1429
|
minRsvPct: this.applyScaleFactor(minRsvPctRaw, scaleFactors.MinRsvPct_SF, 'uint16', 'Min Reserve Percent', 7, 124)
|
|
1421
1430
|
};
|
|
1431
|
+
console.debug('[Model 124] Battery Controls:', controls);
|
|
1432
|
+
return controls;
|
|
1422
1433
|
}
|
|
1423
1434
|
catch (error) {
|
|
1424
1435
|
console.error(`Error reading battery controls: ${error}`);
|
|
@@ -1504,13 +1515,15 @@ class SunspecModbusClient {
|
|
|
1504
1515
|
const frequency = this.applyScaleFactor(freqRaw, freqSF, 'uint16', 'Frequency', freqOffset, model.id);
|
|
1505
1516
|
const exportedEnergy = this.applyScaleFactor(exportRaw, energySF, "acc32", 'Exported Energy', exportOffset, model.id);
|
|
1506
1517
|
const importedEnergy = this.applyScaleFactor(importRaw, energySF, "acc32", 'Imported Energy', importOffset, model.id);
|
|
1507
|
-
|
|
1518
|
+
const data = {
|
|
1508
1519
|
blockNumber: model.id,
|
|
1509
1520
|
totalPower,
|
|
1510
1521
|
frequency,
|
|
1511
1522
|
exportedEnergy,
|
|
1512
1523
|
importedEnergy
|
|
1513
1524
|
};
|
|
1525
|
+
console.debug(`[Model ${model.id}] Meter Data:`, data);
|
|
1526
|
+
return data;
|
|
1514
1527
|
}
|
|
1515
1528
|
catch (error) {
|
|
1516
1529
|
console.error(`Error reading meter data: ${error}`);
|
|
@@ -1547,7 +1560,7 @@ class SunspecModbusClient {
|
|
|
1547
1560
|
this.logRegisterRead(1, 48, 'Serial Number', serialNumber, 'string');
|
|
1548
1561
|
const deviceAddress = this.extractValue(buffer, 66, 'uint16');
|
|
1549
1562
|
this.logRegisterRead(1, 64, 'Device Address', deviceAddress, 'uint16');
|
|
1550
|
-
|
|
1563
|
+
const data = {
|
|
1551
1564
|
manufacturer,
|
|
1552
1565
|
model: modelName,
|
|
1553
1566
|
options,
|
|
@@ -1555,6 +1568,8 @@ class SunspecModbusClient {
|
|
|
1555
1568
|
serialNumber,
|
|
1556
1569
|
deviceAddress
|
|
1557
1570
|
};
|
|
1571
|
+
console.debug('[Model 1] Common Block:', data);
|
|
1572
|
+
return data;
|
|
1558
1573
|
}
|
|
1559
1574
|
catch (error) {
|
|
1560
1575
|
console.error(`Error reading common block: ${error}`);
|
|
@@ -1628,7 +1643,7 @@ class SunspecModbusClient {
|
|
|
1628
1643
|
this.logRegisterRead(121, 17, 'VArAct', vArActRaw, 'enum16');
|
|
1629
1644
|
this.logRegisterRead(121, 18, 'ClcTotVA', clcTotVARaw, 'enum16');
|
|
1630
1645
|
this.logRegisterRead(121, 21, 'ConnPh', connPhRaw, 'enum16');
|
|
1631
|
-
|
|
1646
|
+
const settings = {
|
|
1632
1647
|
blockNumber: 121,
|
|
1633
1648
|
blockAddress: model.address,
|
|
1634
1649
|
blockLength: model.length,
|
|
@@ -1670,6 +1685,8 @@ class SunspecModbusClient {
|
|
|
1670
1685
|
ECPNomHz_SF: scaleFactors.ECPNomHz_SF,
|
|
1671
1686
|
ConnPh: connPhRaw
|
|
1672
1687
|
};
|
|
1688
|
+
console.debug('[Model 121] Inverter Settings:', settings);
|
|
1689
|
+
return settings;
|
|
1673
1690
|
}
|
|
1674
1691
|
catch (error) {
|
|
1675
1692
|
console.error(`Error reading inverter settings: ${error}`);
|
|
@@ -1763,6 +1780,7 @@ class SunspecModbusClient {
|
|
|
1763
1780
|
VArPct_Mod: vArPctModRaw,
|
|
1764
1781
|
VArPct_Ena: vArPctEnaRaw
|
|
1765
1782
|
};
|
|
1783
|
+
console.debug('[Model 123] Inverter Controls:', controls);
|
|
1766
1784
|
return controls;
|
|
1767
1785
|
}
|
|
1768
1786
|
catch (error) {
|
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.42';
|
|
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
|
@@ -560,6 +560,7 @@ export class SunspecModbusClient {
|
|
|
560
560
|
data.acEnergy = !this.isUnimplementedValue(acEnergy, 'acc32')
|
|
561
561
|
? acEnergy * Math.pow(10, scaleFactors.WH_SF)
|
|
562
562
|
: undefined;
|
|
563
|
+
console.debug('[Model 103] Inverter Data:', data);
|
|
563
564
|
return data;
|
|
564
565
|
}
|
|
565
566
|
catch (error) {
|
|
@@ -602,7 +603,7 @@ export class SunspecModbusClient {
|
|
|
602
603
|
const dcPowerRaw = this.extractValue(buffer, 20, 'int16');
|
|
603
604
|
const stateRaw = this.extractValue(buffer, 24, 'uint16');
|
|
604
605
|
this.logRegisterRead(101, 24, 'Operating State', stateRaw, 'enum16');
|
|
605
|
-
|
|
606
|
+
const data = {
|
|
606
607
|
blockNumber: 101,
|
|
607
608
|
voltageAN: this.applyScaleFactor(voltageRaw, scaleFactors.V_SF, 'uint16', 'Voltage AN', 7, 101),
|
|
608
609
|
acCurrent: this.applyScaleFactor(acCurrentRaw, scaleFactors.A_SF, 'uint16', 'AC Current', 2, 101),
|
|
@@ -613,6 +614,8 @@ export class SunspecModbusClient {
|
|
|
613
614
|
dcPower: this.applyScaleFactor(dcPowerRaw, scaleFactors.DCW_SF, 'int16', 'DC Power', 20, 101),
|
|
614
615
|
operatingState: stateRaw
|
|
615
616
|
};
|
|
617
|
+
console.debug('[Model 101] Single Phase Inverter Data:', data);
|
|
618
|
+
return data;
|
|
616
619
|
}
|
|
617
620
|
catch (error) {
|
|
618
621
|
console.error(`Error reading single phase inverter data: ${error}`);
|
|
@@ -664,26 +667,26 @@ export class SunspecModbusClient {
|
|
|
664
667
|
// Log the raw and scaled values
|
|
665
668
|
if (offset !== undefined && modelId !== undefined && fieldName) {
|
|
666
669
|
const hex = value >= 0 ? value.toString(16).toUpperCase() : (value >>> 0).toString(16).toUpperCase();
|
|
667
|
-
console.
|
|
670
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} raw=${value} (0x${hex}), SF=${scaleFactor}, scaled=${scaledValue}`);
|
|
668
671
|
}
|
|
669
672
|
else {
|
|
670
673
|
const fieldPrefix = fieldName ? `${fieldName}: ` : '';
|
|
671
|
-
console.
|
|
674
|
+
console.debug(`Scale Factor Applied - ${fieldPrefix}raw=${value} (decimal), SF=${scaleFactor}, scaled=${scaledValue}`);
|
|
672
675
|
}
|
|
673
676
|
return scaledValue;
|
|
674
677
|
}
|
|
675
678
|
logRegisterRead(modelId, offset, fieldName, rawValue, dataType) {
|
|
676
679
|
const typeInfo = dataType ? ` (${dataType})` : '';
|
|
677
680
|
if (rawValue === undefined) {
|
|
678
|
-
console.
|
|
681
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = -${typeInfo}`);
|
|
679
682
|
return;
|
|
680
683
|
}
|
|
681
684
|
if (typeof rawValue === 'number') {
|
|
682
685
|
const hex = rawValue >= 0 ? rawValue.toString(16).toUpperCase() : (rawValue >>> 0).toString(16).toUpperCase();
|
|
683
|
-
console.
|
|
686
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = ${rawValue} (0x${hex})${typeInfo}`);
|
|
684
687
|
}
|
|
685
688
|
else {
|
|
686
|
-
console.
|
|
689
|
+
console.debug(`[Model ${modelId}] offset ${offset}: ${fieldName} = "${rawValue}"${typeInfo}`);
|
|
687
690
|
}
|
|
688
691
|
}
|
|
689
692
|
/**
|
|
@@ -758,7 +761,7 @@ export class SunspecModbusClient {
|
|
|
758
761
|
const timestampRaw = this.extractValue(buffer, moduleOffset + 14, 'uint32', 2);
|
|
759
762
|
this.logRegisterRead(160, 14, `MPPT ${moduleId} Timestamp`, timestampRaw, 'uint32');
|
|
760
763
|
this.logRegisterRead(160, 17, `MPPT ${moduleId} Operating State`, dcst, 'enum16');
|
|
761
|
-
|
|
764
|
+
const data = {
|
|
762
765
|
blockNumber: 160,
|
|
763
766
|
blockAddress: model.address,
|
|
764
767
|
blockLength: model.length,
|
|
@@ -779,6 +782,8 @@ export class SunspecModbusClient {
|
|
|
779
782
|
temperatureSF: temperatureScaleFactor,
|
|
780
783
|
operatingState: dcst,
|
|
781
784
|
};
|
|
785
|
+
console.debug(`[Model 160] MPPT Module ${moduleId} Data:`, data);
|
|
786
|
+
return data;
|
|
782
787
|
}
|
|
783
788
|
/**
|
|
784
789
|
* Read MPPT data from Model 160
|
|
@@ -1100,6 +1105,7 @@ export class SunspecModbusClient {
|
|
|
1100
1105
|
setOp: !this.isUnimplementedValue(setOpRaw, 'enum16') ? setOpRaw : undefined,
|
|
1101
1106
|
setInvState: !this.isUnimplementedValue(setInvStateRaw, 'enum16') ? setInvStateRaw : undefined,
|
|
1102
1107
|
};
|
|
1108
|
+
console.debug('[Model 802] Battery Base Data:', data);
|
|
1103
1109
|
return data;
|
|
1104
1110
|
}
|
|
1105
1111
|
catch (error) {
|
|
@@ -1225,6 +1231,7 @@ export class SunspecModbusClient {
|
|
|
1225
1231
|
data.dischargePower = Math.abs((data.outWRte / 100) * data.wChaMax);
|
|
1226
1232
|
console.log(`Calculated Discharge Power (inWRte: ${data.outWRte}, wChaMax: ${data.wChaMax}): ${data.dischargePower?.toFixed(2)} W`);
|
|
1227
1233
|
}
|
|
1234
|
+
console.debug('[Model 124] Battery Data:', data);
|
|
1228
1235
|
return data;
|
|
1229
1236
|
}
|
|
1230
1237
|
else if (model.id === 802) {
|
|
@@ -1247,7 +1254,7 @@ export class SunspecModbusClient {
|
|
|
1247
1254
|
dischargePower = Math.abs(baseData.w);
|
|
1248
1255
|
}
|
|
1249
1256
|
}
|
|
1250
|
-
|
|
1257
|
+
const result = {
|
|
1251
1258
|
blockNumber: 802,
|
|
1252
1259
|
blockAddress: model.address,
|
|
1253
1260
|
blockLength: model.length,
|
|
@@ -1261,6 +1268,8 @@ export class SunspecModbusClient {
|
|
|
1261
1268
|
chargePower,
|
|
1262
1269
|
dischargePower,
|
|
1263
1270
|
};
|
|
1271
|
+
console.debug('[Model 802] Battery Data:', result);
|
|
1272
|
+
return result;
|
|
1264
1273
|
}
|
|
1265
1274
|
else {
|
|
1266
1275
|
// Handle other battery models (803) if needed
|
|
@@ -1408,7 +1417,7 @@ export class SunspecModbusClient {
|
|
|
1408
1417
|
this.logRegisterRead(124, 5, 'storCtlMod', storCtlModRaw, 'bitfield16');
|
|
1409
1418
|
this.logRegisterRead(124, 17, 'chaGriSet', chaGriSetRaw, 'enum16');
|
|
1410
1419
|
// Apply scale factors and return control settings
|
|
1411
|
-
|
|
1420
|
+
const controls = {
|
|
1412
1421
|
storCtlMod: !this.isUnimplementedValue(storCtlModRaw, 'bitfield16') ? storCtlModRaw : undefined,
|
|
1413
1422
|
chaGriSet: !this.isUnimplementedValue(chaGriSetRaw, 'enum16') ? chaGriSetRaw : undefined,
|
|
1414
1423
|
wChaMax: this.applyScaleFactor(wChaMaxRaw, scaleFactors.WChaMax_SF, 'uint16', 'Max Charge Power', 2, 124),
|
|
@@ -1416,6 +1425,8 @@ export class SunspecModbusClient {
|
|
|
1416
1425
|
outWRte: this.applyScaleFactor(outWRteRaw, scaleFactors.InOutWRte_SF, 'int16', 'Discharge Rate', 12, 124),
|
|
1417
1426
|
minRsvPct: this.applyScaleFactor(minRsvPctRaw, scaleFactors.MinRsvPct_SF, 'uint16', 'Min Reserve Percent', 7, 124)
|
|
1418
1427
|
};
|
|
1428
|
+
console.debug('[Model 124] Battery Controls:', controls);
|
|
1429
|
+
return controls;
|
|
1419
1430
|
}
|
|
1420
1431
|
catch (error) {
|
|
1421
1432
|
console.error(`Error reading battery controls: ${error}`);
|
|
@@ -1501,13 +1512,15 @@ export class SunspecModbusClient {
|
|
|
1501
1512
|
const frequency = this.applyScaleFactor(freqRaw, freqSF, 'uint16', 'Frequency', freqOffset, model.id);
|
|
1502
1513
|
const exportedEnergy = this.applyScaleFactor(exportRaw, energySF, "acc32", 'Exported Energy', exportOffset, model.id);
|
|
1503
1514
|
const importedEnergy = this.applyScaleFactor(importRaw, energySF, "acc32", 'Imported Energy', importOffset, model.id);
|
|
1504
|
-
|
|
1515
|
+
const data = {
|
|
1505
1516
|
blockNumber: model.id,
|
|
1506
1517
|
totalPower,
|
|
1507
1518
|
frequency,
|
|
1508
1519
|
exportedEnergy,
|
|
1509
1520
|
importedEnergy
|
|
1510
1521
|
};
|
|
1522
|
+
console.debug(`[Model ${model.id}] Meter Data:`, data);
|
|
1523
|
+
return data;
|
|
1511
1524
|
}
|
|
1512
1525
|
catch (error) {
|
|
1513
1526
|
console.error(`Error reading meter data: ${error}`);
|
|
@@ -1544,7 +1557,7 @@ export class SunspecModbusClient {
|
|
|
1544
1557
|
this.logRegisterRead(1, 48, 'Serial Number', serialNumber, 'string');
|
|
1545
1558
|
const deviceAddress = this.extractValue(buffer, 66, 'uint16');
|
|
1546
1559
|
this.logRegisterRead(1, 64, 'Device Address', deviceAddress, 'uint16');
|
|
1547
|
-
|
|
1560
|
+
const data = {
|
|
1548
1561
|
manufacturer,
|
|
1549
1562
|
model: modelName,
|
|
1550
1563
|
options,
|
|
@@ -1552,6 +1565,8 @@ export class SunspecModbusClient {
|
|
|
1552
1565
|
serialNumber,
|
|
1553
1566
|
deviceAddress
|
|
1554
1567
|
};
|
|
1568
|
+
console.debug('[Model 1] Common Block:', data);
|
|
1569
|
+
return data;
|
|
1555
1570
|
}
|
|
1556
1571
|
catch (error) {
|
|
1557
1572
|
console.error(`Error reading common block: ${error}`);
|
|
@@ -1625,7 +1640,7 @@ export class SunspecModbusClient {
|
|
|
1625
1640
|
this.logRegisterRead(121, 17, 'VArAct', vArActRaw, 'enum16');
|
|
1626
1641
|
this.logRegisterRead(121, 18, 'ClcTotVA', clcTotVARaw, 'enum16');
|
|
1627
1642
|
this.logRegisterRead(121, 21, 'ConnPh', connPhRaw, 'enum16');
|
|
1628
|
-
|
|
1643
|
+
const settings = {
|
|
1629
1644
|
blockNumber: 121,
|
|
1630
1645
|
blockAddress: model.address,
|
|
1631
1646
|
blockLength: model.length,
|
|
@@ -1667,6 +1682,8 @@ export class SunspecModbusClient {
|
|
|
1667
1682
|
ECPNomHz_SF: scaleFactors.ECPNomHz_SF,
|
|
1668
1683
|
ConnPh: connPhRaw
|
|
1669
1684
|
};
|
|
1685
|
+
console.debug('[Model 121] Inverter Settings:', settings);
|
|
1686
|
+
return settings;
|
|
1670
1687
|
}
|
|
1671
1688
|
catch (error) {
|
|
1672
1689
|
console.error(`Error reading inverter settings: ${error}`);
|
|
@@ -1760,6 +1777,7 @@ export class SunspecModbusClient {
|
|
|
1760
1777
|
VArPct_Mod: vArPctModRaw,
|
|
1761
1778
|
VArPct_Ena: vArPctEnaRaw
|
|
1762
1779
|
};
|
|
1780
|
+
console.debug('[Model 123] Inverter Controls:', controls);
|
|
1763
1781
|
return controls;
|
|
1764
1782
|
}
|
|
1765
1783
|
catch (error) {
|
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.42",
|
|
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.85"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"node": "22.17.0"
|