@atelieruldetehnologii/node-red-custome-solutions 0.62.22
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/NOTICE +56 -0
- package/PROPRIETARY-LICENSE.txt +157 -0
- package/README.md +105 -0
- package/TERMS-AND-CONDITIONS.md +311 -0
- package/advantech-read/advantech-read.html +775 -0
- package/advantech-read/advantech-read.js +449 -0
- package/advantech-write/advantech-write.html +413 -0
- package/advantech-write/advantech-write.js +338 -0
- package/bess-control/bess-control.html +569 -0
- package/bess-control/bess-control.js +541 -0
- package/bess-control/lib/allocation.js +149 -0
- package/bess-control/lib/batteries.js +86 -0
- package/bess-control/lib/helpers.js +157 -0
- package/bess-control/lib/messages.js +131 -0
- package/bess-control/lib/runtime.js +156 -0
- package/carlo-gavazzi/carlo-gavazzi.html +4327 -0
- package/carlo-gavazzi/carlo-gavazzi.js +3081 -0
- package/control-export/control-export.html +3644 -0
- package/control-export/control-export.js +2192 -0
- package/control-reactive/control-reactive.html +3136 -0
- package/control-reactive/control-reactive.js +2124 -0
- package/fronius-emulator/README.md +258 -0
- package/fronius-emulator/fronius-emulator.html +170 -0
- package/fronius-emulator/fronius-emulator.js +520 -0
- package/fronius-emulator/lib/binary-codec.js +65 -0
- package/fronius-emulator/lib/fronius-register-map.js +185 -0
- package/fronius-emulator/lib/modbus-parser.js +61 -0
- package/fronius-emulator/lib/modbus-tcp-server.js +224 -0
- package/fronius-emulator/lib/validation.js +206 -0
- package/fronius-emulator/lib/virtual-meter.js +132 -0
- package/fronius-read/fronius-read.html +3944 -0
- package/fronius-read/fronius-read.js +1466 -0
- package/fronius-read/lib/inverter-profiles.js +711 -0
- package/fronius-read/lib/sunspec-core.js +303 -0
- package/fronius-read/lib/sunspec-model-parsers.js +845 -0
- package/fronius-write/fronius-write.html +1789 -0
- package/fronius-write/fronius-write.js +2531 -0
- package/influxdb/influxdb.html +1077 -0
- package/influxdb/influxdb.js +1487 -0
- package/janitza/janitza.html +2562 -0
- package/janitza/janitza.js +1500 -0
- package/janitza/lib/janitza-profiles.js +371 -0
- package/lib/a3-test-server.js +199 -0
- package/lib/adam-6000-profiles.js +173 -0
- package/lib/licensing/constants.js +103 -0
- package/lib/licensing/device-id.js +251 -0
- package/lib/licensing/errors.js +21 -0
- package/lib/licensing/license-client.js +377 -0
- package/lib/licensing/license-state.js +50 -0
- package/lib/licensing/node-guard.js +150 -0
- package/lib/licensing/package-integrity.js +167 -0
- package/lib/licensing/package-integrity.json +513 -0
- package/lib/licensing/public-key.pem +3 -0
- package/lib/licensing/public-key.pem.example +2 -0
- package/lib/licensing/public-keys.js +18 -0
- package/lib/licensing/storage.js +63 -0
- package/lib/licensing/token-verifier.js +84 -0
- package/lib/numbers.js +26 -0
- package/license/atelier-license.html +88 -0
- package/license/atelier-license.js +170 -0
- package/modbus-tcp-discover/modbus-tcp-discover.html +190 -0
- package/modbus-tcp-discover/modbus-tcp-discover.js +706 -0
- package/multi-battery/multi-battery.html +649 -0
- package/multi-battery/multi-battery.js +668 -0
- package/multi-grid/multi-grid.html +745 -0
- package/multi-grid/multi-grid.js +1392 -0
- package/multi-inverter/lib/engine-core.js +237 -0
- package/multi-inverter/multi-inverter.html +2674 -0
- package/multi-inverter/multi-inverter.js +1393 -0
- package/package.json +109 -0
- package/phoenix-contact/lib/eem-ma370-advanced.js +175 -0
- package/phoenix-contact/lib/eem-ma370.js +138 -0
- package/phoenix-contact/lib/integrations.js +149 -0
- package/phoenix-contact/lib/phoenix-contact-profile.js +35030 -0
- package/phoenix-contact/phoenix-contact.html +840 -0
- package/phoenix-contact/phoenix-contact.js +679 -0
- package/pv-generator/pv-generator.html +284 -0
- package/pv-generator/pv-generator.js +387 -0
- package/pylontech-read/pylontech-read.html +763 -0
- package/pylontech-read/pylontech-read.js +518 -0
- package/pylontech-write/pylontech-write.html +405 -0
- package/pylontech-write/pylontech-write.js +546 -0
- package/scada-aggregator/lib/aggregate.js +72 -0
- package/scada-aggregator/lib/groups.js +39 -0
- package/scada-aggregator/scada-aggregator.html +108 -0
- package/scada-aggregator/scada-aggregator.js +117 -0
- package/scada-server/lib/aggregator-map.js +58 -0
- package/scada-server/lib/encoding.js +235 -0
- package/scada-server/lib/modbus-server.js +492 -0
- package/scada-server/lib/object-path.js +18 -0
- package/scada-server/lib/register-map.js +288 -0
- package/scada-server/scada-server.html +1419 -0
- package/scada-server/scada-server.js +704 -0
- package/scripts/check-syntax.js +66 -0
- package/scripts/package-integrity.js +46 -0
- package/scripts/package-release.js +116 -0
- package/scripts/run-tests.js +2178 -0
- package/scripts/tgz-integrity.js +74 -0
- package/sma-read/lib/sunspec-core.js +83 -0
- package/sma-read/lib/sunspec-model-parsers.js +853 -0
- package/sma-read/sma-read.html +659 -0
- package/sma-read/sma-read.js +458 -0
- package/sma-write/sma-write.html +105 -0
- package/sma-write/sma-write.js +270 -0
- package/victron-read/lib/mqtt-state.js +176 -0
- package/victron-read/victron-read.html +1074 -0
- package/victron-read/victron-read.js +1222 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
const ModbusRTU = require("modbus-serial");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
|
|
6
|
+
buildSummary
|
|
7
|
+
|
|
8
|
+
} = require("./sunspec-model-parsers");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
|
|
13
|
+
detectInverterProfile
|
|
14
|
+
|
|
15
|
+
} = require("./inverter-profiles");
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
async function connectClient(client, host, port, unitId) {
|
|
19
|
+
|
|
20
|
+
if (!client.isOpen) {
|
|
21
|
+
|
|
22
|
+
await client.connectTCP(host, { port: Number(port || 502) });
|
|
23
|
+
|
|
24
|
+
client.setID(Number(unitId || 1));
|
|
25
|
+
|
|
26
|
+
client.setTimeout(2500);
|
|
27
|
+
|
|
28
|
+
return;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
client.setID(Number(unitId || 1));
|
|
34
|
+
|
|
35
|
+
client.setTimeout(2500);
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
async function createConnectedClient(host, port, unitId) {
|
|
41
|
+
|
|
42
|
+
const client = new ModbusRTU();
|
|
43
|
+
|
|
44
|
+
await connectClient(client, host, port, unitId);
|
|
45
|
+
|
|
46
|
+
return client;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async function closeClient(client) {
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
|
|
55
|
+
if (client && client.isOpen) {
|
|
56
|
+
|
|
57
|
+
await client.close();
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
} catch (e) {
|
|
62
|
+
|
|
63
|
+
// ignore
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
async function readHolding(client, addr, len) {
|
|
71
|
+
|
|
72
|
+
return client.readHoldingRegisters(addr, len);
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
async function readModelHeader(client, addr) {
|
|
78
|
+
|
|
79
|
+
const r = await readHolding(client, addr, 2);
|
|
80
|
+
|
|
81
|
+
return { id: r.data[0], len: r.data[1] };
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
async function findBase(client) {
|
|
87
|
+
|
|
88
|
+
const bases = [39999, 40000, 40001, 40002, 40199, 40200, 40201, 40202];
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
for (const b of bases) {
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
|
|
95
|
+
const r = await readHolding(client, b, 2);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
const txt =
|
|
99
|
+
|
|
100
|
+
String.fromCharCode((r.data[0] >> 8) & 0xff) +
|
|
101
|
+
|
|
102
|
+
String.fromCharCode(r.data[0] & 0xff) +
|
|
103
|
+
|
|
104
|
+
String.fromCharCode((r.data[1] >> 8) & 0xff) +
|
|
105
|
+
|
|
106
|
+
String.fromCharCode(r.data[1] & 0xff);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if (txt.includes("SunS")) {
|
|
110
|
+
|
|
111
|
+
return b;
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
} catch (e) {
|
|
116
|
+
|
|
117
|
+
// ignore
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
throw new Error("SunSpec not found");
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async function scanModelDescriptors(client, base) {
|
|
130
|
+
|
|
131
|
+
const descriptors = [];
|
|
132
|
+
|
|
133
|
+
let addr = base + 2;
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
while (true) {
|
|
137
|
+
|
|
138
|
+
const header = await readModelHeader(client, addr);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if (header.id === 0xFFFF) {
|
|
142
|
+
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
descriptors.push({
|
|
149
|
+
|
|
150
|
+
model_id: header.id,
|
|
151
|
+
|
|
152
|
+
addr: addr,
|
|
153
|
+
|
|
154
|
+
len: header.len
|
|
155
|
+
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
addr += 2 + header.len;
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
return descriptors;
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async function readModelByDescriptor(client, descriptor) {
|
|
170
|
+
|
|
171
|
+
const payloadRes = await readHolding(client, descriptor.addr + 2, descriptor.len);
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
|
|
176
|
+
model_id: descriptor.model_id,
|
|
177
|
+
|
|
178
|
+
addr: descriptor.addr,
|
|
179
|
+
|
|
180
|
+
len: descriptor.len,
|
|
181
|
+
|
|
182
|
+
raw: payloadRes.data
|
|
183
|
+
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
async function readModelsByDescriptors(client, descriptors) {
|
|
190
|
+
|
|
191
|
+
const models = [];
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
for (const descriptor of descriptors) {
|
|
195
|
+
|
|
196
|
+
models.push(await readModelByDescriptor(client, descriptor));
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
return models;
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
async function scanModels(client, base) {
|
|
207
|
+
|
|
208
|
+
const descriptors = await scanModelDescriptors(client, base);
|
|
209
|
+
|
|
210
|
+
return readModelsByDescriptors(client, descriptors);
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
async function probeInverterProfile(host, port, unitId) {
|
|
216
|
+
|
|
217
|
+
const client = await createConnectedClient(host, port, unitId);
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
|
|
222
|
+
const base = await findBase(client);
|
|
223
|
+
|
|
224
|
+
const models = await scanModels(client, base);
|
|
225
|
+
|
|
226
|
+
const summary = buildSummary(models);
|
|
227
|
+
|
|
228
|
+
const detection = detectInverterProfile(summary);
|
|
229
|
+
const deviceType = summary && summary.meter
|
|
230
|
+
? "smart_meter"
|
|
231
|
+
: (summary && (summary.ac || summary.dc) ? "inverter" : "unknown");
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
|
|
236
|
+
ok: true,
|
|
237
|
+
|
|
238
|
+
base: base,
|
|
239
|
+
|
|
240
|
+
device_type: deviceType,
|
|
241
|
+
|
|
242
|
+
manufacturer: summary && summary.common ? summary.common.manufacturer : null,
|
|
243
|
+
|
|
244
|
+
model: summary && summary.common ? summary.common.model : null,
|
|
245
|
+
|
|
246
|
+
options: summary && summary.common ? summary.common.options : null,
|
|
247
|
+
|
|
248
|
+
inverter_profile: detection.profile_key,
|
|
249
|
+
|
|
250
|
+
inverter_profile_label: detection.profile_label,
|
|
251
|
+
|
|
252
|
+
manufacturer_key: detection.manufacturer,
|
|
253
|
+
|
|
254
|
+
family: detection.family,
|
|
255
|
+
|
|
256
|
+
phase_mode: detection.phase_mode,
|
|
257
|
+
|
|
258
|
+
mppt_count: detection.mppt_count,
|
|
259
|
+
|
|
260
|
+
meter_model: summary && summary.meter ? summary.meter.meter_model : null,
|
|
261
|
+
|
|
262
|
+
meter_model_id: summary && summary.meter ? summary.meter.model_id : null,
|
|
263
|
+
|
|
264
|
+
detection_source: detection.detection_source
|
|
265
|
+
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
} finally {
|
|
269
|
+
|
|
270
|
+
await closeClient(client);
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
module.exports = {
|
|
278
|
+
|
|
279
|
+
ModbusRTU,
|
|
280
|
+
|
|
281
|
+
connectClient,
|
|
282
|
+
|
|
283
|
+
createConnectedClient,
|
|
284
|
+
|
|
285
|
+
closeClient,
|
|
286
|
+
|
|
287
|
+
readHolding,
|
|
288
|
+
|
|
289
|
+
readModelHeader,
|
|
290
|
+
|
|
291
|
+
findBase,
|
|
292
|
+
|
|
293
|
+
scanModelDescriptors,
|
|
294
|
+
|
|
295
|
+
readModelByDescriptor,
|
|
296
|
+
|
|
297
|
+
readModelsByDescriptors,
|
|
298
|
+
|
|
299
|
+
scanModels,
|
|
300
|
+
|
|
301
|
+
probeInverterProfile
|
|
302
|
+
|
|
303
|
+
};
|