iobroker.alpha-ess 0.3.0 → 0.4.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/io-package.json +14 -14
- package/main.js +40 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,10 @@ The password is stored encrypted and must therefore be entered manually: demo
|
|
|
37
37
|
**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.**
|
|
38
38
|
|
|
39
39
|
## Changelog
|
|
40
|
+
### 0.4.0 (2023-02-16)
|
|
41
|
+
* (Gaspode) Optimized deletion of group states
|
|
42
|
+
* (Gaspode) Added new Realtime state for pmeter_dc
|
|
43
|
+
|
|
40
44
|
### 0.3.0 (2023-02-11)
|
|
41
45
|
* (Gaspode) Rearranged statistical data and added more values. Many thanks to [Thorsten](https://github.com/ThorstenBoettler) for his valuable contribution in testing the early alpha versions of this release and providing informative suggestions and recommendations for new data points.
|
|
42
46
|
* (Gaspode) Added Summary data
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "alpha-ess",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.4.0": {
|
|
7
|
+
"en": "Optimized deletion of group states\nAdded new Realtime state for pmeter_dc",
|
|
8
|
+
"de": "Optimiertes Löschen von Gruppenzuständen\nNeuer Realtime-Zustand für pmeter_dc hinzugefügt",
|
|
9
|
+
"ru": "Оптимизированное удаление групповых государств\nДобавлено новое состояние в режиме реального времени для pmeter_dc",
|
|
10
|
+
"pt": "Eliminação otimizada de estados de grupo\nAdicionado novo estado em tempo real para pmeter_dc",
|
|
11
|
+
"nl": "Optimaal deletie van de groepsstaat\nVoegde nieuwe Realtime staat toe voor begraafplaats",
|
|
12
|
+
"fr": "Suppression optimisée des états de groupe\nAjout d'un nouvel état en temps réel pour pmeter_dc",
|
|
13
|
+
"it": "Eliminazione ottimizzata degli stati di gruppo\nAggiunto nuovo stato in tempo reale per pmeter_dc",
|
|
14
|
+
"es": "Eliminación optimizada de estados de grupo\nNuevo estado en tiempo real añadido para pmeter_dc",
|
|
15
|
+
"pl": "Ostateczne delecje grupowych stanów\nNowy stan rzeczywisty",
|
|
16
|
+
"uk": "Оптимальне видалення групових станів\nДодано новий стан в режимі реального часу для pmeter_dc",
|
|
17
|
+
"zh-cn": "删除集团国家\n添加新实时状态"
|
|
18
|
+
},
|
|
6
19
|
"0.3.0": {
|
|
7
20
|
"en": "Rearranged statistical data and added more values. Many thanks to [Thorsten](https://github.com/ThorstenBoettler) for his valuable contribution in testing the early alpha versions of this release and providing informative suggestions and recommendations for new data points.\nAdded Summary data \nRefactored complete implementation\nChanged the unit of settings for all intervals, except of realtime data, to minutes (Caution: settings are reset to defaults)\nRemove disabled states at adapter startup\nRemoved no more supported value 'createtime' (state ID Realtime.Last_update). \nOptimized rounding for selected values",
|
|
8
21
|
"de": "Rearrangierte statistische Daten und fügte weitere Werte hinzu. Vielen Dank an [Thorsten](https://github.com/ThorstenBoettler) für seinen wertvollen Beitrag bei der Prüfung der frühen Alpha-Versionen dieser Veröffentlichung und Bereitstellung informativer Vorschläge und Empfehlungen für neue Datenpunkte.\nZusammenfassung Daten\nRefactored complete Implementation\nÄnderte die Einheit der Einstellungen für alle Intervalle, mit Ausnahme von Echtzeitdaten, in Minuten (Vorsicht: Einstellungen werden auf Standardeinstellungen zurückgesetzt)\nEntfernen von deaktivierten Zuständen bei Adapter-Start\nKeine unterstützte Wert-Erstellung entfernt (state ID Realtime.Last_update).\nOptimierte Rundung für ausgewählte Werte",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Zmienił adapter typu z metrowania do energii",
|
|
81
94
|
"uk": "Змінений тип адаптера від вимірювальної енергії",
|
|
82
95
|
"zh-cn": "能源参数的变量"
|
|
83
|
-
},
|
|
84
|
-
"0.0.6-beta.3": {
|
|
85
|
-
"en": "Correction for NPM",
|
|
86
|
-
"de": "Korrektur für NPM",
|
|
87
|
-
"ru": "Коррекция для NPM",
|
|
88
|
-
"pt": "Correção para NPM",
|
|
89
|
-
"nl": "Correctie voor NPM",
|
|
90
|
-
"fr": "Correction pour les mécanismes nationaux de prévention",
|
|
91
|
-
"it": "Correzione per NPM",
|
|
92
|
-
"es": "Corrección para el mecanismo nacional de prevención",
|
|
93
|
-
"pl": "Poprawka dla NPM",
|
|
94
|
-
"uk": "Корекція для NPM",
|
|
95
|
-
"zh-cn": "国家防范机制的纠正"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/main.js
CHANGED
|
@@ -107,6 +107,15 @@ class AlphaEss extends utils.Adapter {
|
|
|
107
107
|
, unit: 'W'
|
|
108
108
|
, dayIndex: false
|
|
109
109
|
}
|
|
110
|
+
, {
|
|
111
|
+
alphaAttrName: 'pmeter_dc'
|
|
112
|
+
, role: 'value.power'
|
|
113
|
+
, id: 'PV_meter_power'
|
|
114
|
+
, name: 'PV meter power'
|
|
115
|
+
, type: 'number'
|
|
116
|
+
, unit: 'W'
|
|
117
|
+
, dayIndex: false
|
|
118
|
+
}
|
|
110
119
|
, {
|
|
111
120
|
alphaAttrName: 'preal_l1'
|
|
112
121
|
, role: 'value.power'
|
|
@@ -654,13 +663,13 @@ class AlphaEss extends utils.Adapter {
|
|
|
654
663
|
if (this.config.password && this.config.username && this.config.systemId) {
|
|
655
664
|
|
|
656
665
|
for (const gidx of Object.keys(this.stateInfoList)) {
|
|
657
|
-
const
|
|
658
|
-
if (this.config[
|
|
659
|
-
await
|
|
666
|
+
const stateInfo = this.stateInfoList[gidx];
|
|
667
|
+
if (this.config[stateInfo.enabledName]) {
|
|
668
|
+
await stateInfo.fnct(stateInfo.Group);
|
|
660
669
|
}
|
|
661
670
|
else {
|
|
662
|
-
this.log.info(
|
|
663
|
-
await this.
|
|
671
|
+
this.log.info(stateInfo.Group + ' data disabled! Adapter won\'t fetch ' + stateInfo.Group + ' data. According states deleted.');
|
|
672
|
+
await this.delObjectAsync(stateInfo.Group, { recursive: true });
|
|
664
673
|
}
|
|
665
674
|
}
|
|
666
675
|
}
|
|
@@ -700,41 +709,15 @@ class AlphaEss extends utils.Adapter {
|
|
|
700
709
|
onStateChange(id, state) {
|
|
701
710
|
if (state) {
|
|
702
711
|
// The state was changed
|
|
703
|
-
this.log.
|
|
712
|
+
this.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
|
|
704
713
|
} else {
|
|
705
714
|
// The state was deleted
|
|
706
|
-
this.log.
|
|
715
|
+
this.log.debug(`state ${id} deleted`);
|
|
707
716
|
}
|
|
708
717
|
}
|
|
709
718
|
|
|
710
719
|
/**
|
|
711
|
-
*
|
|
712
|
-
* @param {string} group
|
|
713
|
-
*/
|
|
714
|
-
async deleteStatesForGroupAsync(group) {
|
|
715
|
-
const states = await this.getStatesAsync(group + '.*');
|
|
716
|
-
for (const id in states) {
|
|
717
|
-
this.log.info(id + ': ' + JSON.stringify(states[id]));
|
|
718
|
-
await this.delObjectAsync(id);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* Delete all states for a given group
|
|
724
|
-
* @param {string} group
|
|
725
|
-
*/
|
|
726
|
-
deleteStatesForGroup(group) {
|
|
727
|
-
return new Promise((resolve) => {
|
|
728
|
-
this.deleteStatesForGroupAsync(group).then(() => {
|
|
729
|
-
resolve(true);
|
|
730
|
-
}).catch(e => {
|
|
731
|
-
this.log.warn('Error: ' + e + '. Deletion of group ' + group + ' failed!');
|
|
732
|
-
resolve(false);
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/** Stop a timer for a given group
|
|
720
|
+
* Stop a timer for a given group
|
|
738
721
|
*
|
|
739
722
|
* @param {string} group
|
|
740
723
|
*/
|
|
@@ -980,19 +963,28 @@ class AlphaEss extends utils.Adapter {
|
|
|
980
963
|
|
|
981
964
|
/**
|
|
982
965
|
* Create states when called the first time, update state values in each call
|
|
983
|
-
* @param {string}
|
|
966
|
+
* @param {string} group
|
|
984
967
|
* @param {{ [s: string]: any; }} data
|
|
985
968
|
*/
|
|
986
|
-
async createAndUpdateStates(
|
|
969
|
+
async createAndUpdateStates(group, data) {
|
|
987
970
|
try {
|
|
988
971
|
if (data) {
|
|
989
972
|
const idx = new Date().getDate() - 1;
|
|
990
973
|
|
|
974
|
+
await this.setObjectNotExistsAsync(group, {
|
|
975
|
+
type: 'folder',
|
|
976
|
+
common: {
|
|
977
|
+
name: group
|
|
978
|
+
, read: true
|
|
979
|
+
, write: false
|
|
980
|
+
},
|
|
981
|
+
native: {}
|
|
982
|
+
});
|
|
991
983
|
for (const [alphaAttrName, rawValue] of Object.entries(data)) {
|
|
992
|
-
const stateInfo = this.getStateInfo(
|
|
984
|
+
const stateInfo = this.getStateInfo(group, alphaAttrName);
|
|
993
985
|
if (stateInfo) {
|
|
994
|
-
if (!this.createdStates[
|
|
995
|
-
await this.setObjectNotExistsAsync(
|
|
986
|
+
if (!this.createdStates[group]) {
|
|
987
|
+
await this.setObjectNotExistsAsync(group + '.' + this.osn(stateInfo.id), {
|
|
996
988
|
type: 'state',
|
|
997
989
|
common: {
|
|
998
990
|
name: stateInfo.name + ' [' + stateInfo.alphaAttrName + ']'
|
|
@@ -1014,7 +1006,7 @@ class AlphaEss extends utils.Adapter {
|
|
|
1014
1006
|
else {
|
|
1015
1007
|
value = rawValue;
|
|
1016
1008
|
}
|
|
1017
|
-
this.log.silly(
|
|
1009
|
+
this.log.silly(group + '.' + this.osn(stateInfo.id) + ':' + value);
|
|
1018
1010
|
let tvalue;
|
|
1019
1011
|
switch (stateInfo.type) {
|
|
1020
1012
|
case 'number':
|
|
@@ -1042,22 +1034,22 @@ class AlphaEss extends utils.Adapter {
|
|
|
1042
1034
|
}
|
|
1043
1035
|
|
|
1044
1036
|
if (this.config.updateUnchangedStates) {
|
|
1045
|
-
await this.setStateAsync(
|
|
1037
|
+
await this.setStateAsync(group + '.' + this.osn(stateInfo.id), tvalue, true);
|
|
1046
1038
|
}
|
|
1047
1039
|
else {
|
|
1048
|
-
await this.setStateChangedAsync(
|
|
1040
|
+
await this.setStateChangedAsync(group + '.' + this.osn(stateInfo.id), tvalue, true);
|
|
1049
1041
|
}
|
|
1050
|
-
this.log.debug('Received object ' +
|
|
1042
|
+
this.log.debug('Received object ' + group + '.' + this.osn(stateInfo.alphaAttrName) + ' with value ' + rawValue);
|
|
1051
1043
|
}
|
|
1052
1044
|
else {
|
|
1053
|
-
if (!this.createdStates[
|
|
1054
|
-
this.log.info('Skipped object ' +
|
|
1045
|
+
if (!this.createdStates[group]) {
|
|
1046
|
+
this.log.info('Skipped object ' + group + '.' + alphaAttrName + ' with value ' + rawValue);
|
|
1055
1047
|
}
|
|
1056
1048
|
}
|
|
1057
1049
|
}
|
|
1058
|
-
if (!this.createdStates[
|
|
1059
|
-
this.log.info('Created states for : ' +
|
|
1060
|
-
this.createdStates[
|
|
1050
|
+
if (!this.createdStates[group]) {
|
|
1051
|
+
this.log.info('Created states for : ' + group);
|
|
1052
|
+
this.createdStates[group] = true;
|
|
1061
1053
|
}
|
|
1062
1054
|
}
|
|
1063
1055
|
}
|