iobroker.senec 1.6.7 → 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 +3 -0
- package/io-package.json +40 -4
- package/main.js +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,9 @@ 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
|
+
|
|
296
299
|
### 1.6.7 (NoBl)
|
|
297
300
|
* Added option to turn off local polling.
|
|
298
301
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
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
|
+
},
|
|
6
19
|
"1.6.7": {
|
|
7
20
|
"en": "Added option to turn off local polling.",
|
|
8
21
|
"de": "Option hinzugefügt, um die lokale Abfrage der Appliance abzuschalten.",
|
|
@@ -250,14 +263,16 @@
|
|
|
250
263
|
"api_pwd": ""
|
|
251
264
|
},
|
|
252
265
|
"objects": [],
|
|
253
|
-
"instanceObjects": [
|
|
266
|
+
"instanceObjects": [
|
|
267
|
+
{
|
|
254
268
|
"_id": "info",
|
|
255
269
|
"type": "channel",
|
|
256
270
|
"common": {
|
|
257
271
|
"name": "Information"
|
|
258
272
|
},
|
|
259
273
|
"native": {}
|
|
260
|
-
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
261
276
|
"_id": "info.connection",
|
|
262
277
|
"type": "state",
|
|
263
278
|
"common": {
|
|
@@ -269,6 +284,27 @@
|
|
|
269
284
|
"def": false
|
|
270
285
|
},
|
|
271
286
|
"native": {}
|
|
272
|
-
}
|
|
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
|
+
}
|
|
273
309
|
]
|
|
274
310
|
}
|
package/main.js
CHANGED
|
@@ -22,6 +22,9 @@ 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;
|
|
26
29
|
let lalaConnected = false;
|
|
27
30
|
let apiLoginToken = "";
|
|
@@ -50,6 +53,7 @@ class Senec extends utils.Adapter {
|
|
|
50
53
|
name: 'senec',
|
|
51
54
|
});
|
|
52
55
|
this.on('ready', this.onReady.bind(this));
|
|
56
|
+
this.on('stateChange', this.onStateChange.bind(this));
|
|
53
57
|
this.on('unload', this.onUnload.bind(this));
|
|
54
58
|
}
|
|
55
59
|
|
|
@@ -84,16 +88,48 @@ class Senec extends utils.Adapter {
|
|
|
84
88
|
} else {
|
|
85
89
|
this.log.warn("Usage of SENEC App API not configured. Only polling appliance via local network if configured.");
|
|
86
90
|
}
|
|
91
|
+
|
|
87
92
|
if (lalaConnected || apiConnected) {
|
|
88
93
|
this.setState('info.connection', true, true);
|
|
89
94
|
} else {
|
|
90
95
|
this.log.error("Neither local connection nor API connection configured. Please check config!");
|
|
91
96
|
}
|
|
97
|
+
await this.subscribeStatesAsync("control.*"); // subscribe on all state changes in control.
|
|
92
98
|
} catch (error) {
|
|
93
99
|
this.log.error(error);
|
|
94
100
|
this.setState('info.connection', false, true);
|
|
95
101
|
}
|
|
96
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
|
+
}
|
|
97
133
|
|
|
98
134
|
/**
|
|
99
135
|
* Is called when adapter shuts down - callback has to be called under any circumstances!
|
|
@@ -353,6 +389,7 @@ class Senec extends utils.Adapter {
|
|
|
353
389
|
);
|
|
354
390
|
});
|
|
355
391
|
}
|
|
392
|
+
|
|
356
393
|
|
|
357
394
|
/**
|
|
358
395
|
* Read values from Senec Home V2.1
|