@enyo-energy/sunspec-sdk 0.0.13 → 0.0.15
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.
|
@@ -255,6 +255,7 @@ class SunspecModbusClient {
|
|
|
255
255
|
const buffer = result.value;
|
|
256
256
|
this.connectionHealth.recordSuccess();
|
|
257
257
|
const value = this.modbusDataTypeConverter.convertFromBuffer(buffer, dataType, undefined, quantity);
|
|
258
|
+
console.log(`Reading Holding Register ${address} (${dataType}) with value '${value}'`);
|
|
258
259
|
if (dataType === 'string') {
|
|
259
260
|
return this.cleanString(value);
|
|
260
261
|
}
|
|
@@ -308,7 +309,7 @@ class SunspecModbusClient {
|
|
|
308
309
|
return this.readSinglePhaseInverterData(singlePhaseModel);
|
|
309
310
|
}
|
|
310
311
|
console.log(`Found 3-phase inverter model 103 at address ${model.address} with length ${model.length}`);
|
|
311
|
-
const baseAddr = model.address
|
|
312
|
+
const baseAddr = model.address;
|
|
312
313
|
try {
|
|
313
314
|
// Read all scale factors first using fault-tolerant reader
|
|
314
315
|
console.log(`Reading Inverter Data from Model ${model.id} at base address: ${baseAddr}`);
|
|
@@ -420,7 +421,7 @@ class SunspecModbusClient {
|
|
|
420
421
|
async readSinglePhaseInverterData(model) {
|
|
421
422
|
// Similar to 3-phase but with fewer phase-specific values
|
|
422
423
|
// Implementation would be similar but simplified
|
|
423
|
-
const baseAddr = model.address
|
|
424
|
+
const baseAddr = model.address;
|
|
424
425
|
try {
|
|
425
426
|
console.log(`Reading Single-Phase Inverter Data from Model 101 at base address: ${baseAddr}`);
|
|
426
427
|
// Read scale factors for single phase model
|
|
@@ -521,7 +522,7 @@ class SunspecModbusClient {
|
|
|
521
522
|
console.log('MPPT model 160 not found');
|
|
522
523
|
return null;
|
|
523
524
|
}
|
|
524
|
-
const baseAddr = model.address
|
|
525
|
+
const baseAddr = model.address;
|
|
525
526
|
try {
|
|
526
527
|
// MPPT modules are repeating blocks, calculate offset for specific module
|
|
527
528
|
const moduleSize = 26; // Size of each MPPT module based on CSV (offsets 0-25)
|
|
@@ -637,7 +638,7 @@ class SunspecModbusClient {
|
|
|
637
638
|
console.log('No meter model found');
|
|
638
639
|
return null;
|
|
639
640
|
}
|
|
640
|
-
const baseAddr = model.address
|
|
641
|
+
const baseAddr = model.address;
|
|
641
642
|
console.log(`Reading Meter Data from Model ${model.id} at base address: ${baseAddr}`);
|
|
642
643
|
try {
|
|
643
644
|
// Different meter models have different register offsets
|
|
@@ -821,7 +822,7 @@ class SunspecModbusClient {
|
|
|
821
822
|
console.log('Settings model 121 not found');
|
|
822
823
|
return null;
|
|
823
824
|
}
|
|
824
|
-
const baseAddr = model.address
|
|
825
|
+
const baseAddr = model.address;
|
|
825
826
|
try {
|
|
826
827
|
// Read scale factors first (offsets 22-31)
|
|
827
828
|
const scaleFactors = {
|
|
@@ -894,7 +895,7 @@ class SunspecModbusClient {
|
|
|
894
895
|
console.log('Controls model 123 not found');
|
|
895
896
|
return null;
|
|
896
897
|
}
|
|
897
|
-
const baseAddr = model.address
|
|
898
|
+
const baseAddr = model.address;
|
|
898
899
|
try {
|
|
899
900
|
// Read scale factors first (offsets 21-23)
|
|
900
901
|
const scaleFactors = {
|
|
@@ -951,7 +952,7 @@ class SunspecModbusClient {
|
|
|
951
952
|
console.error('Settings model 121 not found');
|
|
952
953
|
return false;
|
|
953
954
|
}
|
|
954
|
-
const baseAddr = model.address
|
|
955
|
+
const baseAddr = model.address;
|
|
955
956
|
try {
|
|
956
957
|
// For each setting, write the value if provided
|
|
957
958
|
// Note: This is a simplified implementation. In production, you'd batch writes
|
|
@@ -988,7 +989,7 @@ class SunspecModbusClient {
|
|
|
988
989
|
console.error('Controls model 123 not found');
|
|
989
990
|
return false;
|
|
990
991
|
}
|
|
991
|
-
const baseAddr = model.address
|
|
992
|
+
const baseAddr = model.address;
|
|
992
993
|
try {
|
|
993
994
|
// Connection control
|
|
994
995
|
if (controls.Conn !== undefined && this.modbusClient) {
|
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.15';
|
|
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
|
@@ -252,6 +252,7 @@ export class SunspecModbusClient {
|
|
|
252
252
|
const buffer = result.value;
|
|
253
253
|
this.connectionHealth.recordSuccess();
|
|
254
254
|
const value = this.modbusDataTypeConverter.convertFromBuffer(buffer, dataType, undefined, quantity);
|
|
255
|
+
console.log(`Reading Holding Register ${address} (${dataType}) with value '${value}'`);
|
|
255
256
|
if (dataType === 'string') {
|
|
256
257
|
return this.cleanString(value);
|
|
257
258
|
}
|
|
@@ -305,7 +306,7 @@ export class SunspecModbusClient {
|
|
|
305
306
|
return this.readSinglePhaseInverterData(singlePhaseModel);
|
|
306
307
|
}
|
|
307
308
|
console.log(`Found 3-phase inverter model 103 at address ${model.address} with length ${model.length}`);
|
|
308
|
-
const baseAddr = model.address
|
|
309
|
+
const baseAddr = model.address;
|
|
309
310
|
try {
|
|
310
311
|
// Read all scale factors first using fault-tolerant reader
|
|
311
312
|
console.log(`Reading Inverter Data from Model ${model.id} at base address: ${baseAddr}`);
|
|
@@ -417,7 +418,7 @@ export class SunspecModbusClient {
|
|
|
417
418
|
async readSinglePhaseInverterData(model) {
|
|
418
419
|
// Similar to 3-phase but with fewer phase-specific values
|
|
419
420
|
// Implementation would be similar but simplified
|
|
420
|
-
const baseAddr = model.address
|
|
421
|
+
const baseAddr = model.address;
|
|
421
422
|
try {
|
|
422
423
|
console.log(`Reading Single-Phase Inverter Data from Model 101 at base address: ${baseAddr}`);
|
|
423
424
|
// Read scale factors for single phase model
|
|
@@ -518,7 +519,7 @@ export class SunspecModbusClient {
|
|
|
518
519
|
console.log('MPPT model 160 not found');
|
|
519
520
|
return null;
|
|
520
521
|
}
|
|
521
|
-
const baseAddr = model.address
|
|
522
|
+
const baseAddr = model.address;
|
|
522
523
|
try {
|
|
523
524
|
// MPPT modules are repeating blocks, calculate offset for specific module
|
|
524
525
|
const moduleSize = 26; // Size of each MPPT module based on CSV (offsets 0-25)
|
|
@@ -634,7 +635,7 @@ export class SunspecModbusClient {
|
|
|
634
635
|
console.log('No meter model found');
|
|
635
636
|
return null;
|
|
636
637
|
}
|
|
637
|
-
const baseAddr = model.address
|
|
638
|
+
const baseAddr = model.address;
|
|
638
639
|
console.log(`Reading Meter Data from Model ${model.id} at base address: ${baseAddr}`);
|
|
639
640
|
try {
|
|
640
641
|
// Different meter models have different register offsets
|
|
@@ -818,7 +819,7 @@ export class SunspecModbusClient {
|
|
|
818
819
|
console.log('Settings model 121 not found');
|
|
819
820
|
return null;
|
|
820
821
|
}
|
|
821
|
-
const baseAddr = model.address
|
|
822
|
+
const baseAddr = model.address;
|
|
822
823
|
try {
|
|
823
824
|
// Read scale factors first (offsets 22-31)
|
|
824
825
|
const scaleFactors = {
|
|
@@ -891,7 +892,7 @@ export class SunspecModbusClient {
|
|
|
891
892
|
console.log('Controls model 123 not found');
|
|
892
893
|
return null;
|
|
893
894
|
}
|
|
894
|
-
const baseAddr = model.address
|
|
895
|
+
const baseAddr = model.address;
|
|
895
896
|
try {
|
|
896
897
|
// Read scale factors first (offsets 21-23)
|
|
897
898
|
const scaleFactors = {
|
|
@@ -948,7 +949,7 @@ export class SunspecModbusClient {
|
|
|
948
949
|
console.error('Settings model 121 not found');
|
|
949
950
|
return false;
|
|
950
951
|
}
|
|
951
|
-
const baseAddr = model.address
|
|
952
|
+
const baseAddr = model.address;
|
|
952
953
|
try {
|
|
953
954
|
// For each setting, write the value if provided
|
|
954
955
|
// Note: This is a simplified implementation. In production, you'd batch writes
|
|
@@ -985,7 +986,7 @@ export class SunspecModbusClient {
|
|
|
985
986
|
console.error('Controls model 123 not found');
|
|
986
987
|
return false;
|
|
987
988
|
}
|
|
988
|
-
const baseAddr = model.address
|
|
989
|
+
const baseAddr = model.address;
|
|
989
990
|
try {
|
|
990
991
|
// Connection control
|
|
991
992
|
if (controls.Conn !== undefined && this.modbusClient) {
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED