iobroker.alpha-ess 0.2.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 +4 -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 +16 -14
- package/main.js +82 -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,9 @@ 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
|
+
|
|
38
42
|
### 0.2.0 (2023-01-19)
|
|
39
43
|
* (Gaspode) Added states EV1_power, EV2_power, EV3_power and EV4_power to Realtime folder
|
|
40
44
|
|
|
@@ -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,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "alpha-ess",
|
|
4
|
-
"version": "0.2.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
|
+
},
|
|
6
19
|
"0.2.0": {
|
|
7
20
|
"en": "Added states EV1_power, EV2_power, EV3_power and EV4_power to Realtime folder",
|
|
8
21
|
"de": "EV1_power, EV2_power, EV3_power und EV4_power in Echtzeit-Ordner",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "NPM",
|
|
81
94
|
"uk": "Увімкнути NPM",
|
|
82
95
|
"zh-cn": "国家预防机制"
|
|
83
|
-
},
|
|
84
|
-
"0.0.6-beta.1": {
|
|
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
|
@@ -353,6 +353,32 @@ const stateList = [{
|
|
|
353
353
|
, unit: 'kWh'
|
|
354
354
|
, dayIndex: true
|
|
355
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
|
+
}]
|
|
356
382
|
}];
|
|
357
383
|
|
|
358
384
|
class AlphaEss extends utils.Adapter {
|
|
@@ -370,6 +396,7 @@ class AlphaEss extends utils.Adapter {
|
|
|
370
396
|
this.realtimeDataTimeoutHandle = null;
|
|
371
397
|
this.energyDataTimeoutHandle = null;
|
|
372
398
|
this.settingsDataTimeoutHandle = null;
|
|
399
|
+
this.statisticalDataTimeoutHandle = null;
|
|
373
400
|
this.wrongCredentials = false;
|
|
374
401
|
this.errorCount = 0;
|
|
375
402
|
|
|
@@ -400,13 +427,17 @@ class AlphaEss extends utils.Adapter {
|
|
|
400
427
|
// Reset the connection indicator during startup
|
|
401
428
|
await this.setStateChangedAsync('info.connection', false, true);
|
|
402
429
|
|
|
403
|
-
this.log.debug('config username:
|
|
404
|
-
this.log.debug('config systemId:
|
|
405
|
-
this.log.debug('config intervalRealtimedata:
|
|
406
|
-
this.log.debug('config intervalSettingsdata:
|
|
407
|
-
this.log.debug('config
|
|
408
|
-
this.log.debug('config
|
|
409
|
-
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);
|
|
410
441
|
|
|
411
442
|
this.wrongCredentials = false;
|
|
412
443
|
|
|
@@ -433,6 +464,12 @@ class AlphaEss extends utils.Adapter {
|
|
|
433
464
|
else {
|
|
434
465
|
this.log.info('Settings data disabled! Adapter won\'t fetch settings data.');
|
|
435
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
|
+
}
|
|
436
473
|
}
|
|
437
474
|
else {
|
|
438
475
|
this.log.error('No username, password and/or system ID set! Adapter won\'t fetch any data.');
|
|
@@ -461,6 +498,10 @@ class AlphaEss extends utils.Adapter {
|
|
|
461
498
|
clearTimeout(this.settingsDataTimeoutHandle);
|
|
462
499
|
this.settingsDataTimeoutHandle = null;
|
|
463
500
|
}
|
|
501
|
+
if (this.statisticalDataTimeoutHandle) {
|
|
502
|
+
clearTimeout(this.statisticalDataTimeoutHandle);
|
|
503
|
+
this.statisticalDataTimeoutHandle = null;
|
|
504
|
+
}
|
|
464
505
|
this.resetAuth();
|
|
465
506
|
|
|
466
507
|
callback();
|
|
@@ -644,7 +685,7 @@ class AlphaEss extends utils.Adapter {
|
|
|
644
685
|
this.log.debug('Fetching energy data...');
|
|
645
686
|
|
|
646
687
|
const dt = new Date();
|
|
647
|
-
const dts = (dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-01');
|
|
688
|
+
const dts = (dt.getFullYear() + '-0' + (dt.getMonth() + 1) + '-01');
|
|
648
689
|
const json = {
|
|
649
690
|
'statisticBy': 'month',
|
|
650
691
|
'sDate': dts,
|
|
@@ -686,6 +727,33 @@ class AlphaEss extends utils.Adapter {
|
|
|
686
727
|
}
|
|
687
728
|
}
|
|
688
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
|
+
|
|
689
757
|
/**
|
|
690
758
|
* @param {string} groupName
|
|
691
759
|
* @param {{ [s: string]: any; }} data
|
|
@@ -726,6 +794,12 @@ class AlphaEss extends utils.Adapter {
|
|
|
726
794
|
switch (stateInfo.type) {
|
|
727
795
|
case 'number':
|
|
728
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
|
+
}
|
|
729
803
|
break;
|
|
730
804
|
case 'boolean':
|
|
731
805
|
tvalue = Number.parseInt(value) != 0;
|