iobroker.sun2000 2.4.5 → 2.5.1
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 +15 -13
- package/admin/jsonConfig.json5 +33 -0
- package/io-package.json +39 -38
- package/lib/controls/inverter_service_queue.js +1 -1
- package/lib/drivers/driver_base.js +2 -1
- package/lib/drivers/driver_emma.js +14 -16
- package/lib/drivers/driver_inverter.js +70 -23
- package/lib/json_helper.js +3 -25
- package/lib/modbus/modbus_server.js +2 -2
- package/lib/register.js +178 -39
- package/lib/statistics/breakdownChartHelper.js +131 -0
- package/lib/statistics/consumptionBreakdown.js +304 -0
- package/lib/statistics/statistics.js +1458 -0
- package/lib/tools.js +24 -5
- package/main.js +18 -5
- package/package.json +12 -13
- package/lib/statistics.js +0 -1412
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Read and write register data from Huawei SUN2000 inverter and LUNA2000 battery u
|
|
|
27
27
|
Feel free to follow the discussions in the german [iobroker forum](https://forum.iobroker.net/topic/71768/test-adapter-sun2000-v0-1-x-huawei-wechselrichter)
|
|
28
28
|
|
|
29
29
|
## Requirements
|
|
30
|
-
* Node.js
|
|
30
|
+
* Node.js 22 or higher
|
|
31
31
|
* ioBroker host (js-controller) 6.0.11 or higher
|
|
32
32
|
* ioBroker admin 7.6.20 or higher
|
|
33
33
|
|
|
@@ -69,6 +69,19 @@ The sun2000 adapter calculates how much of your self-generated solar energy is a
|
|
|
69
69
|
Placeholder for the next version (at the beginning of the line):
|
|
70
70
|
### **WORK IN PROGRESS**
|
|
71
71
|
-->
|
|
72
|
+
### 2.5.1 (2026-06-29)
|
|
73
|
+
- (bolliy) fix: update service queue logic ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))
|
|
74
|
+
- (bolliy) statistics fix: adjust reset handling logic to treat significant drops in value as potential resets
|
|
75
|
+
|
|
76
|
+
### 2.5.0 (2026-06-09)
|
|
77
|
+
* (bolliy) statistics: added live power chart (statistics.jsonLive)
|
|
78
|
+
* (bolliy) statistics: consumption breakdown — breakdown values are now subtracted from the total `consumption` entry so the lower chart panel shows the remainder separately from the breakdown series
|
|
79
|
+
* (bolliy) statistics: `xAxisFormatter` for the live chart only labels full-hour ticks to avoid clutter
|
|
80
|
+
* (bolliy) statistics: tooltip formatter refactored — `formatTooltipValue(unit, negative, decimals)` helper used consistently across all series
|
|
81
|
+
* (bolliy) statistics: if no battery is present, the charts are generated without battery information (SOC, charge, discharge).
|
|
82
|
+
* (bolliy) fix emma: update register addresses of meter.activePowerL1-L3 ([#282](https://github.com/bolliy/ioBroker.sun2000/issues/282))
|
|
83
|
+
* (bolliy) requires node.js >= 22
|
|
84
|
+
|
|
72
85
|
### 2.4.5 (2026-05-14)
|
|
73
86
|
* statistics fix: return weekly range up to current Monday
|
|
74
87
|
* statistics: added support for generating statistics templates directly from built-in charts
|
|
@@ -83,18 +96,7 @@ The sun2000 adapter calculates how much of your self-generated solar energy is a
|
|
|
83
96
|
* statistics: computed values `selfSufficiency` and `selfConsumption` calculated automatically in all time-series states
|
|
84
97
|
* statistics: data placeholders (`%%solarYield%%`, `%%selfSufficiency%%` etc.) and negated variants (`%%gridExportNeg%%` etc.) for mirrored chart layouts
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
* fix test-and-release: deploy with 24.x
|
|
88
|
-
* statistics: flexcharts integration — built-in Apache ECharts configuration with bar and line chart support
|
|
89
|
-
* statistics: day-break visualization with alternating shaded areas for hourly charts
|
|
90
|
-
* statistics: per chart-type templates (`statistics.flexCharts.template.hourly` etc.) for full ECharts customization including functions
|
|
91
|
-
* statistics: data placeholders (`%%solarYield%%`, `%%gridExport%%` etc.) allow complete chart layout control via template states
|
|
92
|
-
* statistics: chart output states (`statistics.flexCharts.jsonOutput.hourly` etc.) updated automatically each hour
|
|
93
|
-
|
|
94
|
-
### 2.4.0 (2026-03-14)
|
|
95
|
-
* fix: the order of bit assignment corrected of alarmsJSON
|
|
96
|
-
* new state `inverter.x.emma.activeAlarmSN` and `inverter.x.emma.HistoricalAlarmSN` : emma alarms [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)
|
|
97
|
-
* statistics: Aggregates historical collected datapoints into time-based summaries (e.g. hourly, daily, monthly, yearly). The data is stored in the path `statistics` as JSON.
|
|
99
|
+
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
98
100
|
|
|
99
101
|
## License
|
|
100
102
|
MIT License
|
package/admin/jsonConfig.json5
CHANGED
|
@@ -385,6 +385,39 @@
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
|
+
"tab8": {
|
|
389
|
+
"type": "panel",
|
|
390
|
+
"label": "Statistics",
|
|
391
|
+
"items": {
|
|
392
|
+
"stat_liveInterval": {
|
|
393
|
+
"type": "number",
|
|
394
|
+
"label": "Live chart interval (min)",
|
|
395
|
+
"min" : 1,
|
|
396
|
+
"max" : 15,
|
|
397
|
+
"newLine": true,
|
|
398
|
+
"tooltip": "Live chart update interval in minutes",
|
|
399
|
+
"xs": 12,
|
|
400
|
+
"sm": 12,
|
|
401
|
+
"md": 6,
|
|
402
|
+
"lg": 4,
|
|
403
|
+
"xl": 4
|
|
404
|
+
},
|
|
405
|
+
"staticLink1": {
|
|
406
|
+
"type": "staticLink",
|
|
407
|
+
"text": "Information and settings regarding the statistics explained in the wiki",
|
|
408
|
+
"href": "https://github.com/bolliy/ioBroker.sun2000/wiki/Statistk-(statistics)",
|
|
409
|
+
"button": true,
|
|
410
|
+
"icon": "info",
|
|
411
|
+
"newLine": true,
|
|
412
|
+
"xs": 12,
|
|
413
|
+
"sm": 12,
|
|
414
|
+
"md": 6,
|
|
415
|
+
"lg": 3,
|
|
416
|
+
"xl": 3
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
},
|
|
388
421
|
"tab7": {
|
|
389
422
|
"type": "panel",
|
|
390
423
|
"label": "Further Register",
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "sun2000",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.5.1": {
|
|
7
|
+
"en": "fix: update service queue logic ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nstatistics fix: adjust reset handling logic to treat significant drops in value as potential resets",
|
|
8
|
+
"de": "fix: update service queue logic ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nstatistics fix: anpassung der reset-handling-logik, um signifikante wertverluste als potenzielle resets zu behandeln",
|
|
9
|
+
"ru": "исправить: обновить логику очереди обслуживания ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nисправление статистики: настройте логику обработки сбросов, чтобы рассматривать значительное снижение стоимости как потенциальные сбросы",
|
|
10
|
+
"pt": "fix: update service fila logic ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nstatistics fix: ajuste a lógica de manipulação de reset para tratar quedas significativas no valor como resets potenciais",
|
|
11
|
+
"nl": "fix: update service wachtrij logica ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nstatistieken fix: aanpassen reset handling logica om significante dalingen in waarde te behandelen als potentiële ressets",
|
|
12
|
+
"fr": "correction: mise à jour de la logique de la file d'attente de service ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\ncorrection statistique: ajuster la logique de réinitialisation pour traiter les baisses significatives de valeur comme des réinitialisations potentielles",
|
|
13
|
+
"it": "correzione: aggiornamento della coda di servizio logica ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nstatistiche fix: regolare la gestione del reset logica per trattare gocce significative di valore come potenziali reset",
|
|
14
|
+
"es": "fix: update service queue logic ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283))\nestadística fijado: ajuste la lógica de manejo de reajuste para tratar gotas significativas en valor como posibles reajustes",
|
|
15
|
+
"pl": "fix: update service queue logic ([# 283] (https: / / github.com / bolliy / ioBroker.sun2000 / discussions / 283))\nstatystyki fix: dostosować logikę obsługi reset w celu traktowania znaczących spadku wartości jako potencjalnych reset",
|
|
16
|
+
"uk": "виправити: оновити логіку черги ([#283](https://github.com/bolliy/ioBroker.sun2000/discussions/283)))\nвиправлення статистичних даних: регулюйте логіку обробки скидання для обробки значних крапель у значення як потенційні скидання",
|
|
17
|
+
"zh-cn": "fix:更新服务队列逻辑([#283] (https://github.com/bolliy/ioBroker.sun2000/discussions/283))\n统计修补:调整重置处理逻辑,将价值大幅下降视为潜在重置"
|
|
18
|
+
},
|
|
19
|
+
"2.5.0": {
|
|
20
|
+
"en": "statistics: added live power chart (statistics.jsonLive)\nrequires node.js >= 22",
|
|
21
|
+
"de": "statistiken: Live Power Chart hinzugefügt (statistics.jsonLive)\nrequires node.js >= 22",
|
|
22
|
+
"ru": "статистика: добавлена живая диаграмма мощности (statistics.jsonLive)\nrequires node.js >= 22",
|
|
23
|
+
"pt": "estatísticas: gráfico de potência ao vivo adicionado (statistics.jsonLive)\nrequires node.js >= 22",
|
|
24
|
+
"nl": "statistieken: toegevoegde live power chart (statistics.jsonLive)",
|
|
25
|
+
"fr": "statistiques: tableau de puissance en direct ajouté (statistiques.jsonLive)\nrequires node.js >= 22",
|
|
26
|
+
"it": "statistiche: aggiunto live power chart (statistics.jsonLive)\nrequires node.js >= 22",
|
|
27
|
+
"es": "estadística: añadido gráfico de potencia en vivo (statistics.jsonLive)\nrequires node.js >= 22",
|
|
28
|
+
"pl": "statystyki: dodany live power chart (statistics.jsonLive)\nrequires node.js >= 22",
|
|
29
|
+
"uk": "статистика: додано графік живої потужності (statistics.jsonLive)\nrequires node.js >= 22",
|
|
30
|
+
"zh-cn": "统计:增加的实电图(统计学.jsonLive)"
|
|
31
|
+
},
|
|
6
32
|
"2.4.5": {
|
|
7
33
|
"en": "statistics fix: return weekly range up to current Monday\nstatistics: added support for generating statistics templates directly from built-in charts\nstatistics: improved tooltip formatter - tooltip units are now provided explicitly via tooltip.valueFormatter",
|
|
8
34
|
"de": "statistik fix: wöchentliche Rückgabe bis zum aktuellen Montag\nstatistik: unterstützung für die erstellung von statistiken vorlagen direkt aus integrierten diagrammen\nstatistiken: verbesserter Tooltip-Formater - Tooltip-Einheiten werden nun explizit über tooltip.valueFormatter bereitgestellt",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "fix: kolejność przypisywania bitów poprawionych alarmów JSON\nw języku angielskim:\nstatystyki: Zagregowane historyczne zbierane punkty danych w skróty czasowe (np. godzinowe, dzienne, miesięczne, roczne). Dane są przechowywane w ścieżce \"statystyki\" jako JSON.",
|
|
68
94
|
"uk": "фіксувати: порядок відведення біту виправлено тривоги Сонце\nновий стан `inverter.x.emma.activeAlarmSN` і `inverter.x.emma.HistoricalAlarmSN` : emma тривоги [#226](https://github.com/bolliy/ioBroker.sun2000/products/226)\nстатистика: Агрегати історичних зібраних точок даних на часові суми (наприклад, час, щоденно, щомісяця, рік). Дані зберігаються на шляху `statistics` як JSON.",
|
|
69
95
|
"zh-cn": "固定: 修改提醒的位任务顺序 贾森\n新状态`inverter.x.emma.active AlarmSN ' 和`inverter.x.emma. Historical AlarmSN ' : emma警报[# 226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\n统计: 将历史收集的数据点汇总为时间摘要(如小时、每日、每月、每年)。 数据作为JSON储存在路径`统计'中."
|
|
70
|
-
},
|
|
71
|
-
"2.3.7": {
|
|
72
|
-
"en": "deleted deprecated state `collected.usableSurplusPower`",
|
|
73
|
-
"de": "gelöschter deprecated state `collect.usableSurplusPower `",
|
|
74
|
-
"ru": "удаленное устаревшее состояние 'collected.usableSurplusPower пункт",
|
|
75
|
-
"pt": "estado desactualizado excluído `colected.usableSurplusPower `",
|
|
76
|
-
"nl": "verwijderde verouderde staat Wat",
|
|
77
|
-
"fr": "état obsolète supprimé `collected.usableSurplusPower \"",
|
|
78
|
-
"it": "cancellato stato deprecato `colletto.usableSurplusPower #",
|
|
79
|
-
"es": "borrado estado deprecatado `collected.usableSurplusPower `",
|
|
80
|
-
"pl": "usunięty stan zdepregatowany \"collected.usableSurplusPower '",
|
|
81
|
-
"uk": "вилучена депресована держава `collected.usableSurplusPower й",
|
|
82
|
-
"zh-cn": "删除已贬值状态“ 已收集。 可使用 SurplusPower `"
|
|
83
|
-
},
|
|
84
|
-
"2.3.6": {
|
|
85
|
-
"en": "dependency and configuration updates\nnew state `inverter.x.derived.alarmsJSON` : json array with intverter alarms (id, name, level) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\nadd ChargeDischargePower for Battery units [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\nadd minimum and maximum temperature for battery packs [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
86
|
-
"de": "abhängigkeits- und konfigurationsupdates\nneuer Zustand `inverter.x.derived.alarmsJSON`: json array with intverter alarms (id, name, level) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\nadd ChargeDischargePower for Battery Units [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\nmindest- und Höchsttemperatur für Akkupacks [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
87
|
-
"ru": "обновления зависимостей и конфигурации\njson array with intverter alarms (id, name, level) [#226] (https://github.com/bolliy/ioBroker.sun2000/issues/226)\nдобавить ChargeDischargePower для батарейных блоков [#234] (https://github.com/bolliy/ioBroker.sun2000/issues/234)\nдобавить минимальную и максимальную температуру для аккумуляторных батарей [#236] (https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
88
|
-
"pt": "atualizações de dependência e configuração\nnovo estado `inverter.x.derived.alarmsJSON` : json array com alarmes de inversor (id, name, level) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\nadicionar ChargeDischargePower for Battery units [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\nadicionar temperatura mínima e máxima para pacotes de bateria [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
89
|
-
"nl": "afhankelijkheid en configuratie-updates\nnieuwe staat \nchargeDischargePower for Battery units [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\nminimum- en maximumtemperatuur toevoegen voor batterijpakketten [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
90
|
-
"fr": "mises à jour de la dépendance et de la configuration\nnouvel état `inverter.x.derived.alarmsJSON` : tableau json avec alarmes d'intverter (id, nom, niveau) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\najouter ChargeDischargePower pour les unités de batterie [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\najouter la température minimale et maximale pour les batteries [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
91
|
-
"it": "aggiornamenti di dipendenza e configurazione\nnuovo stato `inverter.x.derived.alarmsJSON` : json array con allarme intverter (id, nome, livello) [#226](https://github.com/bolliy/ioBroker.sun2000/problems/226)\naggiungi ChargeDischargePower per batterie [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\naggiungere la temperatura minima e massima per le batterie [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
92
|
-
"es": "actualizaciones de dependencia y configuración\nnuevo estado `inverter.x.derived.alarmsJSON` : json array with intverter alarms (id, name, level) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)\nañadir ChargeDischargePower for Battery units [#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\nañadir la temperatura mínima y máxima para los paquetes de baterías [#236](https://github.com/bolliy/ioBroker.sun2000/issues/236)",
|
|
93
|
-
"pl": "aktualizacje zależności i konfiguracji\nnowość \"inverter.x.derived.alarmsJSON\": tablica json z alarmami intverter (id, name, level) [# 226] (https: / / github.com / bolliy / ioBroker.sun2000 / issues / 226)\ndata umieszczenia w wykazie\ndodać minimalną i maksymalną temperaturę dla baterii [# 236] (https: / / github.com / bolliy / ioBroker.sun2000 / issues / 236)",
|
|
94
|
-
"uk": "оновлення залежності та конфігурації\nновий стан `inverter.x.derived.alarmsJSON` : json array with intverter тривоги (id, назва, рівень) [#226](https://github.com/bolliy/ioBroker.sun2000/products/226)\nadd ChargeDischargePower для батарей [#234](https://github.com/bolliy/ioBroker.sun2000/products/234)\nдодайте мінімальну і максимальну температуру для акумуляторних пакетів [#236](https://github.com/bolliy/ioBroker.sun2000/products/236)",
|
|
95
|
-
"zh-cn": "依赖和配置更新\nnew state `inverter.x. inducted.alarmsJSON ' : json 数组带内置式警报器(id, name, level) [# 226] (https://github.com/bolliy/ioBroker.sun2000/issues/226) (中文(简体) )\n添加电池单位充电放电器[#234](https://github.com/bolliy/ioBroker.sun2000/issues/234)\n增加电池包的最低和最高温度[第236号](https://github.com/bolliy/ioBroker.sun2000/issues/236)"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -251,7 +251,8 @@
|
|
|
251
251
|
"ds_bu": true,
|
|
252
252
|
"ds_bp": false,
|
|
253
253
|
"cb_tou": false,
|
|
254
|
-
"integration": 0
|
|
254
|
+
"integration": 0,
|
|
255
|
+
"stat_liveInterval": 5
|
|
255
256
|
},
|
|
256
257
|
"objects": [],
|
|
257
258
|
"instanceObjects": [
|
|
@@ -285,7 +286,7 @@
|
|
|
285
286
|
"de": "Gerät angeschlossen"
|
|
286
287
|
},
|
|
287
288
|
"type": "boolean",
|
|
288
|
-
"role": "
|
|
289
|
+
"role": "sensor",
|
|
289
290
|
"read": true,
|
|
290
291
|
"write": false,
|
|
291
292
|
"desc": "Is the device connected?"
|
|
@@ -300,7 +301,7 @@
|
|
|
300
301
|
"de": "Geräte IP"
|
|
301
302
|
},
|
|
302
303
|
"type": "string",
|
|
303
|
-
"role": "
|
|
304
|
+
"role": "text",
|
|
304
305
|
"read": true,
|
|
305
306
|
"write": false,
|
|
306
307
|
"desc": "Device IP address"
|
|
@@ -315,7 +316,7 @@
|
|
|
315
316
|
"de": "Modbusport"
|
|
316
317
|
},
|
|
317
318
|
"type": "number",
|
|
318
|
-
"role": "
|
|
319
|
+
"role": "value",
|
|
319
320
|
"read": true,
|
|
320
321
|
"write": false,
|
|
321
322
|
"desc": "Device modbus port"
|
|
@@ -330,7 +331,7 @@
|
|
|
330
331
|
"de": "Modbus IDs der Geräte"
|
|
331
332
|
},
|
|
332
333
|
"type": "string",
|
|
333
|
-
"role": "
|
|
334
|
+
"role": "text",
|
|
334
335
|
"read": true,
|
|
335
336
|
"write": false,
|
|
336
337
|
"desc": "device modbus IDs"
|
|
@@ -345,7 +346,7 @@
|
|
|
345
346
|
"de": "modbus Update Intervall"
|
|
346
347
|
},
|
|
347
348
|
"type": "number",
|
|
348
|
-
"role": "
|
|
349
|
+
"role": "time.interval",
|
|
349
350
|
"read": true,
|
|
350
351
|
"write": false,
|
|
351
352
|
"desc": "modbus update interval",
|
|
@@ -361,7 +362,7 @@
|
|
|
361
362
|
"de": "modbus timeout"
|
|
362
363
|
},
|
|
363
364
|
"type": "number",
|
|
364
|
-
"role": "
|
|
365
|
+
"role": "time.timeout",
|
|
365
366
|
"read": true,
|
|
366
367
|
"write": false,
|
|
367
368
|
"desc": "modbus timeout",
|
|
@@ -377,7 +378,7 @@
|
|
|
377
378
|
"de": "modbus delay"
|
|
378
379
|
},
|
|
379
380
|
"type": "number",
|
|
380
|
-
"role": "
|
|
381
|
+
"role": "time.span",
|
|
381
382
|
"read": true,
|
|
382
383
|
"write": false,
|
|
383
384
|
"desc": "delay between modbus requests",
|
|
@@ -393,7 +394,7 @@
|
|
|
393
394
|
"de": "modbus connect delay"
|
|
394
395
|
},
|
|
395
396
|
"type": "number",
|
|
396
|
-
"role": "
|
|
397
|
+
"role": "time.span",
|
|
397
398
|
"read": true,
|
|
398
399
|
"write": false,
|
|
399
400
|
"desc": "delay after modbus connected",
|
|
@@ -409,7 +410,7 @@
|
|
|
409
410
|
"de": "Gesundheitsinformation"
|
|
410
411
|
},
|
|
411
412
|
"type": "string",
|
|
412
|
-
"role": "
|
|
413
|
+
"role": "json",
|
|
413
414
|
"read": true,
|
|
414
415
|
"write": false,
|
|
415
416
|
"desc": "",
|
|
@@ -425,7 +426,7 @@
|
|
|
425
426
|
"de": "modbus Server aktiv"
|
|
426
427
|
},
|
|
427
428
|
"type": "boolean",
|
|
428
|
-
"role": "
|
|
429
|
+
"role": "sensor",
|
|
429
430
|
"read": true,
|
|
430
431
|
"write": false,
|
|
431
432
|
"desc": "",
|
|
@@ -12,7 +12,7 @@ class ServiceQueueMap {
|
|
|
12
12
|
this._eventMap = new Map();
|
|
13
13
|
this._initialized = false;
|
|
14
14
|
this._name = 'inverter control';
|
|
15
|
-
this._emmaAvailable = this.adapter.devices.find(d => d.driverClass == driverClasses.emma);
|
|
15
|
+
//this._emmaAvailable = this.adapter.devices.find(d => d.driverClass == driverClasses.emma);
|
|
16
16
|
|
|
17
17
|
this.serviceFields = [
|
|
18
18
|
{
|
|
@@ -9,6 +9,7 @@ class DriverBase {
|
|
|
9
9
|
this.adapter = stateInstance.adapter;
|
|
10
10
|
this.stateCache = stateInstance.stateCache;
|
|
11
11
|
this.deviceInfo = device;
|
|
12
|
+
|
|
12
13
|
this._modbusClient = null; //NEW!!
|
|
13
14
|
//https://wiki.selfhtml.org/wiki/JavaScript/Operatoren/Nullish_Coalescing_Operator
|
|
14
15
|
//https://stackoverflow.com/questions/2851404/what-does-options-options-mean-in-javascript
|
|
@@ -77,7 +78,7 @@ class DriverBase {
|
|
|
77
78
|
* @returns {boolean} True if the device is in test mode, false otherwise
|
|
78
79
|
*/
|
|
79
80
|
isTestMode() {
|
|
80
|
-
return false;
|
|
81
|
+
return this.deviceInfo.testMode ?? false;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
logHoldingRegisters(startAddr, length) {
|
|
@@ -10,6 +10,10 @@ class Emma extends DriverBase {
|
|
|
10
10
|
...options,
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
+
if (this.isTestMode()) {
|
|
14
|
+
this._modbusId = 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
this.control = new ServiceQueueMap(this.adapter, this.deviceInfo); //emma service queue
|
|
14
18
|
|
|
15
19
|
//https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md
|
|
@@ -590,6 +594,10 @@ class Emma extends DriverBase {
|
|
|
590
594
|
this.log.debug(`### PostHook indentification for Inverter Sun2000 - ret: ${JSON.stringify(ret)}`);
|
|
591
595
|
//check if inverter sun2000 already exists
|
|
592
596
|
const inverterExist = this.adapter.devices.findIndex(x => x.driverClass === driverClasses.inverter);
|
|
597
|
+
//TestMode
|
|
598
|
+
if (this.isTestMode() && ret.length === 0) {
|
|
599
|
+
ret.push({ slave_id: 1 });
|
|
600
|
+
}
|
|
593
601
|
for (const [i, inverter] of ret.entries()) {
|
|
594
602
|
this.log.info(`${this._name} identify subdevice an inverter sun2000: OID=${inverter.obj_id}, modbus id: ${inverter.slave_id}`);
|
|
595
603
|
//unless inverters are configured, add them
|
|
@@ -707,9 +715,9 @@ class Emma extends DriverBase {
|
|
|
707
715
|
type: 'number',
|
|
708
716
|
unit: 'kW',
|
|
709
717
|
role: 'value.power',
|
|
710
|
-
desc: 'reg:
|
|
718
|
+
desc: 'reg:31665, len:2',
|
|
711
719
|
},
|
|
712
|
-
register: { reg:
|
|
720
|
+
register: { reg: 31665, type: dataType.int32, gain: 1000 },
|
|
713
721
|
},
|
|
714
722
|
{
|
|
715
723
|
state: {
|
|
@@ -718,9 +726,9 @@ class Emma extends DriverBase {
|
|
|
718
726
|
type: 'number',
|
|
719
727
|
unit: 'kW',
|
|
720
728
|
role: 'value.power',
|
|
721
|
-
desc: 'reg:
|
|
729
|
+
desc: 'reg:31667, len:2',
|
|
722
730
|
},
|
|
723
|
-
register: { reg:
|
|
731
|
+
register: { reg: 31667, type: dataType.int32, gain: 1000 },
|
|
724
732
|
},
|
|
725
733
|
{
|
|
726
734
|
state: {
|
|
@@ -729,9 +737,9 @@ class Emma extends DriverBase {
|
|
|
729
737
|
type: 'number',
|
|
730
738
|
unit: 'kW',
|
|
731
739
|
role: 'value.power',
|
|
732
|
-
desc: 'reg:
|
|
740
|
+
desc: 'reg:31669, len:2',
|
|
733
741
|
},
|
|
734
|
-
register: { reg:
|
|
742
|
+
register: { reg: 31669, type: dataType.int32, gain: 1000 },
|
|
735
743
|
},
|
|
736
744
|
{
|
|
737
745
|
state: {
|
|
@@ -804,16 +812,6 @@ class Emma extends DriverBase {
|
|
|
804
812
|
|
|
805
813
|
this.registerFields.push.apply(this.registerFields, newFields);
|
|
806
814
|
}
|
|
807
|
-
|
|
808
|
-
// Override
|
|
809
|
-
/**
|
|
810
|
-
* Checks if the device is in test mode
|
|
811
|
-
* @returns {boolean} True if the device is in test mode, false otherwise
|
|
812
|
-
* A device is considered in test mode if its modbus ID is not equal to 0.
|
|
813
|
-
*/
|
|
814
|
-
isTestMode() {
|
|
815
|
-
return this.modbusId !== 0;
|
|
816
|
-
}
|
|
817
815
|
}
|
|
818
816
|
|
|
819
817
|
class EmmaCharger extends DriverBase {
|
|
@@ -103,6 +103,20 @@ class InverterSun2000 extends DriverBase {
|
|
|
103
103
|
this.activePowerSum.setStart(state?.val, state?.ts);
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
+
/*
|
|
107
|
+
this.chargeSumHelper = new RiemannSum();
|
|
108
|
+
this.adapter.getState(`${this.deviceInfo.path}.battery.currentDayChargeCapacity`, (err, state) => {
|
|
109
|
+
if (!err && state) {
|
|
110
|
+
this.chargeSumHelper.setStart(state?.val, state?.ts, false);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
this.dischargeSumHelper = new RiemannSum();
|
|
114
|
+
this.adapter.getState(`${this.deviceInfo.path}.battery.currentDayDischargeCapacity`, (err, state) => {
|
|
115
|
+
if (!err && state) {
|
|
116
|
+
this.dischargeSumHelper.setStart(state?.val, state?.ts, false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
*/
|
|
106
120
|
|
|
107
121
|
this.control = new ServiceQueueMap(this.adapter, this.deviceInfo);
|
|
108
122
|
|
|
@@ -222,6 +236,37 @@ class InverterSun2000 extends DriverBase {
|
|
|
222
236
|
],
|
|
223
237
|
//Check if the address field is active
|
|
224
238
|
checkIfActive: () => this._batteryExists(),
|
|
239
|
+
/*
|
|
240
|
+
postHook: path => {
|
|
241
|
+
//calculate daily charge and discharge capacity
|
|
242
|
+
const chargeDischargePower = this.stateCache.get(`${path}battery.chargeDischargePower`)?.value ?? 0;
|
|
243
|
+
if (chargeDischargePower > 0) this.chargeSumHelper.add(chargeDischargePower); //riemann Sum for charge power
|
|
244
|
+
if (chargeDischargePower < 0) this.dischargeSumHelper.add(-chargeDischargePower); //riemann Sum for discharge power
|
|
245
|
+
|
|
246
|
+
const now = new Date();
|
|
247
|
+
const minute = now.getMinutes();
|
|
248
|
+
const hour = now.getHours();
|
|
249
|
+
//reset at 00:00 - until 00:05 if the inverter is a bit late with the update
|
|
250
|
+
if (hour !== 0 || minute > 5) {
|
|
251
|
+
const currentDayChargeCapacity = this.stateCache.get(`${path}battery.currentDayChargeCapacity`)?.value;
|
|
252
|
+
if (currentDayChargeCapacity !== undefined) {
|
|
253
|
+
if (!this.chargeSumHelper.startInitialized || currentDayChargeCapacity > this.chargeSumHelper.sum) {
|
|
254
|
+
this.chargeSumHelper.setStart(currentDayChargeCapacity);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const currentDayDischargeCapacity = this.stateCache.get(`${path}battery.currentDayDischargeCapacity`)?.value;
|
|
259
|
+
if (currentDayDischargeCapacity !== undefined) {
|
|
260
|
+
if (!this.dischargeSumHelper.startInitialized || currentDayDischargeCapacity > this.dischargeSumHelper.sum) {
|
|
261
|
+
this.dischargeSumHelper.setStart(currentDayDischargeCapacity);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.stateCache.set(`${path}battery.statistics.currentDayChargeCapacity`, this.chargeSumHelper.sum, { type: 'number', stored: true }); //stored for statistics
|
|
267
|
+
this.stateCache.set(`${path}battery.statistics.currentDayDischargeCapacity`, this.dischargeSumHelper.sum, { type: 'number', stored: true }); //stored for statistics
|
|
268
|
+
},
|
|
269
|
+
*/
|
|
225
270
|
},
|
|
226
271
|
{
|
|
227
272
|
address: 32064,
|
|
@@ -236,7 +281,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
236
281
|
name: 'Input power',
|
|
237
282
|
type: 'number',
|
|
238
283
|
unit: 'kW',
|
|
239
|
-
role: 'value.power
|
|
284
|
+
role: 'value.power',
|
|
240
285
|
desc: 'reg:32064, len:2, Power from solar',
|
|
241
286
|
},
|
|
242
287
|
register: { reg: 32064, type: dataType.int32, gain: 1000 },
|
|
@@ -465,7 +510,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
465
510
|
name: 'Total charge',
|
|
466
511
|
type: 'number',
|
|
467
512
|
unit: 'kWh',
|
|
468
|
-
role: 'value.power.
|
|
513
|
+
role: 'value.power.consumed',
|
|
469
514
|
desc: 'reg:38238, len:2',
|
|
470
515
|
},
|
|
471
516
|
register: { reg: 38238, type: dataType.uint32, gain: 100 },
|
|
@@ -476,7 +521,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
476
521
|
name: 'Total discharge',
|
|
477
522
|
type: 'number',
|
|
478
523
|
unit: 'kWh',
|
|
479
|
-
role: 'value.power.
|
|
524
|
+
role: 'value.power.produced',
|
|
480
525
|
desc: 'reg:38240, len:2',
|
|
481
526
|
},
|
|
482
527
|
register: { reg: 38240, type: dataType.uint32, gain: 100 },
|
|
@@ -508,7 +553,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
508
553
|
name: 'Total charge',
|
|
509
554
|
type: 'number',
|
|
510
555
|
unit: 'kWh',
|
|
511
|
-
role: 'value.power.
|
|
556
|
+
role: 'value.power.consumed',
|
|
512
557
|
desc: 'reg:38280, len:2',
|
|
513
558
|
},
|
|
514
559
|
register: { reg: 38280, type: dataType.uint32, gain: 100 },
|
|
@@ -519,7 +564,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
519
564
|
name: 'Total discharge',
|
|
520
565
|
type: 'number',
|
|
521
566
|
unit: 'kWh',
|
|
522
|
-
role: 'value.power.
|
|
567
|
+
role: 'value.power.produced',
|
|
523
568
|
desc: 'reg:38282, len:2',
|
|
524
569
|
},
|
|
525
570
|
register: { reg: 38282, type: dataType.uint32, gain: 100 },
|
|
@@ -551,7 +596,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
551
596
|
name: 'Total charge',
|
|
552
597
|
type: 'number',
|
|
553
598
|
unit: 'kWh',
|
|
554
|
-
role: 'value.power.
|
|
599
|
+
role: 'value.power.consumed',
|
|
555
600
|
desc: 'reg:38322, len:2',
|
|
556
601
|
},
|
|
557
602
|
register: { reg: 38322, type: dataType.uint32, gain: 100 },
|
|
@@ -562,7 +607,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
562
607
|
name: 'Total discharge',
|
|
563
608
|
type: 'number',
|
|
564
609
|
unit: 'kWh',
|
|
565
|
-
role: 'value.power.
|
|
610
|
+
role: 'value.power.produced',
|
|
566
611
|
desc: 'reg:38324, len:2',
|
|
567
612
|
},
|
|
568
613
|
register: { reg: 38324, type: dataType.uint32, gain: 100 },
|
|
@@ -843,7 +888,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
843
888
|
name: 'Total charge',
|
|
844
889
|
type: 'number',
|
|
845
890
|
unit: 'kWh',
|
|
846
|
-
role: 'value.power.
|
|
891
|
+
role: 'value.power.consumed',
|
|
847
892
|
desc: 'reg:37780, len:2',
|
|
848
893
|
},
|
|
849
894
|
register: { reg: 37780, type: dataType.uint32, gain: 100 },
|
|
@@ -854,7 +899,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
854
899
|
name: 'Total discharge',
|
|
855
900
|
type: 'number',
|
|
856
901
|
unit: 'kWh',
|
|
857
|
-
role: 'value.power.
|
|
902
|
+
role: 'value.power.produced',
|
|
858
903
|
desc: 'reg:37782, len:2',
|
|
859
904
|
},
|
|
860
905
|
register: { reg: 37782, type: dataType.uint32, gain: 100 },
|
|
@@ -865,10 +910,11 @@ class InverterSun2000 extends DriverBase {
|
|
|
865
910
|
name: 'Current day charge capacity',
|
|
866
911
|
type: 'number',
|
|
867
912
|
unit: 'kWh',
|
|
868
|
-
role: 'value.power.
|
|
913
|
+
role: 'value.power.consumed',
|
|
869
914
|
desc: 'reg:37784, len:2',
|
|
870
915
|
},
|
|
871
916
|
register: { reg: 37784, type: dataType.uint32, gain: 100 },
|
|
917
|
+
//store: storeType.never,
|
|
872
918
|
},
|
|
873
919
|
{
|
|
874
920
|
state: {
|
|
@@ -876,10 +922,11 @@ class InverterSun2000 extends DriverBase {
|
|
|
876
922
|
name: 'Current day discharge capacity',
|
|
877
923
|
type: 'number',
|
|
878
924
|
unit: 'kWh',
|
|
879
|
-
role: 'value.power.
|
|
925
|
+
role: 'value.power.produced',
|
|
880
926
|
desc: 'reg:37786, len:2',
|
|
881
927
|
},
|
|
882
928
|
register: { reg: 37786, type: dataType.uint32, gain: 100 },
|
|
929
|
+
//store: storeType.never,
|
|
883
930
|
},
|
|
884
931
|
],
|
|
885
932
|
checkIfActive: () => this._batteryExists(),
|
|
@@ -1466,7 +1513,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1466
1513
|
name: 'Positive active energy',
|
|
1467
1514
|
type: 'number',
|
|
1468
1515
|
unit: 'kWh',
|
|
1469
|
-
role: 'value.power.
|
|
1516
|
+
role: 'value.power.produced',
|
|
1470
1517
|
desc: 'reg:37119, len:2',
|
|
1471
1518
|
},
|
|
1472
1519
|
register: { reg: 37119, type: dataType.int32, gain: 100 },
|
|
@@ -1477,7 +1524,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1477
1524
|
name: 'Reverse active energy',
|
|
1478
1525
|
type: 'number',
|
|
1479
1526
|
unit: 'kWh',
|
|
1480
|
-
role: 'value.power.
|
|
1527
|
+
role: 'value.power.consumed',
|
|
1481
1528
|
desc: 'reg:37121, len:2',
|
|
1482
1529
|
},
|
|
1483
1530
|
register: { reg: 37121, type: dataType.int32, gain: 100 },
|
|
@@ -1488,7 +1535,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1488
1535
|
name: 'Accumulated reactive power',
|
|
1489
1536
|
type: 'number',
|
|
1490
1537
|
unit: 'kVarh',
|
|
1491
|
-
role: 'value.power.reactive.
|
|
1538
|
+
role: 'value.power.reactive.consumed',
|
|
1492
1539
|
desc: 'reg:37123, len:2',
|
|
1493
1540
|
},
|
|
1494
1541
|
register: { reg: 37123, type: dataType.int32, gain: 100 },
|
|
@@ -1643,7 +1690,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1643
1690
|
name: 'Portal yield today',
|
|
1644
1691
|
type: 'number',
|
|
1645
1692
|
unit: 'kWh',
|
|
1646
|
-
role: 'value.power.
|
|
1693
|
+
role: 'value.power.produced',
|
|
1647
1694
|
desc: 'yield from the portal',
|
|
1648
1695
|
},
|
|
1649
1696
|
fn: path => {
|
|
@@ -1666,7 +1713,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1666
1713
|
name: 'Solar yield today',
|
|
1667
1714
|
type: 'number',
|
|
1668
1715
|
unit: 'kWh',
|
|
1669
|
-
role: 'value.power.
|
|
1716
|
+
role: 'value.power.produced',
|
|
1670
1717
|
desc: 'Riemann sum of input power with efficiency loss',
|
|
1671
1718
|
},
|
|
1672
1719
|
fn: path => {
|
|
@@ -1680,7 +1727,7 @@ class InverterSun2000 extends DriverBase {
|
|
|
1680
1727
|
name: 'Active Energy today',
|
|
1681
1728
|
type: 'number',
|
|
1682
1729
|
unit: 'kWh',
|
|
1683
|
-
role: 'value.power.
|
|
1730
|
+
role: 'value.power.produced',
|
|
1684
1731
|
desc: 'Amount of Riemann sum of sum of active power',
|
|
1685
1732
|
},
|
|
1686
1733
|
fn: path => {
|
|
@@ -2104,7 +2151,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2104
2151
|
name: 'Total charge',
|
|
2105
2152
|
type: 'number',
|
|
2106
2153
|
unit: 'kWh',
|
|
2107
|
-
role: 'value.power.
|
|
2154
|
+
role: 'value.power.consumed',
|
|
2108
2155
|
desc: 'reg:38364, len:2',
|
|
2109
2156
|
},
|
|
2110
2157
|
register: { reg: 38364, type: dataType.uint32, gain: 100 },
|
|
@@ -2115,7 +2162,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2115
2162
|
name: 'Total discharge',
|
|
2116
2163
|
type: 'number',
|
|
2117
2164
|
unit: 'kWh',
|
|
2118
|
-
role: 'value.power.
|
|
2165
|
+
role: 'value.power.produced',
|
|
2119
2166
|
desc: 'reg:38366, len:2',
|
|
2120
2167
|
},
|
|
2121
2168
|
register: { reg: 38366, type: dataType.uint32, gain: 100 },
|
|
@@ -2147,7 +2194,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2147
2194
|
name: 'Total charge',
|
|
2148
2195
|
type: 'number',
|
|
2149
2196
|
unit: 'kWh',
|
|
2150
|
-
role: 'value.power.
|
|
2197
|
+
role: 'value.power.consumed',
|
|
2151
2198
|
desc: 'reg:38406, len:2',
|
|
2152
2199
|
},
|
|
2153
2200
|
register: { reg: 38406, type: dataType.uint32, gain: 100 },
|
|
@@ -2158,7 +2205,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2158
2205
|
name: 'Total discharge',
|
|
2159
2206
|
type: 'number',
|
|
2160
2207
|
unit: 'kWh',
|
|
2161
|
-
role: 'value.power.
|
|
2208
|
+
role: 'value.power.produced',
|
|
2162
2209
|
desc: 'reg:38408, len:2',
|
|
2163
2210
|
},
|
|
2164
2211
|
register: { reg: 38408, type: dataType.uint32, gain: 100 },
|
|
@@ -2190,7 +2237,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2190
2237
|
name: 'Total charge',
|
|
2191
2238
|
type: 'number',
|
|
2192
2239
|
unit: 'kWh',
|
|
2193
|
-
role: 'value.power.
|
|
2240
|
+
role: 'value.power.consumed',
|
|
2194
2241
|
desc: 'reg:38448, len:2',
|
|
2195
2242
|
},
|
|
2196
2243
|
register: { reg: 38448, type: dataType.uint32, gain: 100 },
|
|
@@ -2201,7 +2248,7 @@ class InverterSun2000_M1 extends InverterSun2000 {
|
|
|
2201
2248
|
name: 'Total discharge',
|
|
2202
2249
|
type: 'number',
|
|
2203
2250
|
unit: 'kWh',
|
|
2204
|
-
role: 'value.power.
|
|
2251
|
+
role: 'value.power.produced',
|
|
2205
2252
|
desc: 'reg:38450, len:2',
|
|
2206
2253
|
},
|
|
2207
2254
|
register: { reg: 38450, type: dataType.uint32, gain: 100 },
|