@amigo9090/ih-libiec61850-node 1.0.33 → 1.0.35

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.
@@ -33,9 +33,11 @@ const client = new MmsClient((event, data) => {
33
33
  if (data.timestamp) {
34
34
  console.log(` Timestamp: ${data.timestamp}`);
35
35
  }
36
- data.values.forEach((value, index) => {
37
- if (data.reasonsForInclusion[index] !== 0) {
38
- console.log(` Value[${index}]: ${util.inspect(value, { depth: null })}, Reason: ${data.reasonsForInclusion[index]}`);
36
+ // data.values - это объект, а не массив
37
+ Object.entries(data.values).forEach(([ref, value], index) => {
38
+ const reason = data.reasons[ref];
39
+ if (reason && reason !== 0) {
40
+ console.log(` ${ref}: ${util.inspect(value, { depth: null })}, Reason: ${reason}`);
39
41
  }
40
42
  });
41
43
  } else if (data.event === 'batchData') {
@@ -145,6 +147,12 @@ async function handleConnectionOpened() {
145
147
  console.log(`Enabling reporting for ${rcbRef} with dataset ${dataSetRef}`);
146
148
  await client.enableReporting(rcbRef, dataSetRef);
147
149
 
150
+ // Включение отчётности2
151
+ const rcbRef2 = 'WAGO61850ServerDevice/LLN0.RP.ReportBlock0201';
152
+ const dataSetRef2 = 'WAGO61850ServerDevice/LLN0.DataSet02';
153
+ console.log(`Enabling reporting for ${rcbRef2} with dataset ${dataSetRef2}`);
154
+ await client.enableReporting(rcbRef2, dataSetRef2);
155
+
148
156
  } catch (err) {
149
157
  console.error('Error in handleConnectionOpened:', err.message);
150
158
  }
@@ -178,6 +186,11 @@ async function main() {
178
186
  console.log(`Disabling reporting for ${rcbRef}`);
179
187
  await client.disableReporting(rcbRef);
180
188
 
189
+ // Отключение отчётов2
190
+ const rcbRef2 = 'WAGO61850ServerDevice/LLN0.RP.ReportBlock0102';
191
+ console.log(`Disabling reporting for ${rcbRef2}`);
192
+ await client.disableReporting(rcbRef2);
193
+
181
194
  console.log('Client status:', client.getStatus());
182
195
  console.log('Closing client...');
183
196
  await client.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amigo9090/ih-libiec61850-node",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "Node.js addon for IEC 61850 client (MMS, GOOSE) using libiec61850",
5
5
  "main": "index.js",
6
6
  "keywords": [