iobroker.sun2000 2.3.2 → 2.3.3
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 +5 -0
- package/admin/jsonConfig.json5 +32 -2
- package/io-package.json +14 -14
- package/lib/drivers/driver_inverter.js +39 -17
- package/lib/register.js +29 -10
- package/main.js +55 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,11 @@ browse in the [wiki](https://github.com/bolliy/ioBroker.sun2000/wiki)
|
|
|
65
65
|
Placeholder for the next version (at the beginning of the line):
|
|
66
66
|
### **WORK IN PROGRESS**
|
|
67
67
|
-->
|
|
68
|
+
### 2.3.3 (2025-10-31)
|
|
69
|
+
* Improved verification of the adapter configuration
|
|
70
|
+
* new state `inverter.x.derived.dailyActiveEnergy` Inverter daily active energy, which is determined via the Riemann sum of `inverter.x.activePower`
|
|
71
|
+
* state `collected.dailyInputYield` was redisigned based on inverter.[0..n-1].derived.dailyActiveEnergy
|
|
72
|
+
|
|
68
73
|
### 2.3.2 (2025-10-24)
|
|
69
74
|
* allows again `control.battery.chargeFromGridFunction` when using the Emma
|
|
70
75
|
|
package/admin/jsonConfig.json5
CHANGED
|
@@ -263,8 +263,20 @@
|
|
|
263
263
|
},
|
|
264
264
|
"chipsTxt1": {
|
|
265
265
|
"type": "staticText",
|
|
266
|
-
"text": "This control
|
|
266
|
+
"text": "This control states are set in the object path `sun2000.0.inverter.x.control.battery`",
|
|
267
|
+
"newLine": true,
|
|
268
|
+
"hidden": "data.integration === 2",
|
|
269
|
+
"xs": 12,
|
|
270
|
+
"sm": 12,
|
|
271
|
+
"md": 6,
|
|
272
|
+
"lg": 4,
|
|
273
|
+
"xl": 4
|
|
274
|
+
},
|
|
275
|
+
"chipsTxt1_1": {
|
|
276
|
+
"type": "staticText",
|
|
277
|
+
"text": "This control states are set in the object path `sun2000.0.emma.control.battery`",
|
|
267
278
|
"newLine": true,
|
|
279
|
+
"hidden": "data.integration !== 2",
|
|
268
280
|
"xs": 12,
|
|
269
281
|
"sm": 12,
|
|
270
282
|
"md": 6,
|
|
@@ -275,7 +287,7 @@
|
|
|
275
287
|
"type": "checkbox",
|
|
276
288
|
"label": "Create default TOU setting",
|
|
277
289
|
"newLine": true,
|
|
278
|
-
"help": "The `default TOU settings` is interesting for the `
|
|
290
|
+
"help": "The `default TOU settings` is interesting for the `charge from the grid` function, which is required for variable energy prices.",
|
|
279
291
|
"xs": 12,
|
|
280
292
|
"sm": 12,
|
|
281
293
|
"md": 6,
|
|
@@ -287,6 +299,7 @@
|
|
|
287
299
|
"text": "Description with examples",
|
|
288
300
|
"href": "https://github.com/bolliy/ioBroker.sun2000/wiki/Battery-control",
|
|
289
301
|
"button": true,
|
|
302
|
+
"hidden": "data.integration === 2",
|
|
290
303
|
"icon": "info",
|
|
291
304
|
"newLine": true,
|
|
292
305
|
"xs": 12,
|
|
@@ -295,6 +308,20 @@
|
|
|
295
308
|
"lg": 3,
|
|
296
309
|
"xl": 3
|
|
297
310
|
},
|
|
311
|
+
"staticLink1_1": {
|
|
312
|
+
"type": "staticLink",
|
|
313
|
+
"text": "Description with examples",
|
|
314
|
+
"href": "https://github.com/bolliy/ioBroker.sun2000/wiki/Emma:-Battery-control",
|
|
315
|
+
"button": true,
|
|
316
|
+
"hidden": "data.integration !== 2",
|
|
317
|
+
"icon": "info",
|
|
318
|
+
"newLine": true,
|
|
319
|
+
"xs": 12,
|
|
320
|
+
"sm": 12,
|
|
321
|
+
"md": 6,
|
|
322
|
+
"lg": 3,
|
|
323
|
+
"xl": 3
|
|
324
|
+
},
|
|
298
325
|
"mainHdr2": {
|
|
299
326
|
"newLine": true,
|
|
300
327
|
"type": "header",
|
|
@@ -328,12 +355,14 @@
|
|
|
328
355
|
"newLine": true,
|
|
329
356
|
"type": "header",
|
|
330
357
|
"text": "Export control",
|
|
358
|
+
"hidden": "data.integration === 2",
|
|
331
359
|
"size": 2
|
|
332
360
|
},
|
|
333
361
|
"chipsTxt3": {
|
|
334
362
|
"type": "staticText",
|
|
335
363
|
"text": "This control is set in the opject path `sun2000.0.inverter.0.control.grid`",
|
|
336
364
|
"newLine": true,
|
|
365
|
+
"hidden": "data.integration === 2",
|
|
337
366
|
"xs": 12,
|
|
338
367
|
"sm": 12,
|
|
339
368
|
"md": 6,
|
|
@@ -344,6 +373,7 @@
|
|
|
344
373
|
"type": "staticLink",
|
|
345
374
|
"text": "Description with examples",
|
|
346
375
|
"href": "https://github.com/bolliy/ioBroker.sun2000/wiki/Begrenzung-Netzeinspeisung-(Export-Control)",
|
|
376
|
+
"hidden": "data.integration === 2",
|
|
347
377
|
"button": true,
|
|
348
378
|
"icon": "info",
|
|
349
379
|
"newLine": true,
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "sun2000",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.3",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.3.3": {
|
|
7
|
+
"en": "Improved verification of the adapter configuration\nnew state `inverter.x.derived.dailyActiveEnergy` Inverter daily active energy, which is determined via the Riemann sum of `inverter.x.activePower`\nstate `collected.dailyInputYield` was redisigned based on inverter.[0..n-1].derived.dailyActiveEnergy",
|
|
8
|
+
"de": "Verbesserte Überprüfung der Adapterkonfiguration\n`inverter.x.derived.dailyActiveEnergy` Inverter tägliche aktive Energie, die über die Riemann Summe von `inverter.x.activePower bestimmt wird `\nstate `collected.dailyInputYield` wurde basierend auf Inverter zurückgeteilt. [0.n-1].derived.dailyActiveEnergy",
|
|
9
|
+
"ru": "Улучшенная проверка конфигурации адаптера\nновое состояние «inverter.x.derived.dailyActiveEnergy» Инверторная ежедневная активная энергия, которая определяется через сумму Римана 'inverter.x.activePower пункт\nstate 'collected.dailyInputYield' была переопределена на основе инвертора. [0..n-1].derived.dailyActiveEnergy",
|
|
10
|
+
"pt": "Verificação melhorada da configuração do adaptador\nnovo estado «inverter.x.derived.dailyActiveEnergy» Energia ativa diária do inversor, que é determinada através da soma Riemann de `inverter.x.activePower `\nestado `colleted.dailyInputYield` foi reassinado com base no inversor. [0..n-1].derivado.diárioAtividadeEnergia",
|
|
11
|
+
"nl": "Verbeterde verificatie van de configuratie van de adapter\nnieuwe staat Inverter dagelijkse actieve energie, die wordt bepaald via de Riemann som van Wat\nstaat [0..n-1].afgeleid.dailyActiveEnergy",
|
|
12
|
+
"fr": "Amélioration de la vérification de la configuration de l'adaptateur\nnouvel état `inverter.x.derived.dailyActiveEnergy` Inverter l'énergie active quotidienne, qui est déterminée par la somme Riemann de `inverter.x.activePower \"\nl'état `collected.dailyInputYield` a été résigné sur la base de l'onduleur. Énergie active",
|
|
13
|
+
"it": "Verifica migliorata della configurazione dell'adattatore\nnuovo stato `inverter.x.derived.dailyActiveEnergy` Inverter energia attiva quotidiana, che è determinata tramite la somma Riemann di `inverter.x.activePower #\nstato `collect.dailyInputYield` è stato ridisegnato sulla base di inverter. [0.n-1]",
|
|
14
|
+
"es": "Mejor verificación de la configuración del adaptador\nnuevo estado `inverter.x.derived.dailyActiveEnergy` Inverter energía activa diaria, que se determina a través de la suma Riemann de `inverter.x.activePower `\nestado `colected.dailyInputYield` fue redisigned basado en inverter. [0.n-1].derived.dailyActiveEnergy",
|
|
15
|
+
"pl": "Ulepszona weryfikacja konfiguracji adaptera\nnowy stan 'inverter.x.derived.dailyActiveEnergy' Inwerter dzienna aktywna energia, która jest określana za pomocą sumy Riemann 'inverter.x.activePower'\nstan 'collected.dailyInputYield' został wycofany na podstawie inwertera. [0.. n-1] .derived.dailyActiveEnergy",
|
|
16
|
+
"uk": "Покращена перевірка конфігурації адаптера\nновий стан `inverter.x.derived.dailyActiveEnergy` Інверторна щоденна активна енергія, яка визначається за рахунок `inverter.x.activePower й\n`collected.dailyInputYield` був перерахований на основі інвертора. [0..n-1].derived.dailyActiveEnergy",
|
|
17
|
+
"zh-cn": "改进适配器配置的核查\n新州`反转器.x.衍生的每日能源 ' 每日反转活性能量,通过`反转器.x.activePower的Riemann总和确定 `\ndaily InputYield)根据反差重新签名。 [0.n-1]. 衍生的每日能源"
|
|
18
|
+
},
|
|
6
19
|
"2.3.2": {
|
|
7
20
|
"en": "allows again `control.battery.chargeFromGridFunction` when using the Emma",
|
|
8
21
|
"de": "erlaubt wieder `control.battery.chargeFromGridFunction` bei Verwendung der Emma",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "aktualizacje zależności i konfiguracji\nfix: dostosować wartości graniczne dla zdarzeń w oparciu o wartość użytkową Parametry nadwyżki\nfix: wartości rejestru swap dla zużycia energii w sterowniku Emma # 190\nemma: ulepszenie obliczania mocy przy zastosowaniu wykładniczej średniej ruchomej w EmmaCharger\naktualizacja definicji nadwyżek energii elektrycznej i deprecjacja starych identyfikatorów",
|
|
81
94
|
"uk": "оновлення залежності та конфігурації\nвиправити: регулювати ліміти значення події на основі Параметри Surplus\nвиправити: значення swap для споживання енергії в машині Емма #190\nемма: поліпшення розрахунку потужності з постійним рухомим середнім в ЕммаКхаргер\nоновлення надлишок визначення стану живлення та депресувати старі ідентифікатори",
|
|
82
95
|
"zh-cn": "依赖和配置更新\n固定:根据可用值调整事件值限制 盈余参数\n修补: Emma 驱动器中用电量的交换记录值 # 190\nemma: 改进电量计算, 以 Emmacourer 中的指数移动平均值\n更新剩余电源状态定义并折旧旧标识符"
|
|
83
|
-
},
|
|
84
|
-
"2.1.0": {
|
|
85
|
-
"en": "emma: system time is being determined [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrol: add grid power scheduling functionality to inverter driver [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
86
|
-
"de": "emma: Die Systemzeit wird bestimmt [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\nsteuerung: Netz-Leistungs-Scheduling-Funktionalität zum Wechselrichtertreiber hinzufügen [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
87
|
-
"ru": "emma: системное время определяется [#179] (https://github.com/bolliy/ioBroker.sun2000/issues/179)\nуправление: добавьте функцию планирования мощности сети к драйверу инвертора [#176] (https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
88
|
-
"pt": "emma: tempo do sistema está sendo determinado [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrol: add grid power screaming functionality to inverter driver [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
89
|
-
"nl": "emma: de systeemtijd wordt bepaald [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrole: voeg net stroom planning functionaliteit aan omvormer driver [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
90
|
-
"fr": "emma: le temps du système est déterminé [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrôle: ajouter la fonctionnalité de programmation du réseau au pilote d'onduleur [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
91
|
-
"it": "emma: il tempo di sistema viene determinato [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrollo: aggiungere funzionalità di programmazione della griglia al driver inverter [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
92
|
-
"es": "emma: El tiempo del sistema se determina [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)\ncontrol: añadir funcionalidad de programación de energía de red al controlador inverter [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
93
|
-
"pl": "emma: ustala się czas systemowy [# 179] (https: / / github.com / bolliy / ioBroker.sun2000 / issues / 179)\ncontrol: add grid Power Scheduling Functional to inverter driver [# 176] (https: / / github.com / bolliy / ioBroker.sun2000 / issues / 176)",
|
|
94
|
-
"uk": "emma: час системи визначається [#179](https://github.com/bolliy/ioBroker.sun2000/products/179)\ncontrol: add power scheduling features to inverter драйвер [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)",
|
|
95
|
-
"zh-cn": "emma:系统时间正在确定 [# 179] (https://github.com/bolliy/ioBroker.sun2000/issues/179)\n控制:向反向驱动器添加电网电源调度功能[#176](https://github.com/bolliy/ioBroker.sun2000/issues/1976)"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -100,6 +100,14 @@ class InverterSun2000 extends DriverBase {
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
//
|
|
104
|
+
this.activePowerSum = new RiemannSum();
|
|
105
|
+
this.adapter.getState(`${this.deviceInfo.path}.derived.dailyActiveEnergy`, (err, state) => {
|
|
106
|
+
if (!err && state) {
|
|
107
|
+
this.activePowerSum.setStart(state.val, state.ts);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
103
111
|
this.control = new ServiceQueueMap(this.adapter, this.deviceInfo);
|
|
104
112
|
|
|
105
113
|
//https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md
|
|
@@ -149,7 +157,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
149
157
|
postHook: () => {
|
|
150
158
|
if (!this._testMode) return;
|
|
151
159
|
|
|
152
|
-
this.log.debug('### PostHook for InverterSun2000');
|
|
160
|
+
this.log.debug('### TEST MODE - PostHook for InverterSun2000 ####');
|
|
153
161
|
this.identifySubdevices('sun2000', this.modbusId)
|
|
154
162
|
.then(ret => {
|
|
155
163
|
this.log.debug(`### PostHook for InverterSun2000 - ret: ${JSON.stringify(ret)}`);
|
|
@@ -190,6 +198,11 @@ class InverterSun2000 extends DriverBase {
|
|
|
190
198
|
store: storeType.always,
|
|
191
199
|
},
|
|
192
200
|
],
|
|
201
|
+
postHook: path => {
|
|
202
|
+
//calculate daily active energy
|
|
203
|
+
const activePower = this.stateCache.get(`${path}activePower`)?.value ?? 0;
|
|
204
|
+
this.activePowerSum.add(activePower); //riemann Sum
|
|
205
|
+
},
|
|
193
206
|
},
|
|
194
207
|
{
|
|
195
208
|
address: 37765,
|
|
@@ -1489,14 +1502,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1489
1502
|
const activePower = this.stateCache.get(`${path}activePower`)?.value ?? 0;
|
|
1490
1503
|
if (Math.abs(activePower - inputPower + chargePower) > 0) {
|
|
1491
1504
|
this.log.debug(`activePower ${activePower} !== inputPower ${inputPower}-chargePower ${chargePower}`);
|
|
1492
|
-
this.stateCache.set(`${path}activePower`, inputPower - chargePower, { type: 'number' });
|
|
1493
|
-
/*
|
|
1494
|
-
if (chargePower === 0) {
|
|
1495
|
-
this.stateCache.set(`${path}activePower`, inputPower - chargePower, { type: 'number' });
|
|
1496
|
-
} else {
|
|
1497
|
-
this.stateCache.set(`${path}battery.chargeDischargePower`, inputPower - activePower, { type: 'number' });
|
|
1498
|
-
}
|
|
1499
|
-
*/
|
|
1505
|
+
//this.stateCache.set(`${path}activePower`, inputPower - chargePower, { type: 'number' });
|
|
1500
1506
|
}
|
|
1501
1507
|
},
|
|
1502
1508
|
},
|
|
@@ -1508,17 +1514,18 @@ class InverterSun2000 extends DriverBase {
|
|
|
1508
1514
|
type: 'number',
|
|
1509
1515
|
unit: 'kWh',
|
|
1510
1516
|
role: 'value.power.consumption',
|
|
1511
|
-
desc: '
|
|
1517
|
+
desc: 'yield from the portal',
|
|
1512
1518
|
},
|
|
1513
1519
|
fn: path => {
|
|
1514
|
-
const disCharge = this.stateCache.get(`${path}battery.currentDayDischargeCapacity`)?.value;
|
|
1515
|
-
const charge = this.stateCache.get(`${path}battery.currentDayChargeCapacity`)?.value;
|
|
1516
|
-
let inputYield = this.stateCache.get(`${path}dailyEnergyYield`)?.value * 0.97 + charge - disCharge;
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
+
const disCharge = this.stateCache.get(`${path}battery.currentDayDischargeCapacity`)?.value ?? 0;
|
|
1521
|
+
const charge = this.stateCache.get(`${path}battery.currentDayChargeCapacity`)?.value ?? 0;
|
|
1522
|
+
//let inputYield = this.stateCache.get(`${path}dailyEnergyYield`)?.value ?? 0 * 0.97 + charge - disCharge;
|
|
1523
|
+
const activeEnergy = this.stateCache.get(`${path}derived.dailyActiveEnergy`)?.value ?? 0;
|
|
1524
|
+
let inYield = activeEnergy + (charge - disCharge) * 0.97; //efficiency loss of battery 3%
|
|
1525
|
+
if (inYield < 0) {
|
|
1526
|
+
inYield = 0;
|
|
1520
1527
|
}
|
|
1521
|
-
this.stateCache.set(`${path}derived.dailyInputYield`,
|
|
1528
|
+
this.stateCache.set(`${path}derived.dailyInputYield`, inYield, { type: 'number' });
|
|
1522
1529
|
},
|
|
1523
1530
|
},
|
|
1524
1531
|
{
|
|
@@ -1535,6 +1542,20 @@ class InverterSun2000 extends DriverBase {
|
|
|
1535
1542
|
this.stateCache.set(`${path}derived.dailySolarYield`, this.solarSum.sum, { type: 'number' });
|
|
1536
1543
|
},
|
|
1537
1544
|
},
|
|
1545
|
+
{
|
|
1546
|
+
refresh: dataRefreshRate.low,
|
|
1547
|
+
state: {
|
|
1548
|
+
id: 'derived.dailyActiveEnergy',
|
|
1549
|
+
name: 'Active Energy today',
|
|
1550
|
+
type: 'number',
|
|
1551
|
+
unit: 'kWh',
|
|
1552
|
+
role: 'value.power.consumption',
|
|
1553
|
+
desc: 'Amount of Riemann sum of sum of active power',
|
|
1554
|
+
},
|
|
1555
|
+
fn: path => {
|
|
1556
|
+
this.stateCache.set(`${path}derived.dailyActiveEnergy`, this.activePowerSum.sum, { type: 'number' });
|
|
1557
|
+
},
|
|
1558
|
+
},
|
|
1538
1559
|
];
|
|
1539
1560
|
this.postUpdateHooks.push.apply(this.postUpdateHooks, newHooks);
|
|
1540
1561
|
}
|
|
@@ -1638,6 +1659,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1638
1659
|
|
|
1639
1660
|
async mitnightProcess() {
|
|
1640
1661
|
this.solarSum.reset();
|
|
1662
|
+
this.activePowerSum.reset();
|
|
1641
1663
|
}
|
|
1642
1664
|
}
|
|
1643
1665
|
|
package/lib/register.js
CHANGED
|
@@ -31,7 +31,7 @@ class Registers {
|
|
|
31
31
|
type: 'number',
|
|
32
32
|
unit: 'kW',
|
|
33
33
|
role: 'value.power',
|
|
34
|
-
desc: '',
|
|
34
|
+
desc: 'Power from solar with efficiency loss',
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
id: 'collected.chargeDischargePower',
|
|
@@ -66,7 +66,6 @@ class Registers {
|
|
|
66
66
|
desc: 'Power from solar minus house consumption and usable battery power',
|
|
67
67
|
},
|
|
68
68
|
{ id: 'collected.externalPower', name: 'external power', type: 'number', unit: 'kW', role: 'value.power' },
|
|
69
|
-
//{ id: 'collected.ratedPower', name: 'rated power', type: 'number', unit: 'kW', role: 'value.power' },
|
|
70
69
|
],
|
|
71
70
|
fn: inverters => {
|
|
72
71
|
let actPower = 0;
|
|
@@ -99,7 +98,7 @@ class Registers {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
if (soc > minSoc) {
|
|
102
|
-
// charge power is positive
|
|
101
|
+
// charge power is positive - Battery is charging
|
|
103
102
|
if (chargeDischarge > 0) surplusPower += chargeDischarge;
|
|
104
103
|
|
|
105
104
|
if (bufferSoc === 0 || soc < bufferSoc + threshold) {
|
|
@@ -149,13 +148,11 @@ class Registers {
|
|
|
149
148
|
inPowerEff += this.stateCache.get(`${inverter.path}.derived.inputPowerWithEfficiencyLoss`)?.value ?? 0;
|
|
150
149
|
chargeDischarge += this.stateCache.get(`${inverter.path}.battery.chargeDischargePower`)?.value ?? 0;
|
|
151
150
|
ratedPower += this.stateCache.get(`${inverter.path}.info.ratedPower`)?.value ?? 0;
|
|
152
|
-
//maxChargePower = this.stateCache.get(`${inverter.path}.battery.maximumChargingPower`)?.value ?? 0;
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
const feedinPower = this.stateCache.get('meter.derived.feed-inPower')?.value ?? 0;
|
|
156
154
|
|
|
157
155
|
const extPower = this.adapter.control.get('externalPower')?.value ?? 0;
|
|
158
|
-
//extPower = extPower / 1000;
|
|
159
156
|
|
|
160
157
|
//Zu geringe Erzeugerenegie
|
|
161
158
|
let houseConsum = actPower - feedinPower + extPower;
|
|
@@ -192,15 +189,15 @@ class Registers {
|
|
|
192
189
|
type: 'number',
|
|
193
190
|
unit: 'kWh',
|
|
194
191
|
role: 'value.power.consumption',
|
|
195
|
-
desc: 'daily
|
|
192
|
+
desc: 'daily energy yield of the inverters',
|
|
196
193
|
},
|
|
197
194
|
{
|
|
198
195
|
id: 'collected.dailyInputYield',
|
|
199
|
-
name: 'Daily
|
|
196
|
+
name: 'Daily input yield',
|
|
200
197
|
type: 'number',
|
|
201
198
|
unit: 'kWh',
|
|
202
199
|
role: 'value.power.consumption',
|
|
203
|
-
desc: '
|
|
200
|
+
desc: 'yield from the portal',
|
|
204
201
|
},
|
|
205
202
|
{
|
|
206
203
|
id: 'collected.dailySolarYield',
|
|
@@ -237,12 +234,23 @@ class Registers {
|
|
|
237
234
|
},
|
|
238
235
|
{ id: 'collected.SOC', name: 'State of battery capacity', type: 'number', unit: '%', role: 'value.battery', desc: 'SOC' },
|
|
239
236
|
{ id: 'collected.ratedCapacity', name: 'Rated of battery capacity', type: 'number', unit: 'Wh', role: 'value.capacity' },
|
|
237
|
+
/*
|
|
238
|
+
{
|
|
239
|
+
id: 'collected.dailyActiveEnergy',
|
|
240
|
+
name: 'Active Energy today',
|
|
241
|
+
type: 'number',
|
|
242
|
+
unit: 'kWh',
|
|
243
|
+
role: 'value.power.consumption',
|
|
244
|
+
desc: 'Amount of Riemann sum of sum of active power',
|
|
245
|
+
},
|
|
246
|
+
*/
|
|
240
247
|
],
|
|
241
248
|
fn: inverters => {
|
|
242
249
|
let inYield = 0;
|
|
243
250
|
let solarYield = 0;
|
|
244
251
|
let outYield = 0;
|
|
245
252
|
let enYield = 0;
|
|
253
|
+
let activeEnergy = 0;
|
|
246
254
|
let charge = 0;
|
|
247
255
|
let disCharge = 0;
|
|
248
256
|
let totalDisCharge = 0;
|
|
@@ -256,10 +264,11 @@ class Registers {
|
|
|
256
264
|
if (inverter.driverClass != driverClasses.inverter) {
|
|
257
265
|
continue;
|
|
258
266
|
}
|
|
259
|
-
outYield += this.stateCache.get(`${inverter.path}.dailyEnergyYield`)?.value;
|
|
267
|
+
outYield += this.stateCache.get(`${inverter.path}.dailyEnergyYield`)?.value ?? 0;
|
|
260
268
|
inYield += this.stateCache.get(`${inverter.path}.derived.dailyInputYield`)?.value;
|
|
261
269
|
solarYield += this.stateCache.get(`${inverter.path}.derived.dailySolarYield`)?.value;
|
|
262
270
|
enYield += this.stateCache.get(`${inverter.path}.accumulatedEnergyYield`)?.value;
|
|
271
|
+
activeEnergy += this.stateCache.get(`${inverter.path}.derived.dailyActiveEnergy`)?.value ?? 0;
|
|
263
272
|
if (this.stateCache.get(`${inverter.path}.battery.ratedCapacity`)?.value > 0) {
|
|
264
273
|
charge += this.stateCache.get(`${inverter.path}.battery.currentDayChargeCapacity`)?.value ?? 0;
|
|
265
274
|
disCharge += this.stateCache.get(`${inverter.path}.battery.currentDayDischargeCapacity`)?.value ?? 0;
|
|
@@ -271,7 +280,7 @@ class Registers {
|
|
|
271
280
|
ratedCap += this.stateCache.get(`${inverter.path}.battery.ratedCapacity`)?.value;
|
|
272
281
|
}
|
|
273
282
|
}
|
|
274
|
-
|
|
283
|
+
//this.stateCache.set('collected.dailyActiveEnergy', activeEnergy, { type: 'number' });
|
|
275
284
|
this.stateCache.set('collected.dailyEnergyYield', outYield, { type: 'number' });
|
|
276
285
|
this.stateCache.set('collected.dailyInputYield', inYield, { type: 'number' }); //deprecated
|
|
277
286
|
this.stateCache.set('collected.dailySolarYield', solarYield, { type: 'number' });
|
|
@@ -286,6 +295,7 @@ class Registers {
|
|
|
286
295
|
feedinEnergy = this.stateCache.get('meter.positiveActiveEnergy')?.value ?? 0;
|
|
287
296
|
supplyFromGrid = this.stateCache.get('meter.reverseActiveEnergy')?.value ?? 0;
|
|
288
297
|
}
|
|
298
|
+
//stimmt leider nicht genau - bleibt aber erstmal bestehen
|
|
289
299
|
const conSum = enYield + supplyFromGrid - feedinEnergy;
|
|
290
300
|
this.stateCache.set('collected.consumptionSum', conSum, { type: 'number' });
|
|
291
301
|
// compute export and import today
|
|
@@ -295,11 +305,19 @@ class Registers {
|
|
|
295
305
|
this.stateCache.set('collected.gridImportToday', supplyFromGrid - this.stateCache.get('collected.gridImportStart')?.value, {
|
|
296
306
|
type: 'number',
|
|
297
307
|
});
|
|
308
|
+
/* old computation of consumption today
|
|
298
309
|
this.stateCache.set(
|
|
299
310
|
'collected.consumptionToday',
|
|
300
311
|
this.stateCache.get('collected.consumptionSum')?.value - this.stateCache.get('collected.consumptionStart')?.value,
|
|
301
312
|
{ type: 'number' },
|
|
302
313
|
);
|
|
314
|
+
*/
|
|
315
|
+
//new computation of consumption today
|
|
316
|
+
this.stateCache.set(
|
|
317
|
+
'collected.consumptionToday',
|
|
318
|
+
activeEnergy + this.stateCache.get('collected.gridImportToday')?.value - this.stateCache.get('collected.gridExportToday')?.value,
|
|
319
|
+
{ type: 'number' },
|
|
320
|
+
);
|
|
303
321
|
//compute battery
|
|
304
322
|
this.stateCache.set('collected.totalCharge', totalCharge, { type: 'number' });
|
|
305
323
|
this.stateCache.set('collected.totalDischarge', totalDisCharge, { type: 'number' });
|
|
@@ -415,6 +433,7 @@ class Registers {
|
|
|
415
433
|
this.stateCache.set('collected.gridImportStart', state?.val, { type: 'number', stored: true });
|
|
416
434
|
state = await this.adapter.getState('collected.consumptionStart');
|
|
417
435
|
this.stateCache.set('collected.consumptionStart', state?.val, { type: 'number', stored: true });
|
|
436
|
+
//this.stateCache.set('collected.consumptionStart', 100000, { type: 'number', stored: true });
|
|
418
437
|
}
|
|
419
438
|
|
|
420
439
|
//state
|
package/main.js
CHANGED
|
@@ -379,7 +379,7 @@ class Sun2000 extends utils.Adapter {
|
|
|
379
379
|
await this.setState('info.modbusDelay', { val: this.config.delay, ack: true });
|
|
380
380
|
await this.setState('info.modbusTcpServer', { val: this.config.ms_active, ack: true });
|
|
381
381
|
// Load user settings
|
|
382
|
-
if (this.config.address != '' && this.config.port > 0 && this.config.
|
|
382
|
+
if (this.config.address != '' && this.config.port > 0 && this.config.updateInterval > 0) {
|
|
383
383
|
this.settings.address = this.config.address;
|
|
384
384
|
this.settings.port = this.config.port;
|
|
385
385
|
this.settings.modbusTimeout = this.config.timeout; //ms
|
|
@@ -421,67 +421,72 @@ class Sun2000 extends utils.Adapter {
|
|
|
421
421
|
} else {
|
|
422
422
|
await this.setState('info.JSONhealth', { val: '{message : "Information is collected"}', ack: true });
|
|
423
423
|
}
|
|
424
|
-
|
|
425
|
-
if (this.settings.modbusIds.length
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
//SDongle
|
|
438
|
-
if (this.settings.integration === 0 && this.settings.sd.active) {
|
|
439
|
-
this.devices.push({
|
|
440
|
-
index: 0,
|
|
441
|
-
duration: 0,
|
|
442
|
-
modbusId: this.settings.sd.sDongleId,
|
|
443
|
-
driverClass: driverClasses.sdongle,
|
|
444
|
-
});
|
|
424
|
+
//future: if (this.settings.integration !== 2 && (this.settings.modbusIds.length === 0 || this.settings.modbusIds.length > 5)) {
|
|
425
|
+
if (this.settings.modbusIds.length === 0 || this.settings.modbusIds.length > 5) {
|
|
426
|
+
this.adapterDisable(`*** Adapter deactivated, inverter modbus Ids is invalid! ***`);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
//ES6 use a for (const [index, item] of array.entries()) of loop
|
|
430
|
+
for (const [i, id] of this.settings.modbusIds.entries()) {
|
|
431
|
+
//Inverter
|
|
432
|
+
if (id < 1 || id >= 250) {
|
|
433
|
+
this.adapterDisable(`*** Adapter deactivated, inverter modbus Id ${id} is not permitted! ***`);
|
|
434
|
+
return;
|
|
445
435
|
}
|
|
436
|
+
this.devices.push({
|
|
437
|
+
index: i,
|
|
438
|
+
duration: 5000,
|
|
439
|
+
modbusId: id,
|
|
440
|
+
driverClass: driverClasses.inverter,
|
|
441
|
+
meter: i == 0 && this.settings.integration === 0,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
446
444
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
this.devices.push({
|
|
457
|
-
index: 0,
|
|
458
|
-
duration: 0,
|
|
459
|
-
meter: true,
|
|
460
|
-
modbusId: this.settings.sl.meterId,
|
|
461
|
-
driverClass: driverClasses.loggerMeter,
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
}
|
|
445
|
+
//SDongle
|
|
446
|
+
if (this.settings.integration === 0 && this.settings.sd.active) {
|
|
447
|
+
this.devices.push({
|
|
448
|
+
index: 0,
|
|
449
|
+
duration: 0,
|
|
450
|
+
modbusId: this.settings.sd.sDongleId,
|
|
451
|
+
driverClass: driverClasses.sdongle,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
465
454
|
|
|
466
|
-
|
|
467
|
-
|
|
455
|
+
//SmartLogger
|
|
456
|
+
if (this.settings.integration === 1) {
|
|
457
|
+
this.devices.push({
|
|
458
|
+
index: 0,
|
|
459
|
+
duration: 0,
|
|
460
|
+
modbusId: 0,
|
|
461
|
+
driverClass: driverClasses.logger,
|
|
462
|
+
});
|
|
463
|
+
if (this.settings.sl.meterId > 0) {
|
|
468
464
|
this.devices.push({
|
|
469
465
|
index: 0,
|
|
470
466
|
duration: 0,
|
|
471
|
-
//modbusId: 1, --> testMode
|
|
472
|
-
modbusId: 0,
|
|
473
467
|
meter: true,
|
|
474
|
-
|
|
468
|
+
modbusId: this.settings.sl.meterId,
|
|
469
|
+
driverClass: driverClasses.loggerMeter,
|
|
475
470
|
});
|
|
476
471
|
}
|
|
472
|
+
}
|
|
477
473
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
474
|
+
//EMMA with TestMode
|
|
475
|
+
if (this.settings.integration === 2) {
|
|
476
|
+
this.devices.push({
|
|
477
|
+
index: 0,
|
|
478
|
+
duration: 0,
|
|
479
|
+
//modbusId: 1, --> testMode
|
|
480
|
+
modbusId: 0,
|
|
481
|
+
meter: true,
|
|
482
|
+
driverClass: driverClasses.emma,
|
|
483
|
+
});
|
|
482
484
|
}
|
|
485
|
+
|
|
486
|
+
await this.adjustInverval();
|
|
487
|
+
await this.StartProcess();
|
|
483
488
|
} else {
|
|
484
|
-
this.adapterDisable(
|
|
489
|
+
this.adapterDisable(`*** Adapter deactivated, Adapter Settings incomplete! ***`);
|
|
485
490
|
}
|
|
486
491
|
}
|
|
487
492
|
|