iobroker.sun2000 2.0.0 → 2.1.0

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 CHANGED
@@ -65,6 +65,10 @@ 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.1.0 (2025-07-06)
69
+ * emma: system time is being determined [#179](https://github.com/bolliy/ioBroker.sun2000/issues/179)
70
+ * control: add grid power scheduling functionality to inverter driver [#176](https://github.com/bolliy/ioBroker.sun2000/issues/176)
71
+
68
72
  ### 2.0.0 (2025-06-29)
69
73
  * add support for chargers via Emma and save the data in the charger path #171
70
74
  * Establish data consistency between meter.activePower and the power of the meter phases #174
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sun2000",
4
- "version": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "news": {
6
+ "2.1.0": {
7
+ "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)",
8
+ "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)",
9
+ "ru": "emma: системное время определяется [#179] (https://github.com/bolliy/ioBroker.sun2000/issues/179)\nуправление: добавьте функцию планирования мощности сети к драйверу инвертора [#176] (https://github.com/bolliy/ioBroker.sun2000/issues/176)",
10
+ "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)",
11
+ "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)",
12
+ "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)",
13
+ "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)",
14
+ "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)",
15
+ "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)",
16
+ "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)",
17
+ "zh-cn": "emma:系统时间正在确定 [# 179] (https://github.com/bolliy/ioBroker.sun2000/issues/179)\n控制:向反向驱动器添加电网电源调度功能[#176](https://github.com/bolliy/ioBroker.sun2000/issues/1976)"
18
+ },
6
19
  "2.0.0": {
7
20
  "en": "add support for chargers via Emma and save the data in the charger path #171\nEstablish data consistency between meter.activePower and the power of the meter phases #174\nallows `control.battery.chargeFromGridFunction` when using the Emma\nbreaking change: \nthe value `sun2000.x.inverter.x.battery.runningStatus` is saved as a number. The translated value (such as STANDBY, RUNNING etc.) is stored in the path sun2000.x.inverter.x.battery.derived",
8
21
  "de": "unterstützung für Ladegeräte über Emma hinzufügen und die Daten im Ladepfad #171 speichern\nDatenkonsistenz zwischen meter.activePower und der Leistung der Zählerphasen #174 einstellen\nerlaubt `control.battery.chargeFromGridFunction` bei Verwendung der Emma\nänderung:\nder Wert `sun2000.x.inverter.x.battery.runningStatus` wird als Nummer gespeichert. Der übersetzte Wert (wie STANDBY, RUNNING etc.) wird im Pfad sun2000.x.inverter.x.battery.derived gespeichert",
@@ -80,19 +93,6 @@
80
93
  "pl": "uwalnianie testowe",
81
94
  "uk": "тестовий реліз",
82
95
  "zh-cn": "测试发布"
83
- },
84
- "1.1.0": {
85
- "en": "startupTime/shutdownTime are read from the inverter as local time and not as UTC - fixed times are saved in path `derived`\nnew state [usableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus))\ncontrol: checking and rounding integer numbers\nbetter solution for math rounding",
86
- "de": "startzeit/Shutdown Zeit wird vom Wechselrichter als Ortszeit gelesen und nicht als UTC - Festzeiten werden im Pfad gespeichert `derived `\nneuer Staat [usableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus))\nsteuerung: überprüfung und rundung ganzzahliger zahlen\nbessere lösung für matherundung",
87
- "ru": "startupTime/Sutdown Время считывается с инвертора как локальное время, а не как UTC - фиксированное время сохраняется в пути пункт\nновое состояние [usableSurplusPower] (https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus))\nконтроль: проверка и округление целых чисел\nлучшее решение для математического округления",
88
- "pt": "startupTime/shutdown O tempo é lido do inversor como hora local e não como UTC - os tempos fixos são salvos no caminho `derivod \"\nnovo estado [usableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus)))\ncontrole: números inteiros de verificação e arredondamento\nmelhor solução para arredondamento de matemática",
89
- "nl": "opstartenTijd/afsluiten De tijd wordt van de inverter gelezen als lokale tijd en niet als UTC - vaste tijden worden opgeslagen in het pad uit Wat\nnieuwe staat [bruikbaarSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus))\ncontrole: controle en afronding van gehele getallen\nbetere oplossing voor wiskunde afronden",
90
- "fr": "startupTime/shutdown Le temps est lu à partir de l'onduleur en tant qu'heure locale et non pas en tant que UTC - les temps fixes sont sauvegardés dans le chemin « dérivé \"\nnouvel état [utilisableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus))\ncontrôle: contrôle et arrondi des nombres entiers\nmeilleure solution pour arrondir les maths",
91
- "it": "startupTime/shutdown Il tempo viene letto dall'inverter come ora locale e non come UTC - i tempi fissi vengono salvati nel percorso `derivati #\nnuovo stato [usableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(plus)\ncontrollo: controllo e arrotondamento numeri interi\nmigliore soluzione per arrotondamento di matematica",
92
- "es": "startupTime/shutdown El tiempo se lee desde el inversor como hora local y no como UTC - los tiempos fijos se salvan en el camino `derived `\nnuevo estado [utilizableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(superávit))\ncontrol: números enteros de comprobación y redondeo\nmejor solución para redondeo de matemáticas",
93
- "pl": "startupTime / shutdown Czas jest odczytywany z inwertera jako czasu lokalnego, a nie jako UTC - stałe czasy są zapisywane w ścieżce 'pochodnej'\nnową ustawę [usableSurplusPower] (https: / / github.com / bolliy / ioBroker.sun2000 / wiki /% C3% 9Cberschuss- (nadwyżka))\nkontrola: sprawdzanie i zaokrąglanie liczb całkowitych\nlepsze rozwiązanie do zaokrąglania matematycznego",
94
- "uk": "javaScript licenses API Веб-сайт Час читає з інвертора як локальний час, так і не як UTC - виправлені часи зберігаються в шляху `derived й\nновий стан [usableSurplusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9Cberschuss-(surplus)))\nконтроль: перевірка та округлення цілих чисел\nкраще рішення для закруглення математики",
95
- "zh-cn": "启动时间/下调 时间从反转器读作本地时间,而不是世界协调时 - 固定时间保存在路径中`衍生' `\n新状态[可使用SurpusPower](https://github.com/bolliy/ioBroker.sun2000/wiki/%C3%9 Cberschuss-(盈余))\n控件: 检查和四舍五入整数\n更好的数学四舍五入解决方案"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -473,6 +473,57 @@ class ServiceQueueMap {
473
473
  return ret;
474
474
  },
475
475
  },
476
+ //power grid scheduling
477
+ {
478
+ state: {
479
+ id: 'grid.scheduling.activePowerPercentageDerating',
480
+ name: '[power grid scheduling] Active Power percentage derating',
481
+ type: 'number',
482
+ unit: '%',
483
+ role: 'level',
484
+ desc: 'reg:40125, len:1',
485
+ },
486
+ type: deviceType.gridPowerControl,
487
+ fn: async event => {
488
+ if (event.value > 100) {
489
+ event.value = 100;
490
+ }
491
+ if (event.value < 0) {
492
+ event.value = 0;
493
+ }
494
+ const ret = await this._writeRegisters(40125, dataType.numToArray(event.value * 10, dataType.uint16));
495
+ if (ret) {
496
+ this.inverterInfo.instance.stateCache.set(`${this.inverterInfo.path}.${event.id}`, event.value, { type: 'number' });
497
+ }
498
+ return ret;
499
+ },
500
+ },
501
+ {
502
+ state: {
503
+ id: 'grid.scheduling.FixedActivePowerDerated',
504
+ name: '[power grid scheduling] Fixed active power derated',
505
+ type: 'number',
506
+ unit: 'W',
507
+ role: 'level.power',
508
+ desc: 'reg:40126, len:2',
509
+ },
510
+ type: deviceType.gridPowerControl,
511
+ fn: async event => {
512
+ const max = this.inverterInfo.instance.stateCache.get(`${this.inverterInfo.path}.info.ratedPower`)?.value ?? 0;
513
+ //+10%
514
+ if (event.value > max * 1100) {
515
+ event.value = max * 1100;
516
+ }
517
+ if (event.value < 0) {
518
+ event.value = 0;
519
+ }
520
+ const ret = await this._writeRegisters(40126, dataType.numToArray(event.value, dataType.uint32));
521
+ if (ret) {
522
+ this.inverterInfo.instance.stateCache.set(`${this.inverterInfo.path}.${event.id}`, event.value, { type: 'number' });
523
+ }
524
+ return ret;
525
+ },
526
+ },
476
527
  ];
477
528
  }
478
529
 
@@ -186,7 +186,6 @@ class DriverBase {
186
186
  this.log.debug(`Device List: ${JSON.stringify(resp)}`);
187
187
  Object.assign(allInfo, resp);
188
188
  } catch (e) {
189
- //this.log.error(`readDeviceList: No answer for OID=0x${objectId.toString(16).toUpperCase()}: ${e.message}`);
190
189
  throw new Error(`readDeviceList: No answer for OID=0x${objectId.toString(16).toUpperCase()}: ${e.message}`);
191
190
  }
192
191
  const numDevices = parseInt(JSON.stringify(allInfo['135'] || '').replace(/[^0-9]/g, ''));
@@ -698,6 +698,28 @@ class Emma extends DriverBase {
698
698
  },
699
699
  ],
700
700
  },
701
+ {
702
+ address: 40470,
703
+ length: 2,
704
+ info: 'Emma time management',
705
+ refresh: dataRefreshRate.low,
706
+ states: [
707
+ {
708
+ state: { id: 'emma.systemTime', name: 'System time', type: 'number', role: 'value', desc: 'reg:40470, len:2' },
709
+ register: { reg: 40470, type: dataType.uint32 },
710
+ },
711
+ {
712
+ state: { id: 'emma.derived.systemTime', name: 'System time', type: 'number', unit: '', role: 'value.time', desc: 'fixed system time' },
713
+ },
714
+ ],
715
+ postHook: path => {
716
+ function fixTime(value) {
717
+ return value * 1000;
718
+ }
719
+ const systemTime = this.stateCache.get(`${path}emma.systemTime`)?.value;
720
+ this.stateCache.set(`${path}emma.derived.systemTime`, fixTime(systemTime), { type: 'number' });
721
+ },
722
+ },
701
723
  ];
702
724
 
703
725
  this.registerFields.push.apply(this.registerFields, newFields);
@@ -1186,6 +1186,15 @@ class InverterSun2000 extends DriverBase {
1186
1186
  },
1187
1187
  ],
1188
1188
  postHook: path => {
1189
+ /**
1190
+ * Adjusts a given time value by converting it from seconds to milliseconds
1191
+ * and applying the local timezone offset.
1192
+ *
1193
+ * @param {number} value - The time value in seconds to be adjusted. If the
1194
+ * value is greater than zero, it is converted to milliseconds and adjusted
1195
+ * for the local timezone.
1196
+ * @returns {number} - The adjusted time value in milliseconds.
1197
+ */
1189
1198
  function fixTime(value) {
1190
1199
  if (value > 0) {
1191
1200
  value = value * 1000;
@@ -1200,6 +1209,37 @@ class InverterSun2000 extends DriverBase {
1200
1209
  this.stateCache.set(`${path}derived.startupTime`, fixTime(startup), { type: 'number' });
1201
1210
  },
1202
1211
  },
1212
+ {
1213
+ address: 40125,
1214
+ length: 3,
1215
+ info: 'grid power scheduling',
1216
+ refresh: dataRefreshRate.low,
1217
+ type: deviceType.inverter,
1218
+ states: [
1219
+ {
1220
+ state: {
1221
+ id: 'grid.scheduling.activePowerPercentageDerating',
1222
+ name: '[power grid scheduling] Fixed active power derated',
1223
+ type: 'number',
1224
+ unit: '%',
1225
+ role: 'value',
1226
+ desc: 'reg:40125, len:1',
1227
+ },
1228
+ register: { reg: 40125, type: dataType.uint16, gain: 10 },
1229
+ },
1230
+ {
1231
+ state: {
1232
+ id: 'grid.scheduling.FixedActivePowerDerated',
1233
+ name: '[power grid scheduling] Fixed active power derated',
1234
+ type: 'number',
1235
+ unit: 'W',
1236
+ role: 'value.power',
1237
+ desc: 'reg:40126, len:2',
1238
+ },
1239
+ register: { reg: 40126, type: dataType.uint32 },
1240
+ },
1241
+ ],
1242
+ },
1203
1243
  {
1204
1244
  address: 37100,
1205
1245
  length: 38,
package/main.js CHANGED
@@ -475,16 +475,6 @@ class Sun2000 extends utils.Adapter {
475
475
  meter: true,
476
476
  driverClass: driverClasses.emma,
477
477
  });
478
- /*
479
- for (const [i, id] of this.settings.chargerIds.entries()) {
480
- this.devices.push({
481
- index: i,
482
- duration: 0,
483
- modbusId: id,
484
- driverClass: driverClasses.emmaCharger,
485
- });
486
- }
487
- */
488
478
  }
489
479
 
490
480
  await this.adjustInverval();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sun2000",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "sun2000",
5
5
  "author": {
6
6
  "name": "bolliy",