iobroker.senec 1.6.6 → 1.6.8
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 +6 -0
- package/admin/jsonConfig.json +34 -0
- package/io-package.json +54 -4
- package/main.js +65 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,12 @@ This channel contains values polled from SENEC App-API.
|
|
|
293
293
|
|
|
294
294
|
|
|
295
295
|
## Changelog
|
|
296
|
+
### 1.6.8 (NoBl)
|
|
297
|
+
* Added switch control.ForceLoadBattery to start/stop charging battery. Use this to start/stop forced charging (like with dynamic power prices, ...).
|
|
298
|
+
|
|
299
|
+
### 1.6.7 (NoBl)
|
|
300
|
+
* Added option to turn off local polling.
|
|
301
|
+
|
|
296
302
|
### 1.6.6 (NoBl)
|
|
297
303
|
* Node 16 required
|
|
298
304
|
* Bugfixes
|
package/admin/jsonConfig.json
CHANGED
|
@@ -18,6 +18,40 @@
|
|
|
18
18
|
"zh-cn": "一般环境"
|
|
19
19
|
},
|
|
20
20
|
"items": {
|
|
21
|
+
"lala_use": {
|
|
22
|
+
"type": "checkbox",
|
|
23
|
+
"sm": 12,
|
|
24
|
+
"md": 6,
|
|
25
|
+
"lg": 6,
|
|
26
|
+
"label": {
|
|
27
|
+
"en": "Connect via lala.cgi?",
|
|
28
|
+
"de": "Verbinden über lala.cgi?",
|
|
29
|
+
"ru": "Подключитесь через lala.cgi?",
|
|
30
|
+
"pt": "Ligar via lala.cgi?",
|
|
31
|
+
"nl": "Connecteren via lala.cgi?",
|
|
32
|
+
"fr": "Connectez-vous via lala.cgi?",
|
|
33
|
+
"it": "Collegare via lala.cgi?",
|
|
34
|
+
"es": "¿Conectar vía lala.cgi?",
|
|
35
|
+
"pl": "Połączenie przez lala.cgi?",
|
|
36
|
+
"uk": "Підключення через lala.cgi?",
|
|
37
|
+
"zh-cn": "陪审团?"
|
|
38
|
+
},
|
|
39
|
+
"help": {
|
|
40
|
+
"en": "Connect to SENEC appliance via local network. This requires access to local monitoring.",
|
|
41
|
+
"de": "Verbindung zum SENEC Gerät wird über lokales Netzwerk hergestellt. Dies erfordert den Zugang zur lokalen Überwachung.",
|
|
42
|
+
"ru": "Подключитесь к SENEC Appliance через местную сеть. Это требует доступа к местному мониторингу.",
|
|
43
|
+
"pt": "Conecte-se ao aparelho SENEC via rede local. Isso requer acesso ao monitoramento local.",
|
|
44
|
+
"nl": "Verbinding met SENEC appliance via het lokale netwerk. Dit vereist toegang tot de lokale monitoring.",
|
|
45
|
+
"fr": "Connectez-vous à l'appareil SENEC via le réseau local. Cela nécessite l'accès à la surveillance locale.",
|
|
46
|
+
"it": "Collegare l'apparecchio SENEC tramite rete locale. Ciò richiede l'accesso al monitoraggio locale.",
|
|
47
|
+
"es": "Conéctese a SENEC appliance vía red local. Esto requiere acceso a la vigilancia local.",
|
|
48
|
+
"pl": "Złącza się do SENEC poprzez lokalną sieć. Potrzebuje to dostęp do monitorowania miejscowego.",
|
|
49
|
+
"uk": "Підключення до додатку SENEC через локальну мережу. Це вимагає доступу до локального моніторингу.",
|
|
50
|
+
"zh-cn": "通过当地网络,与SENEC的观察站一致。 这需要获得地方监测。."
|
|
51
|
+
},
|
|
52
|
+
"default": true,
|
|
53
|
+
"newLine": true
|
|
54
|
+
},
|
|
21
55
|
"senecip": {
|
|
22
56
|
"type": "text",
|
|
23
57
|
"sm": 12,
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "senec",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.8",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.6.8": {
|
|
7
|
+
"en": "Added switch control.ForceLoadBattery to start/stop charging battery. Use this to start/stop forced charging (like with dynamic power prices, ...).",
|
|
8
|
+
"de": "Schalter control.ForceLoadBattery hinzugefügt, um ein Laden des Speichers zu forcieren (analog zur Funktion im lokalen Interface). Nützlich in Verbindung mit dynamischen Stromtarifen, etc.",
|
|
9
|
+
"ru": "Добавлен контроль переключателя. СилаLoad Батарея для начала / остановки зарядки батареи. Используйте это для начала / остановки принудительного зарядки (например, с динамическими ценами питания, ...).",
|
|
10
|
+
"pt": "Adicionado controle de interruptor. Força Bateria para iniciar / parar de carregar bateria. Use isso para iniciar / parar de carga forçada (como com preços de energia dinâmica, ...).",
|
|
11
|
+
"nl": "Veranderingscontrole. Force Batterijen om te starten/ stop met batterijen. Gebruik dit om te beginnen en stop met het opladen van dynamische krachtprijzen.",
|
|
12
|
+
"fr": "Ajout de la commande. ForceLoad Batterie de démarrage/arrêt de batterie de charge. Utilisez ceci pour commencer / arrêter la charge forcée (comme avec les prix de puissance dynamique, ...).",
|
|
13
|
+
"it": "Aggiunta di controllo dell'interruttore. Forza! Batteria per avviare / fermare la batteria di ricarica. Utilizzare questo per avviare / fermare la ricarica forzata (come con i prezzi di potenza dinamica, ...).",
|
|
14
|
+
"es": "Control de cambio añadido. ForceLoad Batería para iniciar / detener la batería de carga. Utilice esto para iniciar / detener la carga forzada (como con los precios de potencia dinámicos, ...).",
|
|
15
|
+
"pl": "Kontrola przełącznikowa. ForceLoad Bateria rozpoczynająca/zatrzymanie baterii. Wykorzystuje to do rozpoczęcia/stopowania (jak z dynamicznymi cenami mocy).",
|
|
16
|
+
"uk": "Додано контроль перемикання. Приват24 Акумулятор для запуску / зарядки акумулятора. Використовуйте це для запуску / stop примусової зарядки (наприклад, з динамічними цінами потужності, ...).",
|
|
17
|
+
"zh-cn": "添加了转换控制。 部队 开始/禁止劫持电池。 利用这开始/禁止强迫征集(与动态发电价格相似,......)。."
|
|
18
|
+
},
|
|
19
|
+
"1.6.7": {
|
|
20
|
+
"en": "Added option to turn off local polling.",
|
|
21
|
+
"de": "Option hinzugefügt, um die lokale Abfrage der Appliance abzuschalten.",
|
|
22
|
+
"ru": "Добавлена возможность отключить локальный опрос.",
|
|
23
|
+
"pt": "Opção adicionada para desligar a sondagem local.",
|
|
24
|
+
"nl": "Toegevoegd optie om lokale peilingen uit te zetten.",
|
|
25
|
+
"fr": "Ajout de l'option pour désactiver le vote local.",
|
|
26
|
+
"it": "Aggiunta opzione per spegnere polling locale.",
|
|
27
|
+
"es": "Se agregó la opción de apagar las encuestas locales.",
|
|
28
|
+
"pl": "Wstępna opcja, aby odwołać lokalną sondę.",
|
|
29
|
+
"uk": "Додана можливість вимкнути локальне опитування.",
|
|
30
|
+
"zh-cn": "增加地方投票的选择。."
|
|
31
|
+
},
|
|
6
32
|
"1.6.6": {
|
|
7
33
|
"en": "Node 16 required; Bugfixes; Removed non-existing branches: _calc, Bat1Obj[2-4], Display, Statistic, File; Added branches: CURRENT_IMBALANCE_CONTROL, BMZ_CURRENT_LIMITS, CELL_DEVIATION_ROC, SENEC_IO_OUTPUT, SENEC_IO_INPUT",
|
|
8
34
|
"de": "Node 16 erforderlich; Bugfixes; Entfernt: _calc, Bat1Obj[2-4,] Display, Statistic, Datei; Hinzugefügt: CURRENT_IMBALANCE_CONTROL, BMZ_CURRENT_LIMITS, CELL_DEVIATION_ROC, SENEC_IO_OUTPUT, SENEC_IO_INPUT",
|
|
@@ -199,6 +225,7 @@
|
|
|
199
225
|
]
|
|
200
226
|
},
|
|
201
227
|
"native": {
|
|
228
|
+
"lala_use": true,
|
|
202
229
|
"senecip": "0.0.0.0",
|
|
203
230
|
"interval": 10,
|
|
204
231
|
"intervalLow": 60,
|
|
@@ -236,14 +263,16 @@
|
|
|
236
263
|
"api_pwd": ""
|
|
237
264
|
},
|
|
238
265
|
"objects": [],
|
|
239
|
-
"instanceObjects": [
|
|
266
|
+
"instanceObjects": [
|
|
267
|
+
{
|
|
240
268
|
"_id": "info",
|
|
241
269
|
"type": "channel",
|
|
242
270
|
"common": {
|
|
243
271
|
"name": "Information"
|
|
244
272
|
},
|
|
245
273
|
"native": {}
|
|
246
|
-
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
247
276
|
"_id": "info.connection",
|
|
248
277
|
"type": "state",
|
|
249
278
|
"common": {
|
|
@@ -255,6 +284,27 @@
|
|
|
255
284
|
"def": false
|
|
256
285
|
},
|
|
257
286
|
"native": {}
|
|
258
|
-
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"_id": "control",
|
|
290
|
+
"type": "channel",
|
|
291
|
+
"common": {
|
|
292
|
+
"name": "Control Buttons"
|
|
293
|
+
},
|
|
294
|
+
"native": {}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"_id": "control.ForceLoadBattery",
|
|
298
|
+
"type": "state",
|
|
299
|
+
"common": {
|
|
300
|
+
"role": "switch",
|
|
301
|
+
"name": "Force Load Battery",
|
|
302
|
+
"type": "boolean",
|
|
303
|
+
"read": true,
|
|
304
|
+
"write": true,
|
|
305
|
+
"def": false
|
|
306
|
+
},
|
|
307
|
+
"native": {}
|
|
308
|
+
}
|
|
259
309
|
]
|
|
260
310
|
}
|
package/main.js
CHANGED
|
@@ -22,7 +22,11 @@ const apiLoginUrl = apiUrl + "/login";
|
|
|
22
22
|
const apiSystemsUrl = apiUrl + "/anlagen";
|
|
23
23
|
const apiKnownSystems = []
|
|
24
24
|
|
|
25
|
+
const batteryOn = '{"ENERGY":{"SAFE_CHARGE_FORCE":"u8_01"}}';
|
|
26
|
+
const batteryOff = '{"ENERGY":{"SAFE_CHARGE_PROHIBIT":"u8_01"}}';
|
|
27
|
+
|
|
25
28
|
let apiConnected = false;
|
|
29
|
+
let lalaConnected = false;
|
|
26
30
|
let apiLoginToken = "";
|
|
27
31
|
let retry = 0; // retry-counter
|
|
28
32
|
let retryLowPrio = 0; // retry-counter
|
|
@@ -49,6 +53,7 @@ class Senec extends utils.Adapter {
|
|
|
49
53
|
name: 'senec',
|
|
50
54
|
});
|
|
51
55
|
this.on('ready', this.onReady.bind(this));
|
|
56
|
+
this.on('stateChange', this.onStateChange.bind(this));
|
|
52
57
|
this.on('unload', this.onUnload.bind(this));
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -62,19 +67,69 @@ class Senec extends utils.Adapter {
|
|
|
62
67
|
this.setState('info.connection', false, true);
|
|
63
68
|
try {
|
|
64
69
|
await this.checkConfig();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if (this.config.lala_use) {
|
|
71
|
+
this.log.info("Usage of lala.cgi configured.");
|
|
72
|
+
await this.initPollSettings();
|
|
73
|
+
await this.checkConnection();
|
|
74
|
+
if (lalaConnected) {
|
|
75
|
+
await this.pollSenec(true, 0); // highPrio
|
|
76
|
+
await this.pollSenec(false, 0); // lowPrio
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
this.log.warn("Usage of lala.cgi not configured. Only polling SENEC App API if configured.");
|
|
80
|
+
}
|
|
81
|
+
if (this.config.api_use) {
|
|
82
|
+
this.log.info("Usage of SENEC App API configured.");
|
|
83
|
+
await this.initSenecAppApi();
|
|
84
|
+
if (apiConnected) {
|
|
85
|
+
await this.getApiSystems();
|
|
86
|
+
await this.pollSenecAppApi(0); // App API
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
this.log.warn("Usage of SENEC App API not configured. Only polling appliance via local network if configured.");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (lalaConnected || apiConnected) {
|
|
93
|
+
this.setState('info.connection', true, true);
|
|
94
|
+
} else {
|
|
95
|
+
this.log.error("Neither local connection nor API connection configured. Please check config!");
|
|
96
|
+
}
|
|
97
|
+
await this.subscribeStatesAsync("control.*"); // subscribe on all state changes in control.
|
|
73
98
|
} catch (error) {
|
|
74
99
|
this.log.error(error);
|
|
75
100
|
this.setState('info.connection', false, true);
|
|
76
101
|
}
|
|
77
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {string} id
|
|
106
|
+
* @param {ioBroker.State | null | undefined} state
|
|
107
|
+
*/
|
|
108
|
+
onStateChange(id, state) {
|
|
109
|
+
if (state && !state.ack) {
|
|
110
|
+
this.log.debug("State changed: " + id + " ( " + JSON.stringify(state) + " )");
|
|
111
|
+
|
|
112
|
+
if (id === this.namespace + '.control.ForceLoadBattery' && lalaConnected) {
|
|
113
|
+
const url = connectVia + this.config.senecip + '/lala.cgi';
|
|
114
|
+
try {
|
|
115
|
+
if (state.val) {
|
|
116
|
+
this.log.info('Enable force battery charging ...');
|
|
117
|
+
this.doGet(url, batteryOn, this, this.config.pollingTimeout, true);
|
|
118
|
+
} else {
|
|
119
|
+
this.log.info('Disable force battery charging ...');
|
|
120
|
+
this.doGet(url, batteryOff, this, this.config.pollingTimeout, true);
|
|
121
|
+
}
|
|
122
|
+
} catch (error) {
|
|
123
|
+
this.log.error(error);
|
|
124
|
+
this.log.error("Failed to control: setting force battery charging mode to " + state.val);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Verarbeitung bestätigen
|
|
130
|
+
this.setStateAsync(id, { val: state.val, ack: true });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
78
133
|
|
|
79
134
|
/**
|
|
80
135
|
* Is called when adapter shuts down - callback has to be called under any circumstances!
|
|
@@ -227,6 +282,7 @@ class Senec extends utils.Adapter {
|
|
|
227
282
|
this.log.info('connecting to Senec: ' + url);
|
|
228
283
|
const body = await this.doGet(url, form, this, this.config.pollingTimeout, true);
|
|
229
284
|
this.log.info('connected to Senec: ' + url);
|
|
285
|
+
lalaConnected = true;
|
|
230
286
|
} catch (error) {
|
|
231
287
|
throw new Error("Error connecting to Senec (IP: " + connectVia + this.config.senecip + "). Exiting! (" + error + "). Try to toggle https-mode in settings and check FQDN of SENEC appliance.");
|
|
232
288
|
}
|
|
@@ -333,6 +389,7 @@ class Senec extends utils.Adapter {
|
|
|
333
389
|
);
|
|
334
390
|
});
|
|
335
391
|
}
|
|
392
|
+
|
|
336
393
|
|
|
337
394
|
/**
|
|
338
395
|
* Read values from Senec Home V2.1
|