@enyo-energy/sunspec-sdk 0.0.65 → 0.0.66
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.
|
@@ -476,10 +476,21 @@ class SunspecModbusClient {
|
|
|
476
476
|
const maxAddress = 50000; // Safety limit
|
|
477
477
|
let currentAddress = 0;
|
|
478
478
|
console.log(`Starting Sunspec model discovery for unit ${unitId}...`);
|
|
479
|
+
// Probe for the SunS identifier first. A missing identifier means the unit ID isn't a
|
|
480
|
+
// SunSpec device — common during unit-ID scans — and is logged at debug level so probes
|
|
481
|
+
// don't surface as errors. Mid-scan failures below remain at error level since they
|
|
482
|
+
// indicate a partial / malformed SunSpec map.
|
|
483
|
+
let addressInfo;
|
|
484
|
+
try {
|
|
485
|
+
addressInfo = await this.detectSunspecBaseAddress(unitId, customBaseAddress);
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
console.debug(`No SunSpec device at unit ${unitId}: ${error}`);
|
|
489
|
+
console.log(`Discovery complete for unit ${unitId}. Found 0 models: []`);
|
|
490
|
+
return models;
|
|
491
|
+
}
|
|
492
|
+
currentAddress = addressInfo.nextAddress;
|
|
479
493
|
try {
|
|
480
|
-
// Detect the base address and addressing mode
|
|
481
|
-
const addressInfo = await this.detectSunspecBaseAddress(unitId, customBaseAddress);
|
|
482
|
-
currentAddress = addressInfo.nextAddress;
|
|
483
494
|
while (currentAddress < maxAddress) {
|
|
484
495
|
const buffer = await instance.readHoldingRegisters(currentAddress, 2);
|
|
485
496
|
const modelData = [buffer.readUInt16BE(0), buffer.readUInt16BE(2)];
|
|
@@ -1961,7 +1972,9 @@ class SunspecModbusClient {
|
|
|
1961
1972
|
async readCommonBlock(unitId) {
|
|
1962
1973
|
const model = this.findModel(unitId, sunspec_interfaces_js_1.SunspecModelId.Common);
|
|
1963
1974
|
if (!model) {
|
|
1964
|
-
|
|
1975
|
+
// Common (model 1) is the SunSpec discovery anchor — its absence simply means this
|
|
1976
|
+
// unit isn't SunSpec. Callers iterating unit IDs already check the null return.
|
|
1977
|
+
console.debug(`Common block model not found on unit ${unitId}`);
|
|
1965
1978
|
return null;
|
|
1966
1979
|
}
|
|
1967
1980
|
console.log(`Reading Common Block - Model address: ${model.address} (unit ${unitId})`);
|
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.66';
|
|
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
|
@@ -471,10 +471,21 @@ export class SunspecModbusClient {
|
|
|
471
471
|
const maxAddress = 50000; // Safety limit
|
|
472
472
|
let currentAddress = 0;
|
|
473
473
|
console.log(`Starting Sunspec model discovery for unit ${unitId}...`);
|
|
474
|
+
// Probe for the SunS identifier first. A missing identifier means the unit ID isn't a
|
|
475
|
+
// SunSpec device — common during unit-ID scans — and is logged at debug level so probes
|
|
476
|
+
// don't surface as errors. Mid-scan failures below remain at error level since they
|
|
477
|
+
// indicate a partial / malformed SunSpec map.
|
|
478
|
+
let addressInfo;
|
|
479
|
+
try {
|
|
480
|
+
addressInfo = await this.detectSunspecBaseAddress(unitId, customBaseAddress);
|
|
481
|
+
}
|
|
482
|
+
catch (error) {
|
|
483
|
+
console.debug(`No SunSpec device at unit ${unitId}: ${error}`);
|
|
484
|
+
console.log(`Discovery complete for unit ${unitId}. Found 0 models: []`);
|
|
485
|
+
return models;
|
|
486
|
+
}
|
|
487
|
+
currentAddress = addressInfo.nextAddress;
|
|
474
488
|
try {
|
|
475
|
-
// Detect the base address and addressing mode
|
|
476
|
-
const addressInfo = await this.detectSunspecBaseAddress(unitId, customBaseAddress);
|
|
477
|
-
currentAddress = addressInfo.nextAddress;
|
|
478
489
|
while (currentAddress < maxAddress) {
|
|
479
490
|
const buffer = await instance.readHoldingRegisters(currentAddress, 2);
|
|
480
491
|
const modelData = [buffer.readUInt16BE(0), buffer.readUInt16BE(2)];
|
|
@@ -1956,7 +1967,9 @@ export class SunspecModbusClient {
|
|
|
1956
1967
|
async readCommonBlock(unitId) {
|
|
1957
1968
|
const model = this.findModel(unitId, SunspecModelId.Common);
|
|
1958
1969
|
if (!model) {
|
|
1959
|
-
|
|
1970
|
+
// Common (model 1) is the SunSpec discovery anchor — its absence simply means this
|
|
1971
|
+
// unit isn't SunSpec. Callers iterating unit IDs already check the null return.
|
|
1972
|
+
console.debug(`Common block model not found on unit ${unitId}`);
|
|
1960
1973
|
return null;
|
|
1961
1974
|
}
|
|
1962
1975
|
console.log(`Reading Common Block - Model address: ${model.address} (unit ${unitId})`);
|
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.66",
|
|
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.131"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"node": "22.17.0"
|