iobroker.sun2000 0.17.0 → 0.17.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 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
+ ### 0.17.1 (2024-11-21)
69
+ * during the device status "Standby: detecting irradiation" (0x0002) register data is now also read from the inverter
70
+ * The reading order of the battery data has been adjusted
71
+
68
72
  ### 0.17.0 (2024-11-05)
69
73
  * adjust for Responsive Design #134
70
74
  * migrate to ESLint 9.x
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sun2000",
4
- "version": "0.17.0",
4
+ "version": "0.17.1",
5
5
  "news": {
6
+ "0.17.1": {
7
+ "en": "during the device status \"Standby: detecting irradiation\" (0x0002) register data is now also read from the inverter\nThe reading order of the battery data has been adjusted",
8
+ "de": "während des Gerätestatus \"Standby: Detektion von Bestrahlung\" (0x0002) werden nun auch Registerdaten aus dem Wechselrichter gelesen\nDie Lesereihenfolge der Batteriedaten wurde angepasst",
9
+ "ru": "во время состояния устройства «Стандби: обнаружение облучения» (0x0002) данные регистров теперь также читаются из инвертора\nПорядок чтения данных батареи был скорректирован",
10
+ "pt": "durante o status do dispositivo \"Standby: detecção de irradiação\" (0x0002) dados de registro agora também é lido a partir do inversor\nA ordem de leitura dos dados da bateria foi ajustada",
11
+ "nl": "tijdens de apparaatstatus \"Standby: detectie van bestraling\" (0x0002) worden nu ook gegevens van de omvormer gelezen\nDe leesvolgorde van de batterijgegevens is aangepast",
12
+ "fr": "pendant l'état de l'appareil \"Standby: détecter l'irradiation\" (0x0002) les données du registre sont maintenant également lues à partir de l'onduleur\nL'ordre de lecture des données de la batterie a été ajusté",
13
+ "it": "durante lo stato del dispositivo \"Standby: rilevamento dell'irradiazione\" (0x0002) i dati di registro sono ora letti anche dall'inverter\nL'ordine di lettura dei dati della batteria è stato regolato",
14
+ "es": "durante el estado del dispositivo \"Standby: detecting irradiation\" (0x0002) datos del registro ahora también se lee desde el inversor\nEl orden de lectura de los datos de la batería se ha ajustado",
15
+ "pl": "podczas statusu urządzenia \"Standby: detection irradiation\" (0x0002) dane rejestru są teraz również odczytywane z inwertera\nKolejność odczytu danych baterii została dostosowana",
16
+ "uk": "при статусі пристрою \"Стандарт: виявлення опромінення\" (0x0002) реєстраційні дані тепер також читайте з інвертора\nВиправлено порядок читання даних акумулятора",
17
+ "zh-cn": "在设备状态“ Standby: 检测辐照” (0x0002) 注册数据现在也从反转器读取\n电池数据的读取顺序已调整"
18
+ },
6
19
  "0.17.0": {
7
20
  "en": "adjust for Responsive Design #134\nmigrate to ESLint 9.x\nnode >= v18.18.0\nmodbus-proxy: enabled reading data via input register",
8
21
  "de": "anpassung für Responsive Design #134\nmigration auf ESLint 9.x\nknoten >= v18.18.0\nmodbus-proxy: lesedaten über eingaberegister aktiviert",
@@ -80,19 +93,6 @@
80
93
  "pl": "dostosowanie do projektu Responsive Design # 121\nblokada asynchronicznego kodu modbusa\nzapisywanie danych za pośrednictwem modbus- proxy # 119\nprzeczytaj dodatkowe dane rejestru Huawei Emma",
81
94
  "uk": "регульований для відповідального дизайну #121\nблокування на коді asynchronous modbus\nнаписання даних через modbus-proxy #119\nчитати додаткові реєстраційні дані Huawei Emma",
82
95
  "zh-cn": "适应设计 # 121\n锁定同步调制解码\n通过modbus- 代理 119 写入数据\n读取 Huawei Emma 的额外注册数据"
83
- },
84
- "0.13.0": {
85
- "en": "improve Modbus reconnection #116\nconfiguration update\nsimple Integration of Huawei Emma (Huawei Energy Management Assistant) #63",
86
- "de": "modbus-Reconnection #116 verbessern\nkonfigurationsupdate\neinfache Integration von Huawei Emma (Huawei Energy Management Assistant) #63",
87
- "ru": "#116\nобновление\nпростая интеграция Huawei Эмма (Huawei Energy Management Assistant) #63",
88
- "pt": "melhorar a reconexão Modbus #116\natualização de configuração\nsimples integração de Huawei Emma (Huawei Energy Management Assistant) #63",
89
- "nl": "modbus reconnectie #116 verbeteren\nconfiguratie-update\neenvoudige integratie van Huawei Emma (Huawei Energie Management Assistent) #63",
90
- "fr": "améliorer la connexion Modbus #116\nmise à jour de configuration\nsimple intégration de Huawei Emma (Huawei Energy Management Assistant) #63",
91
- "it": "migliorare la riconnessione Modbus #116\naggiornamento configurazione\nintegrazione semplice di Huawei Emma (Huawei Energy Management Assistant) #63",
92
- "es": "mejorar la reconexión Modbus #116\nactualización de configuración\nsimple integración de Huawei Emma (Auxiliador de Gestión de Energía de Huawei) #63",
93
- "pl": "poprawić ponowne połączenie Modbus # 116\naktualizacja konfiguracji\nprosta integracja Huawei Emma (Huawei Energy Management Assistant) # 63",
94
- "uk": "поліпшення відключення Modbus #116\nоновлення конфігурації\nпроста інтеграція Huawei Emma (Huawei Energy Management Assistant) #63",
95
- "zh-cn": "改进 Modbus 重联 # 116\n配置更新\n简单整合Huawei Emma(Huawei能源管理助理)#63"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -200,6 +200,7 @@ class InverterSun2000 extends DriverBase{
200
200
  length : 2,
201
201
  info : 'meter activePower',
202
202
  refresh : dataRefreshRate.high,
203
+ //standby : true,
203
204
  type : deviceType.meter,
204
205
  states: [{
205
206
  state: {id: 'meter.activePower', name: 'ActivePower', type: 'number', unit: 'kW', role: 'value.power.active', desc: 'reg:37113, len:2 (>0: feed-in to grid. <0: supply from grid.)' },
@@ -452,6 +453,53 @@ class InverterSun2000 extends DriverBase{
452
453
  ],
453
454
  checkIfActive: () => this._batteryExists()
454
455
  },
456
+ {
457
+ address : 37758,
458
+ length : 30,
459
+ info : 'battery information',
460
+ refresh : dataRefreshRate.low,
461
+ type : deviceType.battery,
462
+ states: [
463
+ {
464
+ state: {id: 'battery.ratedCapacity', name: 'Rated Capacity', type: 'number', unit: 'Wh', role: 'value.capacity', desc: 'reg:37758, len:2'},
465
+ register: {reg: 37758, type: dataType.uint32}
466
+ },
467
+ {
468
+ state: {id: 'battery.SOC', name: 'State of capacity', type: 'number', unit: '%', role: 'value.battery', desc: 'reg:37760, len:1'},
469
+ register: {reg: 37760, type: dataType.uint16, gain: 10}
470
+ },
471
+ {
472
+ state: {id: 'battery.runningStatus', name: 'Running status', type: 'string', role: 'value', desc: 'reg:37762, len:1'},
473
+ register: {reg: 37762, type: dataType.uint16, length: 1},
474
+ mapper: value => Promise.resolve(batteryStatus[value])
475
+ },
476
+ {
477
+ state: {id: 'battery.busVoltage', name: 'Bus Voltage', type: 'number', unit: 'V', role: 'value.voltage', desc: 'reg:37763, len:1'},
478
+ register: {reg: 37763, type: dataType.uint16, gain: 10},
479
+ },
480
+ {
481
+ state: {id: 'battery.busCurrent', name: 'Bus Current', type: 'number', unit: 'A', role: 'value.current', desc: 'reg:37764, len:1'},
482
+ register: {reg: 37764, type: dataType.int16, gain: 10},
483
+ },
484
+ {
485
+ state: {id: 'battery.totalCharge', name: 'Total Charge', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37780, len:2'},
486
+ register: {reg: 37780, type: dataType.uint32, gain: 100}
487
+ },
488
+ {
489
+ state: {id: 'battery.totalDischarge', name: 'Total Discharge', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37782, len:2'},
490
+ register: {reg: 37782, type: dataType.uint32, gain: 100}
491
+ },
492
+ {
493
+ state: {id: 'battery.currentDayChargeCapacity', name: 'Current Day Charge Capacity', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37784, len:2' },
494
+ register: { reg: 37784, type: dataType.uint32, gain: 100 }
495
+ },
496
+ {
497
+ state: {id: 'battery.currentDayDischargeCapacity', name: 'Current Day Discharge Capacity', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37786, len:2' },
498
+ register: { reg: 37786, type: dataType.uint32, gain: 100 }
499
+ }
500
+ ],
501
+ checkIfActive: () => this._batteryExists()
502
+ },
455
503
  { //for NRGKick
456
504
  address : 47000,
457
505
  length : 1,
@@ -503,7 +551,6 @@ class InverterSun2000 extends DriverBase{
503
551
  address : 47101,
504
552
  length : 6,
505
553
  info : 'additional battery information',
506
- //refresh : dataRefreshRate.low,
507
554
  type : deviceType.battery,
508
555
  states: [
509
556
  {
@@ -826,53 +873,6 @@ class InverterSun2000 extends DriverBase{
826
873
  }
827
874
  ]
828
875
  },
829
- {
830
- address : 37758,
831
- length : 30,
832
- info : 'battery information',
833
- refresh : dataRefreshRate.low,
834
- type : deviceType.battery,
835
- states: [
836
- {
837
- state: {id: 'battery.ratedCapacity', name: 'Rated Capacity', type: 'number', unit: 'Wh', role: 'value.capacity', desc: 'reg:37758, len:2'},
838
- register: {reg: 37758, type: dataType.uint32}
839
- },
840
- {
841
- state: {id: 'battery.SOC', name: 'State of capacity', type: 'number', unit: '%', role: 'value.battery', desc: 'reg:37760, len:1'},
842
- register: {reg: 37760, type: dataType.uint16, gain: 10}
843
- },
844
- {
845
- state: {id: 'battery.runningStatus', name: 'Running status', type: 'string', role: 'value', desc: 'reg:37762, len:1'},
846
- register: {reg: 37762, type: dataType.uint16, length: 1},
847
- mapper: value => Promise.resolve(batteryStatus[value])
848
- },
849
- {
850
- state: {id: 'battery.busVoltage', name: 'Bus Voltage', type: 'number', unit: 'V', role: 'value.voltage', desc: 'reg:37763, len:1'},
851
- register: {reg: 37763, type: dataType.uint16, gain: 10},
852
- },
853
- {
854
- state: {id: 'battery.busCurrent', name: 'Bus Current', type: 'number', unit: 'A', role: 'value.current', desc: 'reg:37764, len:1'},
855
- register: {reg: 37764, type: dataType.int16, gain: 10},
856
- },
857
- {
858
- state: {id: 'battery.totalCharge', name: 'Total Charge', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37780, len:2'},
859
- register: {reg: 37780, type: dataType.uint32, gain: 100}
860
- },
861
- {
862
- state: {id: 'battery.totalDischarge', name: 'Total Discharge', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37782, len:2'},
863
- register: {reg: 37782, type: dataType.uint32, gain: 100}
864
- },
865
- {
866
- state: {id: 'battery.currentDayChargeCapacity', name: 'Current Day Charge Capacity', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37784, len:2' },
867
- register: { reg: 37784, type: dataType.uint32, gain: 100 }
868
- },
869
- {
870
- state: {id: 'battery.currentDayDischargeCapacity', name: 'Current Day Discharge Capacity', type: 'number', unit: 'kWh', role: 'value.power.consumption', desc: 'reg:37786, len:2' },
871
- register: { reg: 37786, type: dataType.uint32, gain: 100 }
872
- }
873
- ],
874
- checkIfActive: () => this._batteryExists()
875
- },
876
876
  {
877
877
  //https://photomate.zendesk.com/hc/en-gb/articles/5701625507485-Export-limitation-for-SUN2000-inverters-via-FusionSolar-App
878
878
  address : 47415,
@@ -957,12 +957,6 @@ class InverterSun2000 extends DriverBase{
957
957
  _batteryExists(unit=0,pack=0) {
958
958
  if (unit === 0) {
959
959
  return this.numberBatteryUnits() > 0;
960
- /*
961
- //if (!this.adapter.settings.ds.batteryUnits) return false;
962
- const state1 = this.stateCache.get(this.deviceInfo.path+'.battery.unit.1.SN');
963
- const state2 = this.stateCache.get(this.deviceInfo.path+'.battery.unit.2.SN');
964
- return (state1 && state1.value) || (state2 && state2.value);
965
- */
966
960
  } else {
967
961
  if (pack === 0) {
968
962
  const state = this.stateCache.get(`${this.deviceInfo.path}.battery.unit.${unit}.SN`);
@@ -996,7 +990,7 @@ class InverterSun2000 extends DriverBase{
996
990
  }
997
991
  if (modbusAllowed) {
998
992
  //430 = SUN2000-8KTL-M2
999
- if (this.deviceStatus === 0x0002 && this._modelId < 430) modbusAllowed = false;
993
+ //if (this.deviceStatus === 0x0002 && this._modelId < 430) modbusAllowed = false;
1000
994
  if (this.deviceStatus >= 0x0300 && this.deviceStatus <= 0x0307 ) modbusAllowed = false; //shutdown
1001
995
  //if (this._modelId < 430) modbusAllowed = this.deviceStatus !== 0x0002;
1002
996
  if (this._errorCount > 3) modbusAllowed = false;
@@ -1009,7 +1003,7 @@ class InverterSun2000 extends DriverBase{
1009
1003
  if (modbusAllowed && this.log.quiet) {
1010
1004
  this.log.beQuiet(false);
1011
1005
  this.log.info(`The inverter with modbus ID ${this._modbusId} is accessible again.`);
1012
- this._errorCount = 0;
1006
+ //this._errorCount = 0;
1013
1007
  }
1014
1008
  this._modbusAllowed = modbusAllowed;
1015
1009
  return this._modbusAllowed;
package/lib/register.js CHANGED
@@ -219,10 +219,10 @@ class Registers {
219
219
  for (const [i, reg] of device.instance.registerFields.entries()) {
220
220
  if (!device.instance.modbusAllowed) continue; //standby
221
221
  if (reg.type == deviceType.meter && !device?.meter) continue; //not meter
222
+ if (reg.type == deviceType.gridPowerControl && !device?.meter) continue; //power control v0.8.x
222
223
 
223
224
  if (reg.checkIfActive && !reg.checkIfActive()) continue; //NEW, PATH
224
225
 
225
- if (reg.type == deviceType.gridPowerControl && !device?.meter) continue; //power control v0.8.x
226
226
  if (reg.states && reg.refresh) {
227
227
  const lastread = reg.lastread;
228
228
  const ret = {
package/main.js CHANGED
@@ -468,34 +468,36 @@ class Sun2000 extends utils.Adapter {
468
468
  const sinceLastUpdate = new Date().getTime() - this.lastTimeUpdated; //ms
469
469
  this.logger.debug('### Watchdog: time since last update '+sinceLastUpdate/1000+' sec');
470
470
  const lastIsConnected = this.isConnected;
471
- this.isConnected = this.lastStateUpdatedHigh > 0 && sinceLastUpdate < this.settings.highInterval*3;
471
+ //this.isConnected = this.lastStateUpdatedHigh > 0 && sinceLastUpdate < this.settings.highInterval*3;
472
+ this.isConnected = this.lastStateUpdatedHigh > 0 || this.lastStateUpdatedLow > 0;
473
+
472
474
  if (this.isConnected !== lastIsConnected ) this.setState('info.connection', this.isConnected, true);
473
475
  if (!this.settings.modbusAdjust) {
474
476
  if (!this.isConnected) {
475
477
  this.setState('info.JSONhealth', {val: '{errno:1, message: "Can\'t connect to inverter"}', ack: true});
476
478
  }
477
479
  const ret = this.state.CheckReadError(this.settings.lowInterval*2);
478
- const obj = {...ret,modbus: {...this.modbusClient.info}};
479
480
  this.logger.debug(JSON.stringify(this.modbusClient.info));
480
481
  //v0.8.x
481
482
  if (!this.isReady) this.isReady = this.isConnected && !ret.errno;
482
483
  // after 2 Minutes
483
- if (this.alreadyRunWatchDog) {
484
+ if (this.toggleRunWatchDog) {
484
485
  if (ret.errno) this.logger.warn(ret.message);
486
+ const obj = {...ret,modbus: {...this.modbusClient.info}};
485
487
  this.setState('info.JSONhealth', {val: JSON.stringify(obj), ack: true});
486
- if (this.modbusServer) {
487
- !this.modbusServer.isConnected && this.modbusServer.connect();
488
- if (this.settings.ms.log) {
489
- //const stat = this.modbusServer.info?.stat;
490
- //object is not empty
491
- //if (Object.keys(stat).length > 0) this.log.info('Modbus tcp server: '+JSON.stringify(this.modbusServer.info));
492
- this.logger.info('Modbus tcp server: '+JSON.stringify(this.modbusServer.info));
493
- }
488
+ }
489
+ if (this.modbusServer) {
490
+ !this.modbusServer.isConnected && this.modbusServer.connect();
491
+ if (this.settings.ms.log) {
492
+ //const stat = this.modbusServer.info?.stat;
493
+ //object is not empty
494
+ //if (Object.keys(stat).length > 0) this.log.info('Modbus tcp server: '+JSON.stringify(this.modbusServer.info));
495
+ this.logger.info('Modbus tcp server: '+JSON.stringify(this.modbusServer.info));
494
496
  }
495
497
  }
496
498
  }
497
499
 
498
- if (!this.alreadyRunWatchDog) this.alreadyRunWatchDog = true;
500
+ this.toggleRunWatchDog = !this.toggleRunWatchDog;
499
501
  this.lastStateUpdatedLow = 0;
500
502
  this.lastStateUpdatedHigh = 0;
501
503
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sun2000",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "sun2000",
5
5
  "author": {
6
6
  "name": "bolliy",