iobroker.senec 1.4.3 → 1.5.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/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "senec",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "news": {
6
+ "1.5.0": {
7
+ "en": "Added configuration section to add datapoints to high priority polling. Please be aware of the possible issues this could cause (if too many datapoints added) and use at your own risk. ALL Wallbox datapoints have been removed from high priority polling. Only some users even have a SENEC wallbox. Please reconfigure via the new config dialogue. Possible Candidate for stable. Please report any findings!",
8
+ "de": "Konfigurationsabschnitt hinzugefügt, um zusätzliche Datenpunkte mit hoher Priorität abzufragen. Bitte beachten Sie die möglichen Probleme, die dies verursachen könnte (wenn zu viele Datenpunkte hinzugefügt wurden). Nutzung auf eigenes Risiko. Standardgemäß werden nun keine Wallbox-Datenpunkte mehr mit hoher Priorität abgefragt (zu wenige User haben eine SENEC Wallbox). Diese nun bitte über den neuen Configdialog konfigurieren. Möglicher Kandidat für stable - bitte alle Probleme reporten.",
9
+ "ru": "Добавлен раздел конфигурации, чтобы добавить данные точки к высокому приоритетному опросу. Пожалуйста, имейте в виду возможные проблемы, которые могут вызвать (если слишком много добавленных данных) и использовать на вашем собственном риске. Все точки данных Wallbox были удалены из высококачественного опроса. Только некоторые пользователи даже имеют SENEC wallbox. Пожалуйста, обратите внимание на новый диалог.",
10
+ "pt": "Seção de configuração adicionada para adicionar datapoints a votação de alta prioridade. Por favor, esteja ciente dos possíveis problemas que isso poderia causar (se muitos datapoints adicionados) e usar em seu próprio risco. TODOS os datapoints da Wallbox foram removidos da votação de alta prioridade. Apenas alguns usuários têm uma caixa de parede SENEC. Por favor, reconfigure através do novo diálogo de configuração.",
11
+ "nl": "Toegevoegd configuration sectie om gegevens toe te voegen aan hoge prioriteitsvervuiling. Wees alsjeblieft op de hoogte van de mogelijke kwesties die dit kan veroorzaken... als te veel datapoints toegevoegd zijn en gebruik maken van je eigen risico. Alle Wallbox datapoints zijn verwijderd van hoge prioriteitsvervuiling. Alleen sommige gebruikers hebben zelfs een SENEC muurdoos. Herconfiguur via de nieuwe dialoog.",
12
+ "fr": "Ajout de la section de configuration pour ajouter des points de données à un sondage prioritaire. S'il vous plaît être conscient des problèmes possibles qui pourraient causer (si trop de points de données ajoutés) et utiliser à vos propres risques. Tous les points de données de Wallbox ont été retirés du vote prioritaire. Seuls certains utilisateurs ont même une boîte murale SENEC. Veuillez reconfigurer via le nouveau dialogue de configuration.",
13
+ "it": "Aggiunta sezione di configurazione per aggiungere datapoints ad inquinamento ad alta priorità. Si prega di essere consapevoli dei possibili problemi che questo potrebbe causare (se troppi punti di dati aggiunti) e utilizzare a proprio rischio. Tutti i datapoint di Wallbox sono stati rimossi dall'inquinamento ad alta priorità. Solo alcuni utenti hanno anche una parete SENEC. Si prega di riconfigurare tramite il nuovo dialogo di configurazione.",
14
+ "es": "Se agregó la sección de configuración para añadir puntos de datos a encuestas de alta prioridad. Tenga en cuenta los posibles problemas que esto podría causar (si se añaden demasiados datos) y utilizar a su propio riesgo. Todos los puntos de datos de Wallbox han sido eliminados de encuestas de alta prioridad. Sólo algunos usuarios tienen una caja de pared SENEC. Por favor reconfigure a través del nuevo diálogo de configuración.",
15
+ "pl": "Wtedy sekcja konfiguracji dodania punktów danych do wysokiego priorytetu. Poświadczenie o możliwych zagadnieniach może powodować (jeśli są zbyt wiele punktów danych) i wykorzystać swój własny ryzyko. ALL Wallbox datapoints zostały usunięte z wysokiego priorytetu. Tylko niektórzy użytkownicy mają nawet SENEC. Powraca się poprzez nowe dialogi.",
16
+ "uk": "Додано розділ конфігурації, щоб додати точки даних до високого пріоритетного опитування. Будь ласка, будь ласка, будь ласка, будь ласка, зв'яжіться з нами та користуйтеся власним ризиком. Усі точки даних Wallbox видаляються з високого пріоритетного опитування. Тільки деякі користувачі навіть мають скриньку SENEC. Будь ласка, переадресація через новий діалог налаштування.",
17
+ "zh-cn": "增加数据点以进行高度优先投票。 请了解可能出现的问题(如果数据点增加),并利用你自己的风险。 已从高优先投票中删除了所有Wil箱数据点。 只有一些用户甚至有SENEC墙箱。 请通过新的混凝土对话进行改组。."
18
+ },
6
19
  "1.4.3": {
7
20
  "en": "Working on https connection. Please test and report!",
8
21
  "de": "Arbeiten an https-Verbindung. Bitte testen und melden!",
@@ -54,32 +67,6 @@
54
67
  "pl": "Dodany obiekt caching i drobnych aktualizacji kodu. Ze względu na ilość przedmiotów, które traktują z cachingiem, dotyczy obowiązkowych.",
55
68
  "uk": "Додано кешування об'єкта та оновлення коду неповного розміру. У зв'язку з кількістю об'єктів, які ми маємо справу з кешуванням, є обов'язковим.",
56
69
  "zh-cn": "添加了目标包和小法典的更新。 由于我们所处理的物品数量是强制性的。."
57
- },
58
- "1.3.10": {
59
- "en": "Fixed wrong Unit for STATISTIC.LIVE_WB_ENERGY, added more state_attr. Moved to json admin UI and other technical updates.",
60
- "de": "Fehler behoben Einheit für STATISTIC.LIVE_WB_ENERGY, hinzugefügt mehr state_attr. Umgezogen zu json admin UI und anderen technischen Updates.",
61
- "ru": "Исправлено неправильно Блок для STATISTIC.LIVE_WB_ENERGY, добавил больше state_attr. Переехал в json admin UI и другие технические обновления.",
62
- "pt": "Correção errada Unidade para STATISTIC.LIVE_WB_ENERGY, adicionou mais state_attr. Movido para a interface de administração json e outras atualizações técnicas.",
63
- "nl": "Verkeerd. Eenheid voor STATISTIC.LiveWBEERGY, voegde meer staatattr toe. Verhuisd naar Json administratie en andere technische updates.",
64
- "fr": "Correction Unité pour STATISTIC.LIVE_WB_ENERGY, ajouté plus state_attr. Déplacement vers json admin UI et autres mises à jour techniques.",
65
- "it": "Corretto sbagliato Unità per STATISTIC.LIVE_WB_ENERGY, aggiunto più state_attr. Passato a json admin UI e altri aggiornamenti tecnici.",
66
- "es": "Corregido mal Unidad para STATISTIC.LIVE_WB_ENERGY, agregó más state_attr. Se movió a json admin UI y otras actualizaciones técnicas.",
67
- "pl": "Fixed wrong (ang.). Unit for STATISTIC.LIVE_WB_ENERGY (ang.). Wykorzystywany do json admin UI i innych aktualizacji technicznych.",
68
- "uk": "Виправлено неправильно Блок для STATISTIC.LIVE_WB_ENERGY, додано більше стану_attr. Переміщено в json admin UI та інші технічні оновлення.",
69
- "zh-cn": "混合错误 统计司股 Moved to json admin UI及其他技术更新。."
70
- },
71
- "1.3.9": {
72
- "en": "Added (some) Wallbox Datapoints to high-prio polling, Added more state definitions",
73
- "de": "Hinzugefügt (einige) Wallbox Datapoints zu High-Prio-Polling hinzugefügt und Statusdefinitionen",
74
- "ru": "Добавлены (некоторые) Настенный ящик Datapoints для высокоценного опроса, Добавлено больше государственных определений",
75
- "pt": "Adicionado (alguns) Wallbox Datapoints para alta-prio polling, Adicionado mais definições de estado",
76
- "nl": "Added (some) Wallbox Datapoints to high-prio polling, Added more state definitions",
77
- "fr": "Ajouté (certains) Wallbox Datapoints to high-prio polling, Ajouté plus de définitions d'état",
78
- "it": "Aggiunto (alcuni) Wallbox Datapoints a high-prio polling, Aggiunto più definizioni di stato",
79
- "es": "Añadido (algunos) Wallbox Datapoints to high-prio polling, Añadido más state definitions",
80
- "pl": "Added (pojedynczy) Wallbox Datapoints to high-prio polling",
81
- "uk": "Додано ( some) Точки даних Wallbox до високе опитування, Додано більше державних визначення",
82
- "zh-cn": "增加(有些)W箱数据点到高中投票,加上更多的国家定义。"
83
70
  }
84
71
  },
85
72
  "docs": {
@@ -153,7 +140,36 @@
153
140
  "pollingTimeout": 5000,
154
141
  "retries": 10,
155
142
  "retrymultiplier": 2,
156
- "useHttps": false
143
+ "useHttps": false,
144
+ "disclaimer": false,
145
+ "highPrio_BMS": "",
146
+ "highPrio_BMS_active": false,
147
+ "highPrio_ENERGY": "",
148
+ "highPrio_ENERGY_active": false,
149
+ "highPrio_PV1": "",
150
+ "highPrio_PV1_active": false,
151
+ "highPrio_PWR_UNIT": "",
152
+ "highPrio_PWR_UNIT_active": false,
153
+ "highPrio_PM1OBJ1": "",
154
+ "highPrio_PM1OBJ1_active": false,
155
+ "highPrio_PM1OBJ2": "",
156
+ "highPrio_PM1OBJ2_active": false,
157
+ "highPrio_STATISTIC": "",
158
+ "highPrio_STATISTIC_active": false,
159
+ "highPrio_WALLBOX": "",
160
+ "highPrio_WALLBOX_active": false,
161
+ "highPrio_BAT1": "",
162
+ "highPrio_BAT1_active": false,
163
+ "highPrio_BAT1OBJ1": "",
164
+ "highPrio_BAT1OBJ1_active": false,
165
+ "highPrio_BAT1OBJ2": "",
166
+ "highPrio_BAT1OBJ2_active": false,
167
+ "highPrio_BAT1OBJ3": "",
168
+ "highPrio_BAT1OBJ3_active": false,
169
+ "highPrio_BAT1OBJ4": "",
170
+ "highPrio_BAT1OBJ4_active": false,
171
+ "highPrio_TEMPMEASURE": "",
172
+ "highPrio_TEMPMEASURE_active": false
157
173
  },
158
174
  "objects": [],
159
175
  "instanceObjects": [{
package/main.js CHANGED
@@ -16,6 +16,11 @@ let retry = 0; // retry-counter
16
16
  let retryLowPrio = 0; // retry-counter
17
17
  let connectVia = "http://";
18
18
 
19
+ const allKnownObjects = new Set(["STATISTIC","ENERGY","FEATURES","LOG","SYS_UPDATE","WIZARD","BMS","BAT1","BAT1OBJ1","BAT1OBJ2","BAT1OBJ3","BAT1OBJ4","PWR_UNIT","PM1OBJ1","PM1OBJ2","PV1","FACTORY","GRIDCONFIG","EG_CONTROL","RTC","PM1","TEMPMEASURE","DEBUG","SOCKETS","CASC","WALLBOX","CONNX50","STECA"]);
20
+ const highPrioObjects = new Map;
21
+ let lowPrioForm = "";
22
+ let highPrioForm = "";
23
+
19
24
  let unloaded = false;
20
25
 
21
26
  const knownObjects = {};
@@ -44,9 +49,10 @@ class Senec extends utils.Adapter {
44
49
  this.setState('info.connection', false, true);
45
50
  try {
46
51
  await this.checkConfig();
52
+ await this.initPollSettings();
47
53
  await this.checkConnection();
48
- await this.readSenecV21();
49
- await this.readSenecV21LowPrio();
54
+ await this.pollSenec(true, 0); // highPrio
55
+ await this.pollSenec(false, 0); // lowPrio
50
56
  } catch (error) {
51
57
  this.log.error(error);
52
58
  this.setState('info.connection', false, true);
@@ -73,6 +79,97 @@ class Senec extends utils.Adapter {
73
79
  callback();
74
80
  }
75
81
  }
82
+
83
+ async initPollSettings() {
84
+ // creating form for low priority pulling (which means pulling everything we know)
85
+ // we can do this while preparing values for high prio
86
+ lowPrioForm = '{';
87
+ for (const value of allKnownObjects) {
88
+ lowPrioForm += '"' + value + '":{},';
89
+ const objectsSet = new Set();
90
+ switch (value) {
91
+ case "BMS":
92
+ ["CELL_TEMPERATURES_MODULE_A","CELL_TEMPERATURES_MODULE_B","CELL_TEMPERATURES_MODULE_C","CELL_TEMPERATURES_MODULE_D","CELL_VOLTAGES_MODULE_A","CELL_VOLTAGES_MODULE_B","CELL_VOLTAGES_MODULE_C","CELL_VOLTAGES_MODULE_D","CURRENT","SOC","SYSTEM_SOC","TEMP_MAX","TEMP_MIN","VOLTAGE"].forEach(item => objectsSet.add(item));
93
+ if (this.config.disclaimer && this.config.highPrio_BMS_active) this.addUserDps(value, objectsSet, this.config.highPrio_BMS);
94
+ break;
95
+ case "ENERGY":
96
+ ["STAT_STATE","GUI_BAT_DATA_POWER","GUI_INVERTER_POWER","GUI_HOUSE_POW","GUI_GRID_POW","GUI_BAT_DATA_FUEL_CHARGE","GUI_CHARGING_INFO","GUI_BOOSTING_INFO","GUI_BAT_DATA_POWER","GUI_BAT_DATA_VOLTAGE","GUI_BAT_DATA_CURRENT","GUI_BAT_DATA_FUEL_CHARGE","GUI_BAT_DATA_OA_CHARGING","STAT_LIMITED_NET_SKEW"].forEach(item => objectsSet.add(item));
97
+ if (this.config.disclaimer && this.config.highPrio_ENERGY_active) this.addUserDps(value, objectsSet, this.config.highPrio_ENERGY);
98
+ break;
99
+ case "PV1":
100
+ ["POWER_RATIO","MPP_POWER"].forEach(item => objectsSet.add(item));
101
+ if (this.config.disclaimer && this.config.highPrio_PV1_active) this.addUserDps(value, objectsSet, this.config.highPrio_PV1);
102
+ break;
103
+ case "PWR_UNIT":
104
+ ["POWER_L1","POWER_L2","POWER_L3"].forEach(item => objectsSet.add(item));
105
+ if (this.config.disclaimer && this.config.highPrio_PWR_UNIT_active) this.addUserDps(value, objectsSet, this.config.highPrio_PWR_UNIT);
106
+ break;
107
+ case "PM1OBJ1":
108
+ ["FREQ","U_AC","I_AC","P_AC","P_TOTAL"].forEach(item => objectsSet.add(item));
109
+ if (this.config.disclaimer && this.config.highPrio_PM1OBJ1_active) this.addUserDps(value, objectsSet, this.config.highPrio_PM1OBJ1);
110
+ break;
111
+ case "PM1OBJ2":
112
+ ["FREQ","U_AC","I_AC","P_AC","P_TOTAL"].forEach(item => objectsSet.add(item));
113
+ if (this.config.disclaimer && this.config.highPrio_PM1OBJ2_active) this.addUserDps(value, objectsSet, this.config.highPrio_PM1OBJ2);
114
+ break;
115
+ case "STATISTIC":
116
+ ["LIVE_GRID_EXPORT","LIVE_GRID_IMPORT","LIVE_HOUSE_CONS","LIVE_PV_GEN","LIVE_BAT_CHARGE_MASTER","LIVE_BAT_DISCHARGE_MASTER"].forEach(item => objectsSet.add(item));
117
+ if (this.config.disclaimer && this.config.highPrio_STATISTIC_active) this.addUserDps(value, objectsSet, this.config.highPrio_STATISTIC);
118
+ break;
119
+ case "WALLBOX":
120
+ if (this.config.disclaimer && this.config.highPrio_WALLBOX_active) this.addUserDps(value, objectsSet, this.config.highPrio_WALLBOX);
121
+ break;
122
+ case "BAT1":
123
+ if (this.config.disclaimer && this.config.highPrio_BAT1_active) this.addUserDps(value, objectsSet, this.config.highPrio_BAT1);
124
+ break;
125
+ case "BAT1OBJ1":
126
+ if (this.config.disclaimer && this.config.highPrio_BAT1OBJ1_active) this.addUserDps(value, objectsSet, this.config.highPrio_BAT1OBJ1);
127
+ break;
128
+ case "BAT1OBJ2":
129
+ if (this.config.disclaimer && this.config.highPrio_BAT1OBJ2_active) this.addUserDps(value, objectsSet, this.config.highPrio_BAT2OBJ1);
130
+ break;
131
+ case "BAT1OBJ3":
132
+ if (this.config.disclaimer && this.config.highPrio_BAT1OBJ3_active) this.addUserDps(value, objectsSet, this.config.highPrio_BAT3OBJ1);
133
+ break;
134
+ case "BAT1OBJ4":
135
+ if (this.config.disclaimer && this.config.highPrio_BAT1OBJ4_active) this.addUserDps(value, objectsSet, this.config.highPrio_BAT4OBJ1);
136
+ break;
137
+ case "TEMPMEASURE":
138
+ if (this.config.disclaimer && this.config.highPrio_TEMPMEASURE_active) this.addUserDps(value, objectsSet, this.config.highPrio_TEMPMEASURE);
139
+ break;
140
+ default:
141
+ // nothing to do here
142
+ break;
143
+ }
144
+ if (objectsSet.size > 0) {
145
+ highPrioObjects.set(value, objectsSet);
146
+ }
147
+ }
148
+
149
+ lowPrioForm = lowPrioForm.slice(0, -1) + '}';
150
+ this.log.info("(initPollSettings) lowPrio: " + lowPrioForm);
151
+
152
+ // creating form for high priority pulling
153
+ highPrioForm = '{';
154
+ highPrioObjects.forEach( function (mapValue, key, map) {
155
+ highPrioForm += '"' + key + '":{';
156
+ mapValue.forEach (function (setValue) {
157
+ highPrioForm += '"' + setValue + '":"",';
158
+ })
159
+ highPrioForm = highPrioForm.slice(0, -1) + '},';
160
+ })
161
+ highPrioForm = highPrioForm.slice(0, -1) + '}';
162
+ this.log.info("(initPollSettings) highPrio: " + highPrioForm);
163
+ }
164
+
165
+ addUserDps(value, objectsSet, dpToAdd) {
166
+ if (dpToAdd.trim().length < 1 || !/^[A-Z0-9_,]*$/.test(dpToAdd.toUpperCase().trim())) { // don't accept anything but entries like DP_1,DP2,dp3
167
+ this.log.warn("(addUserDps) Datapoints config for " + value + " doesn't follow [A-Z0-9_,] (no blanks allowed!) - Ignoring: " + dpToAdd.toUpperCase().trim());
168
+ return;
169
+ }
170
+ dpToAdd.toUpperCase().trim().split(",").forEach(item => objectsSet.add(item));
171
+ this.log.info("(addUserDps) Datapoints config changed for " + value + ": " + dpToAdd.toUpperCase().trim());
172
+ }
76
173
 
77
174
  /**
78
175
  * checks config paramaters
@@ -85,8 +182,8 @@ class Senec extends utils.Adapter {
85
182
  this.config.interval = 10;
86
183
  }
87
184
  this.log.debug("(checkConf) Configured polling interval low priority: " + this.config.intervalLow);
88
- if (this.config.intervalLow < 60 || this.config.intervalLow > 3600) {
89
- this.log.warn("(checkConf) Config interval low priority " + this.config.intervalLow + " not [60..3600] minutes. Using default: 60");
185
+ if (this.config.intervalLow < 10 || this.config.intervalLow > 3600) {
186
+ this.log.warn("(checkConf) Config interval low priority " + this.config.intervalLow + " not [10..3600] minutes. Using default: 60");
90
187
  this.config.intervalLow = 60;
91
188
  }
92
189
  this.log.debug("(checkConf) Configured polling timeout: " + this.config.pollingTimeout);
@@ -168,34 +265,21 @@ class Senec extends utils.Adapter {
168
265
  );
169
266
  });
170
267
  }
171
-
172
- /**
268
+
269
+ /**
173
270
  * Read values from Senec Home V2.1
174
- * Leaving out Wallbox info because it won't be supplied by senec if no wallbox configured
271
+ * Careful with the amount and interval of HighPrio values polled because this causes high demand on the SENEC machine so it shouldn't run too often. Adverse effects: No sync with Senec possible if called too often.
175
272
  */
176
- async readSenecV21() {
177
- // read by webinterface are the following values. Not all are "high priority" though.
178
- // "STATISTIC":{"STAT_DAY_E_HOUSE":"","STAT_DAY_E_PV":"","STAT_DAY_BAT_CHARGE":"","STAT_DAY_BAT_DISCHARGE":"","STAT_DAY_E_GRID_IMPORT":"","STAT_DAY_E_GRID_EXPORT":"","STAT_YEAR_E_PU1_ARR":""}
179
- // "ENERGY":{"STAT_STATE":"","GUI_BAT_DATA_POWER":"","GUI_INVERTER_POWER":"","GUI_HOUSE_POW":"","GUI_GRID_POW":"","STAT_MAINT_REQUIRED":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_CHARGING_INFO":"","GUI_BOOSTING_INFO":""}
180
- // "WIZARD":{"CONFIG_LOADED":""},"SYS_UPDATE":{"UPDATE_AVAILABLE":""}
181
- // "PV1":{"POWER_RATIO":""},"WIZARD":{"MAC_ADDRESS_BYTES":""},"BAT1OBJ1":{"BMS_NR_INSTALLED":"","SPECIAL_TIMEOUT":"","INV_CYCLE":"","TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","SW_VERSION":"","SW_VERSION2":"","SW_VERSION3":"","I_DC":""},"BAT1OBJ2":{"TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","I_DC":""},"BAT1OBJ3":{"TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","I_DC":""},"PWR_UNIT":{"POWER_L1":"","POWER_L2":"","POWER_L3":""},"BAT1":{"CEI_LIMIT":""},"BMS":{}
182
- // "PM1OBJ1":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""},"PM1OBJ2":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}
183
- // "ENERGY":{"STAT_HOURS_OF_OPERATION":"","STAT_DAYS_SINCE_MAINT":"","GUI_BAT_DATA_POWER":"","GUI_BAT_DATA_VOLTAGE":"","GUI_BAT_DATA_CURRENT":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_BAT_DATA_OA_CHARGING":"","STAT_SULFAT_CHRG_COUNTER":"","STAT_LIMITED_NET_SKEW":"","STAT_LIMITED_NO_STAND_BY":"","GUI_CAP_TEST_DIS_COUNT":"","GUI_SCHARGE_REMAIN":"","GUI_SCHARGE_ELAPSED":"","GUI_CHARGING_INFO":"","OFFPEAK_DURATION":"","OFFPEAK_RUNNING":"","OFFPEAK_CURRENT":"","OFFPEAK_TARGET":""},"SYS_UPDATE":{"NPU_VER":"","NPU_IMAGE_VERSION":""}}
184
-
185
- const url = connectVia + this.config.senecip + '/lala.cgi';
186
- var form = '{';
187
- form += '"BMS":{"CELL_TEMPERATURES_MODULE_A":"","CELL_TEMPERATURES_MODULE_B":"","CELL_TEMPERATURES_MODULE_C":"","CELL_TEMPERATURES_MODULE_D":"","CELL_VOLTAGES_MODULE_A":"","CELL_VOLTAGES_MODULE_B":"","CELL_VOLTAGES_MODULE_C":"","CELL_VOLTAGES_MODULE_D":"","CURRENT":"","SOC":"","SYSTEM_SOC":"","TEMP_MAX":"","TEMP_MIN":"","VOLTAGE":""}';
188
- form += ',"ENERGY":{"STAT_STATE":"","GUI_BAT_DATA_POWER":"","GUI_INVERTER_POWER":"","GUI_HOUSE_POW":"","GUI_GRID_POW":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_CHARGING_INFO":"","GUI_BOOSTING_INFO":"","GUI_BAT_DATA_POWER":"","GUI_BAT_DATA_VOLTAGE":"","GUI_BAT_DATA_CURRENT":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_BAT_DATA_OA_CHARGING":"","STAT_LIMITED_NET_SKEW":""}';
189
- form += ',"PV1":{"POWER_RATIO":"","MPP_POWER":""}';
190
- form += ',"PWR_UNIT":{"POWER_L1":"","POWER_L2":"","POWER_L3":""}';
191
- form += ',"PM1OBJ1":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}';
192
- form += ',"PM1OBJ2":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}';
193
- form += ',"STATISTIC":{"LIVE_GRID_EXPORT":"","LIVE_GRID_IMPORT":"","LIVE_HOUSE_CONS":"","LIVE_PV_GEN":"","LIVE_BAT_CHARGE_MASTER":"","LIVE_BAT_DISCHARGE_MASTER":""}';
194
- form += ',"WALLBOX":{"APPARENT_CHARGING_POWER":"","PROHIBIT_USAGE":"","EV_CONNECTED":"","STATE":""}';
195
- form += '}';
196
-
197
- try {
198
- var body = await this.doGet(url, form, this, this.config.pollingTimeout);
273
+ async pollSenec(isHighPrio, retry) {
274
+ const url = connectVia + this.config.senecip + '/lala.cgi';
275
+ var interval = this.config.interval * 1000;
276
+ if (!isHighPrio) {
277
+ this.log.info('LowPrio polling ...');
278
+ interval = this.config.intervalLow * 1000 * 60
279
+ }
280
+
281
+ try {
282
+ var body = await this.doGet(url, (isHighPrio ? highPrioForm : lowPrioForm), this, this.config.pollingTimeout);
199
283
  if (body.includes('\\"')) {
200
284
  // in rare cases senec reports back extra escape sequences on some machines ...
201
285
  this.log.info("(Poll) Double escapes detected! Body inc: " + body);
@@ -207,56 +291,19 @@ class Senec extends utils.Adapter {
207
291
 
208
292
  retry = 0;
209
293
  if (unloaded) return;
210
- this.timer = setTimeout(() => this.readSenecV21(), this.config.interval * 1000);
294
+ this.timer = setTimeout(() => this.pollSenec(isHighPrio, retry), interval);
211
295
  } catch (error) {
212
296
  if ((retry == this.config.retries) && this.config.retries < 999) {
213
- this.log.error("Error reading from Senec (" + this.config.senecip + "). Retried " + retry + " times. Giving up now. Check config and restart adapter. (" + error + ")");
297
+ this.log.error("Error reading from Senec " + (isHighPrio ? "high" : "low") + "Prio (" + this.config.senecip + "). Retried " + retry + " times. Giving up now. Check config and restart adapter. (" + error + ")");
214
298
  this.setState('info.connection', false, true);
215
299
  } else {
216
300
  retry += 1;
217
- this.log.warn("Error reading from Senec (" + this.config.senecip + "). Retry " + retry + "/" + this.config.retries + " in " + this.config.interval * this.config.retrymultiplier * retry + " seconds! (" + error + ")");
218
- this.timer = setTimeout(() => this.readSenecV21(), this.config.interval * this.config.retrymultiplier * retry * 1000);
301
+ this.log.warn("Error reading from Senec " + (isHighPrio ? "high" : "low") + "Prio (" + this.config.senecip + "). Retry " + retry + "/" + this.config.retries + " in " + (interval * this.config.retrymultiplier * retry) / 1000 + " seconds! (" + error + ")");
302
+ this.timer = setTimeout(() => this.pollSenec(isHighPrio, retry), interval * this.config.retrymultiplier * retry);
219
303
  }
220
304
  }
221
- }
222
-
223
- /**
224
- * Read ALL values from Senec Home V2.1
225
- * This causes high demand on the SENEC machine so it shouldn't run too often. Adverse effects: No sync with Senec possible if called too often.
226
- */
227
- async readSenecV21LowPrio() {
228
- this.log.info('LowPrio polling ...');
229
- // we are polling all known objects ...
230
-
231
- const url = connectVia + this.config.senecip + '/lala.cgi';
232
- const form = '{"STATISTIC":{},"ENERGY":{},"FEATURES":{},"LOG":{},"SYS_UPDATE":{},"WIZARD":{},"BMS":{},"BAT1":{},"BAT1OBJ1":{},"BAT1OBJ2":{},"BAT1OBJ2":{},"BAT1OBJ3":{},"BAT1OBJ4":{},"PWR_UNIT":{},"PM1OBJ1":{},"PM1OBJ2":{},"PV1":{},"FACTORY":{},"GRIDCONFIG":{},"EG_CONTROL":{},"RTC":{},"PM1":{},"TEMPMEASURE":{},"DEBUG":{},"SOCKETS":{},"CASC":{},"WALLBOX":{},"CONNX50":{},"STECA":{}}';
233
-
234
- try {
235
- var body = await this.doGet(url, form, this, this.config.pollingTimeout);
236
- if (body.includes('\\"')) {
237
- // in rare cases senec reports back extra escape sequences on some machines ...
238
- this.log.info("(Poll) Double escapes detected! Body inc: " + body);
239
- body = body.replace(/\\"/g, '"');
240
- this.log.info("(Poll) Double escapes autofixed! Body out: " + body);
241
- }
242
- var obj = JSON.parse(body, reviverNumParse);
243
-
244
- await this.evalPoll(obj);
245
-
246
- retryLowPrio = 0;
247
- if (unloaded) return;
248
- this.timerLowPrio = setTimeout(() => this.readSenecV21LowPrio(), this.config.intervalLow * 1000 * 60);
249
- } catch (error) {
250
- if ((retryLowPrio == this.config.retries) && this.config.retries < 999) {
251
- this.log.error("Error reading from Senec lowPrio (" + this.config.senecip + "). Retried " + retryLowPrio + " times. Giving up now. Check config and restart adapter. (" + error + ")");
252
- this.setState('info.connection', false, true);
253
- } else {
254
- retryLowPrio += 1;
255
- this.log.warn("Error reading from Senec lowPrio (" + this.config.senecip + "). Retry " + retryLowPrio + "/" + this.config.retries + " in " + this.config.interval * this.config.retrymultiplier * retryLowPrio + " minutes! (" + error + ")");
256
- this.timerLowPrio = setTimeout(() => this.readSenecV21LowPrio(), this.config.interval * this.config.retrymultiplier * retryLowPrio * 1000 * 60);
257
- }
258
- }
259
- }
305
+
306
+ }
260
307
 
261
308
  /**
262
309
  * sets a state's value and creates the state if it doesn't exist yet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.senec",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "description": "Senec Home",
5
5
  "author": {
6
6
  "name": "NoBl",