iobroker.sun2000 2.3.6 → 2.3.7

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,9 @@ 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.7 (2026-02-01)
69
+ * deleted deprecated state `collected.usableSurplusPower`
70
+
68
71
  ### 2.3.6 (2026-01-29)
69
72
  * dependency and configuration updates
70
73
  * new state `inverter.x.derived.alarmsJSON` : json array with intverter alarms (id, name, level) [#226](https://github.com/bolliy/ioBroker.sun2000/issues/226)
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sun2000",
4
- "version": "2.3.6",
4
+ "version": "2.3.7",
5
5
  "news": {
6
+ "2.3.7": {
7
+ "en": "deleted deprecated state `collected.usableSurplusPower`",
8
+ "de": "gelöschter deprecated state `collect.usableSurplusPower `",
9
+ "ru": "удаленное устаревшее состояние 'collected.usableSurplusPower пункт",
10
+ "pt": "estado desactualizado excluído `colected.usableSurplusPower `",
11
+ "nl": "verwijderde verouderde staat Wat",
12
+ "fr": "état obsolète supprimé `collected.usableSurplusPower \"",
13
+ "it": "cancellato stato deprecato `colletto.usableSurplusPower #",
14
+ "es": "borrado estado deprecatado `collected.usableSurplusPower `",
15
+ "pl": "usunięty stan zdepregatowany \"collected.usableSurplusPower '",
16
+ "uk": "вилучена депресована держава `collected.usableSurplusPower й",
17
+ "zh-cn": "删除已贬值状态“ 已收集。 可使用 SurplusPower `"
18
+ },
6
19
  "2.3.6": {
7
20
  "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)",
8
21
  "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)",
@@ -80,19 +93,6 @@
80
93
  "pl": "fix: obsługi potencjalnych wartości null w ustawieniu metody rejestru Mapa",
81
94
  "uk": "виправити: обробляти потенціал null значення в встановленому методі Реєстру Мапа",
82
95
  "zh-cn": "固定值:在设定的登记方法中处理潜在的无效值 地图"
83
- },
84
- "2.3.0": {
85
- "en": "new release for npm migrates to Trusted Publishing",
86
- "de": "neue Veröffentlichung für npm migriert Trusted Publishing",
87
- "ru": "новый релиз для npm перенесен в Trusted Publishing",
88
- "pt": "nova versão para npm migra para a publicação confiável",
89
- "nl": "nieuwe release voor npm-migraties naar Trusted Publishing",
90
- "fr": "nouvelle version pour npm migre vers Trusted Publishing",
91
- "it": "nuovo rilascio per npm migra a Trusted Publishing",
92
- "es": "nueva versión para npm migrates a Trusted Publishing",
93
- "pl": "nowa wersja dla migratów npm do zaufanej publikacji",
94
- "uk": "новий реліз для npm migrats для Trusted Publishing",
95
- "zh-cn": "npm 的新版本迁移到信任出版"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/lib/alarms.js CHANGED
@@ -58,11 +58,11 @@ const inverterAlarms3 = new Map()
58
58
  .set('14', { id: 2093, name: 'DC Switch Abnormal', level: alarmLevel.Minor })
59
59
  .set('15', { id: 2094, name: 'Allowable discharge capacity of the battery is low', level: alarmLevel.Warning });
60
60
 
61
- function textsFromBitfield(alarmString, lot) {
61
+ function fromBitfield(alarmString, lot) {
62
62
  const result = [];
63
- for (const [i, char] of Object.entries(alarmString)) {
64
- if (char === '1') {
65
- const alarmText = lot.get(i);
63
+ for (let i = 0; i < alarmString.length; i++) {
64
+ if (alarmString[alarmString.length - 1 - i] === '1') {
65
+ const alarmText = lot.get(String(i));
66
66
  if (alarmText) {
67
67
  result.push(alarmText);
68
68
  }
@@ -76,11 +76,11 @@ function getAlarmInfo(alarmCode, alarmNo) {
76
76
  const alarmString = (alarmCode >>> 0).toString(2).padStart(16, '0');
77
77
  switch (alarmNo) {
78
78
  case 1:
79
- return textsFromBitfield(alarmString, inverterAlarms1);
79
+ return fromBitfield(alarmString, inverterAlarms1);
80
80
  case 2:
81
- return textsFromBitfield(alarmString, inverterAlarms2);
81
+ return fromBitfield(alarmString, inverterAlarms2);
82
82
  case 3:
83
- return textsFromBitfield(alarmString, inverterAlarms3);
83
+ return fromBitfield(alarmString, inverterAlarms3);
84
84
  }
85
85
  }
86
86
  return [];
@@ -1056,9 +1056,10 @@ class InverterSun2000 extends DriverBase {
1056
1056
  },
1057
1057
  ],
1058
1058
  postHook: path => {
1059
- //const alarm1Info = getAlarmInfo(128, 1);
1060
1059
  const alarm1Info = getAlarmInfo(this.stateCache.get(`${path}alarm1`)?.value, 1);
1060
+ //const alarm1Info = getAlarmInfo(128, 1);
1061
1061
  const alarm2Info = getAlarmInfo(this.stateCache.get(`${path}alarm2`)?.value, 2);
1062
+ //const alarm3Info = getAlarmInfo(32, 3);
1062
1063
  const alarm3Info = getAlarmInfo(this.stateCache.get(`${path}alarm3`)?.value, 3);
1063
1064
  const alarmInfos = alarm1Info.concat(alarm2Info, alarm3Info);
1064
1065
 
package/lib/register.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const { deviceType, driverClasses, dataRefreshRate } = require(`${__dirname}/types.js`);
4
4
  const { RiemannSum, StateMap } = require(`${__dirname}/tools.js`);
5
5
  const getDriverHandler = require(`${__dirname}/drivers/index.js`);
6
+ const tools = require(`${__dirname}/tools.js`);
6
7
 
7
8
  class Registers {
8
9
  constructor(adapterInstance) {
@@ -18,6 +19,18 @@ class Registers {
18
19
  device.instance = new handler(this, device);
19
20
  }
20
21
  }
22
+ //deleted deprecated states
23
+ if (
24
+ tools.existsState(this.adapter, `collected.usableSurplusPower`, (err, exists) => {
25
+ if (!err && exists) {
26
+ tools.deleteState(this.adapter, `collected.usableSurplusPower`, (err, deleted) => {
27
+ if (!err && deleted) {
28
+ this.adapter.logger.debug('Deleted deprecated state collected.usableSurplusPower');
29
+ }
30
+ });
31
+ }
32
+ })
33
+ );
21
34
 
22
35
  this.postProcessHooks = [];
23
36
  this.inverterPostProcessHooks = [
@@ -43,6 +56,7 @@ class Registers {
43
56
  unit: 'kW',
44
57
  role: 'value.power',
45
58
  },
59
+ /*
46
60
  {
47
61
  id: 'collected.usableSurplusPower',
48
62
  name: 'usable surplus power',
@@ -51,6 +65,7 @@ class Registers {
51
65
  role: 'value.power',
52
66
  desc: 'depreciated: Please use collected.surplus.usablePower instead',
53
67
  },
68
+ */
54
69
  {
55
70
  id: 'collected.surplus.power',
56
71
  name: 'surplus power',
@@ -138,7 +153,7 @@ class Registers {
138
153
  if (usableSurplusPower < 0.01) usableSurplusPower = 0;
139
154
  }
140
155
 
141
- this.adapter.log.debug(
156
+ this.adapter.logger.debug(
142
157
  `### Caculate usableSurplus power ${surplusPower} bufferOn ${this.bufferOn} soc ${soc} minSoc ${minSoc} bufferSoc ${bufferSoc} threshold ${hysterese / 2}`,
143
158
  );
144
159
  }
@@ -175,9 +190,11 @@ class Registers {
175
190
  this.stateCache.set('collected.activePower', actPower, { type: 'number', renew: true });
176
191
  this.stateCache.set('collected.houseConsumption', houseConsum, { type: 'number' });
177
192
  this.stateCache.set('collected.chargeDischargePower', chargeDischarge, { type: 'number' });
193
+ /*
178
194
  this.stateCache.set('collected.usableSurplusPower', surplusArray[1], {
179
195
  type: 'number',
180
196
  });
197
+ */
181
198
  this.stateCache.set('collected.surplus.power', surplusArray[0], {
182
199
  type: 'number',
183
200
  });
@@ -322,14 +339,7 @@ class Registers {
322
339
  this.stateCache.set('collected.gridImportToday', supplyFromGrid - this.stateCache.get('collected.gridImportStart')?.value, {
323
340
  type: 'number',
324
341
  });
325
- /* old computation of consumption today
326
- this.stateCache.set(
327
- 'collected.consumptionToday',
328
- this.stateCache.get('collected.consumptionSum')?.value - this.stateCache.get('collected.consumptionStart')?.value,
329
- { type: 'number' },
330
- );
331
- */
332
- //new computation of consumption today
342
+ //consumption today
333
343
  this.stateCache.set(
334
344
  'collected.consumptionToday',
335
345
  activeEnergy +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sun2000",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "sun2000",
5
5
  "author": {
6
6
  "name": "bolliy",