iobroker.alpha-ess 0.1.0 → 0.2.1-beta.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 +7 -0
- package/admin/i18n/de/translations.json +2 -1
- package/admin/i18n/en/translations.json +1 -0
- package/admin/i18n/es/translations.json +2 -1
- package/admin/i18n/fr/translations.json +2 -1
- package/admin/i18n/it/translations.json +2 -1
- package/admin/i18n/nl/translations.json +2 -1
- package/admin/i18n/pl/translations.json +2 -1
- package/admin/i18n/pt/translations.json +2 -1
- package/admin/i18n/ru/translations.json +2 -1
- package/admin/i18n/uk/translations.json +2 -1
- package/admin/i18n/zh-cn/translations.json +2 -1
- package/admin/jsonConfig.json +14 -3
- package/io-package.json +29 -27
- package/main.js +118 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Basically, it is possible to change selected configuration settings using the Al
|
|
|
27
27
|
**Interval to read realtime data:** Unit: seconds.\
|
|
28
28
|
**Interval to read energy data:** Unit: seconds.\
|
|
29
29
|
**Interval to read settings data:** Unit: seconds.
|
|
30
|
+
**Interval to read statistical data:** Unit: seconds.
|
|
30
31
|
|
|
31
32
|
It is possible to use a demo account provided by Alpha ESS. The credentials (user name, system id) are set as default values within the adapter.
|
|
32
33
|
The password is stored encrypted and must therefore be entered manually: demo
|
|
@@ -35,6 +36,12 @@ The password is stored encrypted and must therefore be entered manually: demo
|
|
|
35
36
|
**All product and company names or logos are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them or any associated subsidiaries! This personal project is maintained in spare time and has no business goal.**
|
|
36
37
|
|
|
37
38
|
## Changelog
|
|
39
|
+
### 0.2.1-beta.0 (2023-01-31)
|
|
40
|
+
* (Gaspode) Read selected statistical data
|
|
41
|
+
|
|
42
|
+
### 0.2.0 (2023-01-19)
|
|
43
|
+
* (Gaspode) Added states EV1_power, EV2_power, EV3_power and EV4_power to Realtime folder
|
|
44
|
+
|
|
38
45
|
### 0.1.0 (2023-01-15)
|
|
39
46
|
* (Gaspode) First release for Latest repository
|
|
40
47
|
* (Gaspode) Corrected typo in state ID Battery_SOC
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Intervall zum Lesen von Echtzeitdaten [s]",
|
|
7
7
|
"Interval to read settings data": "Intervall zum Lesen von Einstellungsdaten [s]",
|
|
8
8
|
"Interval to read energy data": "Intervall zum Auslesen der Energiedaten [s]",
|
|
9
|
-
"Update unchanged states": "Unveränderte Zustände aktualisieren"
|
|
9
|
+
"Update unchanged states": "Unveränderte Zustände aktualisieren",
|
|
10
|
+
"Interval to read statistical data": "Intervall zum Lesen statistischer Daten [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Interval to read realtime data [s]",
|
|
7
7
|
"Interval to read energy data": "Interval to read energy data [s]",
|
|
8
8
|
"Interval to read settings data": "Interval to read settings data [s]",
|
|
9
|
+
"Interval to read statistical data": "Interval to read statistical data [s]",
|
|
9
10
|
"Update unchanged states": "Update unchanged states"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Intervalo para leer datos en tiempo real [s]",
|
|
7
7
|
"Interval to read settings data": "Intervalo para leer los datos de configuración [s]",
|
|
8
8
|
"Interval to read energy data": "Intervalo para leer datos de energía [s]",
|
|
9
|
-
"Update unchanged states": "Actualizar estados sin cambios"
|
|
9
|
+
"Update unchanged states": "Actualizar estados sin cambios",
|
|
10
|
+
"Interval to read statistical data": "Intervalo para leer datos estadísticos [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Intervalle pour lire les données en temps réel [s]",
|
|
7
7
|
"Interval to read settings data": "Intervalle pour lire les données de réglage [s]",
|
|
8
8
|
"Interval to read energy data": "Intervalle pour lire les données énergétiques [s]",
|
|
9
|
-
"Update unchanged states": "Mettre à jour les états inchangés"
|
|
9
|
+
"Update unchanged states": "Mettre à jour les états inchangés",
|
|
10
|
+
"Interval to read statistical data": "Intervalle pour lire les données statistiques [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Intervallo per leggere i dati in tempo reale [s]",
|
|
7
7
|
"Interval to read settings data": "Intervallo per leggere i dati delle impostazioni [s]",
|
|
8
8
|
"Interval to read energy data": "Intervallo di lettura dei dati energetici [s]",
|
|
9
|
-
"Update unchanged states": "Aggiorna stati invariati"
|
|
9
|
+
"Update unchanged states": "Aggiorna stati invariati",
|
|
10
|
+
"Interval to read statistical data": "Intervallo di lettura dei dati statistici [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Interval om realtime gegevens te lezen [s]",
|
|
7
7
|
"Interval to read settings data": "Interval voor het lezen van instellingengegevens [s]",
|
|
8
8
|
"Interval to read energy data": "Interval om energiegegevens te lezen [s]",
|
|
9
|
-
"Update unchanged states": "Update ongewijzigde statussen"
|
|
9
|
+
"Update unchanged states": "Update ongewijzigde statussen",
|
|
10
|
+
"Interval to read statistical data": "Interval om statistische gegevens te lezen [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Interwał odczytu danych w czasie rzeczywistym [s]",
|
|
7
7
|
"Interval to read settings data": "Interwał odczytu danych ustawień [s]",
|
|
8
8
|
"Interval to read energy data": "Interwał odczytu danych dotyczących energii [s]",
|
|
9
|
-
"Update unchanged states": "Zaktualizuj niezmienione stany"
|
|
9
|
+
"Update unchanged states": "Zaktualizuj niezmienione stany",
|
|
10
|
+
"Interval to read statistical data": "Interwał odczytu danych statystycznych [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Intervalo para ler dados em tempo real [s]",
|
|
7
7
|
"Interval to read settings data": "Intervalo para ler os dados de configurações [s]",
|
|
8
8
|
"Interval to read energy data": "Intervalo para ler dados de energia [s]",
|
|
9
|
-
"Update unchanged states": "Atualizar estados inalterados"
|
|
9
|
+
"Update unchanged states": "Atualizar estados inalterados",
|
|
10
|
+
"Interval to read statistical data": "Intervalo para ler dados estatísticos [s]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Интервал для чтения данных в реальном времени [с]",
|
|
7
7
|
"Interval to read settings data": "Интервал чтения данных настроек [с]",
|
|
8
8
|
"Interval to read energy data": "Интервал для чтения данных об энергии [с]",
|
|
9
|
-
"Update unchanged states": "Обновить неизмененные состояния"
|
|
9
|
+
"Update unchanged states": "Обновить неизмененные состояния",
|
|
10
|
+
"Interval to read statistical data": "Интервал чтения статистических данных [с]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "Інтервал читання даних у реальному часі [с]",
|
|
7
7
|
"Interval to read settings data": "Інтервал читання даних налаштувань [с]",
|
|
8
8
|
"Interval to read energy data": "Інтервал зчитування даних про енергію [с]",
|
|
9
|
-
"Update unchanged states": "Оновити незмінні стани"
|
|
9
|
+
"Update unchanged states": "Оновити незмінні стани",
|
|
10
|
+
"Interval to read statistical data": "Інтервал читання статистичних даних [с]"
|
|
10
11
|
}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
"Interval to read realtime data": "读取实时数据的间隔 [s]",
|
|
7
7
|
"Interval to read settings data": "读取设置数据的间隔 [s]",
|
|
8
8
|
"Interval to read energy data": "读取能量数据的间隔[s]",
|
|
9
|
-
"Update unchanged states": "更新未改变的状态"
|
|
9
|
+
"Update unchanged states": "更新未改变的状态",
|
|
10
|
+
"Interval to read statistical data": "读取统计数据的间隔[s]"
|
|
10
11
|
}
|
package/admin/jsonConfig.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"intervalRealtimedata": {
|
|
28
28
|
"sm": 5,
|
|
29
|
-
"min":10,
|
|
29
|
+
"min": 10,
|
|
30
30
|
"type": "number",
|
|
31
31
|
"label": "Interval to read realtime data",
|
|
32
32
|
"newLine": false
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"intervalEnergydata": {
|
|
39
39
|
"sm": 5,
|
|
40
|
-
"min":60,
|
|
40
|
+
"min": 60,
|
|
41
41
|
"type": "number",
|
|
42
42
|
"label": "Interval to read energy data",
|
|
43
43
|
"newLine": false
|
|
@@ -48,11 +48,22 @@
|
|
|
48
48
|
},
|
|
49
49
|
"intervalSettingsdata": {
|
|
50
50
|
"sm": 5,
|
|
51
|
-
"min":60,
|
|
51
|
+
"min": 60,
|
|
52
52
|
"type": "number",
|
|
53
53
|
"label": "Interval to read settings data",
|
|
54
54
|
"newLine": false
|
|
55
55
|
},
|
|
56
|
+
"enableStatisticaldata": {
|
|
57
|
+
"type": "checkbox",
|
|
58
|
+
"newLine": true
|
|
59
|
+
},
|
|
60
|
+
"intervalStatisticaldata": {
|
|
61
|
+
"sm": 5,
|
|
62
|
+
"min": 60,
|
|
63
|
+
"type": "number",
|
|
64
|
+
"label": "Interval to read statistical data",
|
|
65
|
+
"newLine": false
|
|
66
|
+
},
|
|
56
67
|
"updateUnchangedStates": {
|
|
57
68
|
"type": "checkbox",
|
|
58
69
|
"label": "Update unchanged states",
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "alpha-ess",
|
|
4
|
-
"version": "0.1.0",
|
|
4
|
+
"version": "0.2.1-beta.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.2.1-beta.0": {
|
|
7
|
+
"en": "Read selected statistical data",
|
|
8
|
+
"de": "Ausgewählte statistische Daten",
|
|
9
|
+
"ru": "Прочитать выбранные статистические данные",
|
|
10
|
+
"pt": "Leia dados estatísticos selecionados",
|
|
11
|
+
"nl": "Vertaling:",
|
|
12
|
+
"fr": "Lire les données statistiques sélectionnées",
|
|
13
|
+
"it": "Dati statistici selezionati",
|
|
14
|
+
"es": "Lea los datos estadísticos seleccionados",
|
|
15
|
+
"pl": "Czytamy dane statystyczne",
|
|
16
|
+
"uk": "Читати вибрані статистичні дані",
|
|
17
|
+
"zh-cn": "阅读选定的统计数据"
|
|
18
|
+
},
|
|
19
|
+
"0.2.0": {
|
|
20
|
+
"en": "Added states EV1_power, EV2_power, EV3_power and EV4_power to Realtime folder",
|
|
21
|
+
"de": "EV1_power, EV2_power, EV3_power und EV4_power in Echtzeit-Ordner",
|
|
22
|
+
"ru": "Добавлены состояния EV1_power, EV2_power, EV3_power и EV4_power в папку Realtime",
|
|
23
|
+
"pt": "Estados adicionados EV1_power, EV2_power, EV3_power e EV4_power para pasta em tempo real",
|
|
24
|
+
"nl": "Vertaling:",
|
|
25
|
+
"fr": "Ajout des états EV1_power, EV2_power, EV3_power et EV4_power dans le dossier Realtime",
|
|
26
|
+
"it": "Aggiunti stati EV1_power, EV2_power, EV3_power e EV4_power nella cartella in tempo reale",
|
|
27
|
+
"es": "Estados adicionales EV1_power, EV2_power, EV3_power y EV4_power a carpeta en tiempo real",
|
|
28
|
+
"pl": "EV1_power, EV2_power, EV3_power i EV4_power do Realtime folder",
|
|
29
|
+
"uk": "Додано стани EV1_power, EV2_power, EV3_power і EV4_power до папки реального часу",
|
|
30
|
+
"zh-cn": "增加国家EV1:能力,EV2_ 能力, EV3_ 权力和EV4_ 实际工作时间的能力"
|
|
31
|
+
},
|
|
6
32
|
"0.1.0": {
|
|
7
33
|
"en": "First release for Latest repository\nCorrected typo in state ID Battery_SOC\nImplemented improvements as suggested in code review",
|
|
8
34
|
"de": "Erste Veröffentlichung für Neueste Repository\nKorrigierte Typo im Zustand ID Battery_SOC\nImplementierte Verbesserungen wie in der Code-Review vorgeschlagen",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "NPM",
|
|
68
94
|
"uk": "Увімкнути NPM",
|
|
69
95
|
"zh-cn": "国家预防机制"
|
|
70
|
-
},
|
|
71
|
-
"0.0.6-beta.1": {
|
|
72
|
-
"en": "...",
|
|
73
|
-
"de": "...",
|
|
74
|
-
"ru": "...",
|
|
75
|
-
"pt": "...",
|
|
76
|
-
"nl": "...",
|
|
77
|
-
"fr": "...",
|
|
78
|
-
"it": "...",
|
|
79
|
-
"es": "...",
|
|
80
|
-
"pl": "...",
|
|
81
|
-
"uk": "...",
|
|
82
|
-
"zh-cn": "..."
|
|
83
|
-
},
|
|
84
|
-
"0.0.6-beta.0": {
|
|
85
|
-
"en": "...",
|
|
86
|
-
"de": "...",
|
|
87
|
-
"ru": "...",
|
|
88
|
-
"pt": "...",
|
|
89
|
-
"nl": "...",
|
|
90
|
-
"fr": "...",
|
|
91
|
-
"it": "...",
|
|
92
|
-
"es": "...",
|
|
93
|
-
"pl": "...",
|
|
94
|
-
"uk": "...",
|
|
95
|
-
"zh-cn": "..."
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -171,6 +171,8 @@
|
|
|
171
171
|
"intervalEnergydata": 300,
|
|
172
172
|
"enableSettingsdata": false,
|
|
173
173
|
"intervalSettingsdata": 300,
|
|
174
|
+
"enableStatisticaldata": false,
|
|
175
|
+
"intervalStatisticaldata": 300,
|
|
174
176
|
"updateUnchangedStates": false
|
|
175
177
|
},
|
|
176
178
|
"objects": [],
|
package/main.js
CHANGED
|
@@ -129,6 +129,42 @@ const stateList = [{
|
|
|
129
129
|
, unit: 'W'
|
|
130
130
|
, dayIndex: false
|
|
131
131
|
}
|
|
132
|
+
, {
|
|
133
|
+
stateName: 'ev1_power'
|
|
134
|
+
, role: 'value.power'
|
|
135
|
+
, id: 'EV1_power'
|
|
136
|
+
, name: 'Wallbox Power 1'
|
|
137
|
+
, type: 'number'
|
|
138
|
+
, unit: 'W'
|
|
139
|
+
, dayIndex: false
|
|
140
|
+
}
|
|
141
|
+
, {
|
|
142
|
+
stateName: 'ev2_power'
|
|
143
|
+
, role: 'value.power'
|
|
144
|
+
, id: 'EV2_power'
|
|
145
|
+
, name: 'Wallbox Power 2'
|
|
146
|
+
, type: 'number'
|
|
147
|
+
, unit: 'W'
|
|
148
|
+
, dayIndex: false
|
|
149
|
+
}
|
|
150
|
+
, {
|
|
151
|
+
stateName: 'ev3_power'
|
|
152
|
+
, role: 'value.power'
|
|
153
|
+
, id: 'EV3_power'
|
|
154
|
+
, name: 'Wallbox Power 3'
|
|
155
|
+
, type: 'number'
|
|
156
|
+
, unit: 'W'
|
|
157
|
+
, dayIndex: false
|
|
158
|
+
}
|
|
159
|
+
, {
|
|
160
|
+
stateName: 'ev4_power'
|
|
161
|
+
, role: 'value.power'
|
|
162
|
+
, id: 'EV4_power'
|
|
163
|
+
, name: 'Wallbox Power 4'
|
|
164
|
+
, type: 'number'
|
|
165
|
+
, unit: 'W'
|
|
166
|
+
, dayIndex: false
|
|
167
|
+
}
|
|
132
168
|
, {
|
|
133
169
|
stateName: 'soc'
|
|
134
170
|
, role: 'value.battery'
|
|
@@ -317,6 +353,32 @@ const stateList = [{
|
|
|
317
353
|
, unit: 'kWh'
|
|
318
354
|
, dayIndex: true
|
|
319
355
|
}]
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
Group: 'Statistics'
|
|
359
|
+
, states: [
|
|
360
|
+
{
|
|
361
|
+
stateName: 'EselfSufficiency'
|
|
362
|
+
, role: 'value'
|
|
363
|
+
, id: 'Self_sufficiency_today'
|
|
364
|
+
, name: 'Self sufficiency today'
|
|
365
|
+
, type: 'number'
|
|
366
|
+
, unit: '%'
|
|
367
|
+
, factor: 100
|
|
368
|
+
, round: 1
|
|
369
|
+
, dayIndex: false
|
|
370
|
+
}
|
|
371
|
+
, {
|
|
372
|
+
stateName: 'EselfConsumption'
|
|
373
|
+
, role: 'value'
|
|
374
|
+
, id: 'Self_consumption_today'
|
|
375
|
+
, name: 'Self consumption today'
|
|
376
|
+
, type: 'number'
|
|
377
|
+
, unit: '%'
|
|
378
|
+
, factor: 100
|
|
379
|
+
, round: 1
|
|
380
|
+
, dayIndex: false
|
|
381
|
+
}]
|
|
320
382
|
}];
|
|
321
383
|
|
|
322
384
|
class AlphaEss extends utils.Adapter {
|
|
@@ -334,6 +396,7 @@ class AlphaEss extends utils.Adapter {
|
|
|
334
396
|
this.realtimeDataTimeoutHandle = null;
|
|
335
397
|
this.energyDataTimeoutHandle = null;
|
|
336
398
|
this.settingsDataTimeoutHandle = null;
|
|
399
|
+
this.statisticalDataTimeoutHandle = null;
|
|
337
400
|
this.wrongCredentials = false;
|
|
338
401
|
this.errorCount = 0;
|
|
339
402
|
|
|
@@ -364,13 +427,17 @@ class AlphaEss extends utils.Adapter {
|
|
|
364
427
|
// Reset the connection indicator during startup
|
|
365
428
|
await this.setStateChangedAsync('info.connection', false, true);
|
|
366
429
|
|
|
367
|
-
this.log.debug('config username:
|
|
368
|
-
this.log.debug('config systemId:
|
|
369
|
-
this.log.debug('config intervalRealtimedata:
|
|
370
|
-
this.log.debug('config intervalSettingsdata:
|
|
371
|
-
this.log.debug('config
|
|
372
|
-
this.log.debug('config
|
|
373
|
-
this.log.debug('config
|
|
430
|
+
this.log.debug('config username: ' + this.config.username);
|
|
431
|
+
this.log.debug('config systemId: ' + this.config.systemId);
|
|
432
|
+
this.log.debug('config intervalRealtimedata: ' + this.config.intervalRealtimedata);
|
|
433
|
+
this.log.debug('config intervalSettingsdata: ' + this.config.intervalSettingsdata);
|
|
434
|
+
this.log.debug('config intervalEnergydata: ' + this.config.intervalEnergydata);
|
|
435
|
+
this.log.debug('config intervalStatisticaldata: ' + this.config.intervalStatisticaldata);
|
|
436
|
+
this.log.debug('config enableRealtimedata: ' + this.config.enableRealtimedata);
|
|
437
|
+
this.log.debug('config enableSettingsdata: ' + this.config.enableSettingsdata);
|
|
438
|
+
this.log.debug('config enableEnergydata: ' + this.config.enableEnergydata);
|
|
439
|
+
this.log.debug('config enableStatisticaldata: ' + this.config.enableStatisticaldata);
|
|
440
|
+
this.log.debug('config updateUnchangedStates: ' + this.config.updateUnchangedStates);
|
|
374
441
|
|
|
375
442
|
this.wrongCredentials = false;
|
|
376
443
|
|
|
@@ -397,6 +464,12 @@ class AlphaEss extends utils.Adapter {
|
|
|
397
464
|
else {
|
|
398
465
|
this.log.info('Settings data disabled! Adapter won\'t fetch settings data.');
|
|
399
466
|
}
|
|
467
|
+
if (this.config.enableStatisticaldata) {
|
|
468
|
+
await this.fetchStatisticalData();
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
this.log.info('Settings data disabled! Adapter won\'t fetch statistical data.');
|
|
472
|
+
}
|
|
400
473
|
}
|
|
401
474
|
else {
|
|
402
475
|
this.log.error('No username, password and/or system ID set! Adapter won\'t fetch any data.');
|
|
@@ -425,6 +498,10 @@ class AlphaEss extends utils.Adapter {
|
|
|
425
498
|
clearTimeout(this.settingsDataTimeoutHandle);
|
|
426
499
|
this.settingsDataTimeoutHandle = null;
|
|
427
500
|
}
|
|
501
|
+
if (this.statisticalDataTimeoutHandle) {
|
|
502
|
+
clearTimeout(this.statisticalDataTimeoutHandle);
|
|
503
|
+
this.statisticalDataTimeoutHandle = null;
|
|
504
|
+
}
|
|
428
505
|
this.resetAuth();
|
|
429
506
|
|
|
430
507
|
callback();
|
|
@@ -608,7 +685,7 @@ class AlphaEss extends utils.Adapter {
|
|
|
608
685
|
this.log.debug('Fetching energy data...');
|
|
609
686
|
|
|
610
687
|
const dt = new Date();
|
|
611
|
-
const dts = (dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-01');
|
|
688
|
+
const dts = (dt.getFullYear() + '-0' + (dt.getMonth() + 1) + '-01');
|
|
612
689
|
const json = {
|
|
613
690
|
'statisticBy': 'month',
|
|
614
691
|
'sDate': dts,
|
|
@@ -650,6 +727,33 @@ class AlphaEss extends utils.Adapter {
|
|
|
650
727
|
}
|
|
651
728
|
}
|
|
652
729
|
|
|
730
|
+
async fetchStatisticalData() {
|
|
731
|
+
try {
|
|
732
|
+
if (this.statisticalDataTimeoutHandle) {
|
|
733
|
+
clearTimeout(this.statisticalDataTimeoutHandle);
|
|
734
|
+
this.statisticalDataTimeoutHandle = null;
|
|
735
|
+
}
|
|
736
|
+
const groupName = 'Statistics';
|
|
737
|
+
|
|
738
|
+
this.log.debug('Fetching statistical data...');
|
|
739
|
+
|
|
740
|
+
const dt = new Date();
|
|
741
|
+
const dts = (dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate());
|
|
742
|
+
|
|
743
|
+
const body = await this.getData(BaseURI + 'api/Power/SticsByPeriod?beginDay=' + dts + '&endDay=' + dts +
|
|
744
|
+
'&tDay=' + dts + '&isOEM=0&SN=' + this.config.systemId + '&userID=&noLoading=true');
|
|
745
|
+
|
|
746
|
+
this.createAndUpdateStates(groupName, body.data);
|
|
747
|
+
|
|
748
|
+
if (!this.statisticalDataTimeoutHandle) {
|
|
749
|
+
this.statisticalDataTimeoutHandle = setTimeout(() => this.fetchStatisticalData(), this.calculateIntervalInMs(this.config.intervalStatisticaldata, groupName));
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
catch (e) {
|
|
753
|
+
this.log.error('fetchStatisticalData Exception occurred: ' + e);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
653
757
|
/**
|
|
654
758
|
* @param {string} groupName
|
|
655
759
|
* @param {{ [s: string]: any; }} data
|
|
@@ -690,6 +794,12 @@ class AlphaEss extends utils.Adapter {
|
|
|
690
794
|
switch (stateInfo.type) {
|
|
691
795
|
case 'number':
|
|
692
796
|
tvalue = Number.parseFloat(value);
|
|
797
|
+
if (stateInfo.factor) {
|
|
798
|
+
tvalue *= stateInfo.factor;
|
|
799
|
+
}
|
|
800
|
+
if (stateInfo.round) {
|
|
801
|
+
tvalue = (Math.round(tvalue * (10 ** stateInfo.round))) / (10 ** stateInfo.round);
|
|
802
|
+
}
|
|
693
803
|
break;
|
|
694
804
|
case 'boolean':
|
|
695
805
|
tvalue = Number.parseInt(value) != 0;
|