@enyo-energy/sunspec-sdk 0.0.39 → 0.0.41
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 +626 -1
- package/dist/cjs/sunspec-modbus-client.cjs +418 -376
- package/dist/cjs/sunspec-modbus-client.d.cts +25 -4
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/sunspec-modbus-client.d.ts +25 -4
- package/dist/sunspec-modbus-client.js +418 -376
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -105,6 +105,19 @@ export declare class SunspecModbusClient {
|
|
|
105
105
|
* Helper to clean string values by removing null characters
|
|
106
106
|
*/
|
|
107
107
|
private cleanString;
|
|
108
|
+
/**
|
|
109
|
+
* Read an entire model's register block in a single Modbus call.
|
|
110
|
+
* Returns a Buffer containing all registers for the model.
|
|
111
|
+
*/
|
|
112
|
+
private readModelBlock;
|
|
113
|
+
/**
|
|
114
|
+
* Extract a typed value from a model block buffer at a given register offset.
|
|
115
|
+
* @param buffer - The buffer returned by readModelBlock
|
|
116
|
+
* @param offset - Register offset within the model (0-based)
|
|
117
|
+
* @param dataType - The data type to convert to
|
|
118
|
+
* @param quantity - Number of registers to read (default: auto from dataType for strings, 1 otherwise)
|
|
119
|
+
*/
|
|
120
|
+
private extractValue;
|
|
108
121
|
/**
|
|
109
122
|
* Helper to read register value(s) using the fault-tolerant reader with data type conversion
|
|
110
123
|
*/
|
|
@@ -122,9 +135,9 @@ export declare class SunspecModbusClient {
|
|
|
122
135
|
*/
|
|
123
136
|
private readSinglePhaseInverterData;
|
|
124
137
|
/**
|
|
125
|
-
*
|
|
138
|
+
* Extract inverter scale factors from a pre-read model buffer
|
|
126
139
|
*/
|
|
127
|
-
private
|
|
140
|
+
private extractInverterScaleFactors;
|
|
128
141
|
/**
|
|
129
142
|
* Apply scale factor to a value
|
|
130
143
|
* Returns undefined if the value is unimplemented or scale factor is out of range
|
|
@@ -142,12 +155,20 @@ export declare class SunspecModbusClient {
|
|
|
142
155
|
*
|
|
143
156
|
* @returns Object containing all scale factors or null if model not found
|
|
144
157
|
*/
|
|
158
|
+
/**
|
|
159
|
+
* Extract MPPT scale factors from a pre-read model buffer
|
|
160
|
+
*/
|
|
161
|
+
private extractMPPTScaleFactors;
|
|
145
162
|
readMPPTScaleFactors(): Promise<{
|
|
146
163
|
DCA_SF: number;
|
|
147
164
|
DCV_SF: number;
|
|
148
165
|
DCW_SF: number;
|
|
149
166
|
DCWH_SF: number;
|
|
150
167
|
} | null>;
|
|
168
|
+
/**
|
|
169
|
+
* Extract MPPT module data from a pre-read model buffer
|
|
170
|
+
*/
|
|
171
|
+
private extractMPPTModuleData;
|
|
151
172
|
/**
|
|
152
173
|
* Read MPPT data from Model 160
|
|
153
174
|
*/
|
|
@@ -171,9 +192,9 @@ export declare class SunspecModbusClient {
|
|
|
171
192
|
*/
|
|
172
193
|
private mapBatteryBankState;
|
|
173
194
|
/**
|
|
174
|
-
*
|
|
195
|
+
* Extract Model 802 scale factors from a pre-read buffer (offsets 52-63)
|
|
175
196
|
*/
|
|
176
|
-
private
|
|
197
|
+
private extractBatteryBaseScaleFactors;
|
|
177
198
|
/**
|
|
178
199
|
* Read battery base data from Model 802 (Battery Base)
|
|
179
200
|
*/
|
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.41';
|
|
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
|
@@ -105,6 +105,19 @@ export declare class SunspecModbusClient {
|
|
|
105
105
|
* Helper to clean string values by removing null characters
|
|
106
106
|
*/
|
|
107
107
|
private cleanString;
|
|
108
|
+
/**
|
|
109
|
+
* Read an entire model's register block in a single Modbus call.
|
|
110
|
+
* Returns a Buffer containing all registers for the model.
|
|
111
|
+
*/
|
|
112
|
+
private readModelBlock;
|
|
113
|
+
/**
|
|
114
|
+
* Extract a typed value from a model block buffer at a given register offset.
|
|
115
|
+
* @param buffer - The buffer returned by readModelBlock
|
|
116
|
+
* @param offset - Register offset within the model (0-based)
|
|
117
|
+
* @param dataType - The data type to convert to
|
|
118
|
+
* @param quantity - Number of registers to read (default: auto from dataType for strings, 1 otherwise)
|
|
119
|
+
*/
|
|
120
|
+
private extractValue;
|
|
108
121
|
/**
|
|
109
122
|
* Helper to read register value(s) using the fault-tolerant reader with data type conversion
|
|
110
123
|
*/
|
|
@@ -122,9 +135,9 @@ export declare class SunspecModbusClient {
|
|
|
122
135
|
*/
|
|
123
136
|
private readSinglePhaseInverterData;
|
|
124
137
|
/**
|
|
125
|
-
*
|
|
138
|
+
* Extract inverter scale factors from a pre-read model buffer
|
|
126
139
|
*/
|
|
127
|
-
private
|
|
140
|
+
private extractInverterScaleFactors;
|
|
128
141
|
/**
|
|
129
142
|
* Apply scale factor to a value
|
|
130
143
|
* Returns undefined if the value is unimplemented or scale factor is out of range
|
|
@@ -142,12 +155,20 @@ export declare class SunspecModbusClient {
|
|
|
142
155
|
*
|
|
143
156
|
* @returns Object containing all scale factors or null if model not found
|
|
144
157
|
*/
|
|
158
|
+
/**
|
|
159
|
+
* Extract MPPT scale factors from a pre-read model buffer
|
|
160
|
+
*/
|
|
161
|
+
private extractMPPTScaleFactors;
|
|
145
162
|
readMPPTScaleFactors(): Promise<{
|
|
146
163
|
DCA_SF: number;
|
|
147
164
|
DCV_SF: number;
|
|
148
165
|
DCW_SF: number;
|
|
149
166
|
DCWH_SF: number;
|
|
150
167
|
} | null>;
|
|
168
|
+
/**
|
|
169
|
+
* Extract MPPT module data from a pre-read model buffer
|
|
170
|
+
*/
|
|
171
|
+
private extractMPPTModuleData;
|
|
151
172
|
/**
|
|
152
173
|
* Read MPPT data from Model 160
|
|
153
174
|
*/
|
|
@@ -171,9 +192,9 @@ export declare class SunspecModbusClient {
|
|
|
171
192
|
*/
|
|
172
193
|
private mapBatteryBankState;
|
|
173
194
|
/**
|
|
174
|
-
*
|
|
195
|
+
* Extract Model 802 scale factors from a pre-read buffer (offsets 52-63)
|
|
175
196
|
*/
|
|
176
|
-
private
|
|
197
|
+
private extractBatteryBaseScaleFactors;
|
|
177
198
|
/**
|
|
178
199
|
* Read battery base data from Model 802 (Battery Base)
|
|
179
200
|
*/
|