iobroker.ebus 3.1.1 → 3.2.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 +5 -0
- package/admin/index_m.html +109 -39
- package/admin/words.js +2 -0
- package/io-package.json +15 -2
- package/main.js +225 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,11 @@ Attention: command in datapoint ebus.0.cmd is deleted after executing of command
|
|
|
55
55
|
|
|
56
56
|
## Changelog
|
|
57
57
|
|
|
58
|
+
### 3.2.0 (2023-02-11)
|
|
59
|
+
* (René) **Attention** polled variables must be set as active in admin now
|
|
60
|
+
* (René) search available variables per circuit added in admin
|
|
61
|
+
* (René) DP "find" added to force read of all existing datapoints (Attention: might take a while) and update name in data point tree
|
|
62
|
+
|
|
58
63
|
### 3.1.1 (2023-01-31)
|
|
59
64
|
* (René) support ebusd 23.1
|
|
60
65
|
* (René) see issue #77: make sure that only one data request is running at the same time
|
package/admin/index_m.html
CHANGED
|
@@ -56,6 +56,54 @@
|
|
|
56
56
|
<!-- you have to define 2 functions in the global scope: -->
|
|
57
57
|
<script type="text/javascript">
|
|
58
58
|
|
|
59
|
+
|
|
60
|
+
//var timeout2;
|
|
61
|
+
function findParams(circuit, onChange, instance) {
|
|
62
|
+
//timeout2 = setTimeout(function () {
|
|
63
|
+
// getUUID(onChange, instance);
|
|
64
|
+
//}, 4000);
|
|
65
|
+
|
|
66
|
+
//function sendTo(_adapter_instance, command, message, callback)
|
|
67
|
+
|
|
68
|
+
console.log("findParams called with " + circuit);
|
|
69
|
+
|
|
70
|
+
sendTo(instance, 'findParams', circuit, function (list) {
|
|
71
|
+
//if (timeout2) {
|
|
72
|
+
// clearTimeout(timeout2);
|
|
73
|
+
// timeout2 = null;
|
|
74
|
+
//}
|
|
75
|
+
|
|
76
|
+
console.log('got params ' + JSON.stringify(list));
|
|
77
|
+
|
|
78
|
+
let polledVars = table2values('polledDP');
|
|
79
|
+
|
|
80
|
+
//console.log('current list ' + JSON.stringify(polledVars));
|
|
81
|
+
|
|
82
|
+
for (let i = 0; i < list.length; i++) {
|
|
83
|
+
|
|
84
|
+
//console.log('add ' + JSON.stringify(list[i]));
|
|
85
|
+
|
|
86
|
+
let entry = {
|
|
87
|
+
active: list[i].active,
|
|
88
|
+
circuit: list[i].circuit,
|
|
89
|
+
name: list[i].name,
|
|
90
|
+
parameter: ""
|
|
91
|
+
}
|
|
92
|
+
polledVars.push(entry);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//console.log('new list ' + JSON.stringify(polledVars));
|
|
96
|
+
|
|
97
|
+
values2table('polledDP', polledVars, OnChange, tablePolledDPOnReady);
|
|
98
|
+
|
|
99
|
+
showHideSettings();
|
|
100
|
+
onChange(true);
|
|
101
|
+
M.updateTextFields();
|
|
102
|
+
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
59
107
|
// the function loadSettings has to exist ...
|
|
60
108
|
function load(settings, onChange) {
|
|
61
109
|
|
|
@@ -86,6 +134,13 @@
|
|
|
86
134
|
FillTablePolledDP(settings);
|
|
87
135
|
FillTableHistoryDP(settings);
|
|
88
136
|
|
|
137
|
+
var _id = 'ebus.' + instance;
|
|
138
|
+
|
|
139
|
+
$("#findParams").click(function () {
|
|
140
|
+
let circuit= $("#Circuit4Find").val();
|
|
141
|
+
findParams(circuit, onChange, _id);
|
|
142
|
+
});
|
|
143
|
+
|
|
89
144
|
}
|
|
90
145
|
|
|
91
146
|
function FillTablePolledDP(settings) {
|
|
@@ -288,61 +343,76 @@
|
|
|
288
343
|
|
|
289
344
|
</div>
|
|
290
345
|
|
|
291
|
-
|
|
292
|
-
|
|
346
|
+
<!-- tab "tab-polledDP" -->
|
|
347
|
+
<div id="tab-polledDP" class="col s12 page">
|
|
293
348
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
</div>
|
|
349
|
+
<div class="row">
|
|
350
|
+
<div class="col s6">
|
|
351
|
+
<span class="translate">hint_ebusd_polled</span>
|
|
298
352
|
</div>
|
|
353
|
+
</div>
|
|
299
354
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
<a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
|
|
355
|
+
<div class="col s12" id="polledDP">
|
|
303
356
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
</thead>
|
|
314
|
-
</table>
|
|
357
|
+
<div class="row">
|
|
358
|
+
<div class="input-field col s2 m2 l2">
|
|
359
|
+
<button class="btn-floating btn-small waves-effect waves-light" title="findParams" id="findParams">
|
|
360
|
+
<i class="material-icons">search</i>
|
|
361
|
+
</button>
|
|
362
|
+
</div>
|
|
363
|
+
<div class="input-field col s4 m4 l4">
|
|
364
|
+
<input class="value" id="Circuit4Find" type="text" />
|
|
365
|
+
<label for="maxretries" class="translate">Circuit4Find</label>
|
|
315
366
|
</div>
|
|
316
367
|
</div>
|
|
368
|
+
<div class="row">
|
|
369
|
+
<a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
|
|
370
|
+
</div>
|
|
371
|
+
<div class="table-values-div">
|
|
372
|
+
<table id="table_polledDP" class="table-values" style="width: 100%;">
|
|
373
|
+
<thead>
|
|
374
|
+
<tr>
|
|
375
|
+
<th id="polledDP_col_0" data-type="checkbox" data-name="active" style=" background: #64b5f6 " class="translate">active</th>
|
|
376
|
+
<th id="polledDP_col_1" data-type="text" data-name="circuit" style="width: 20%; background: #64b5f6 " class="translate">circuit</th>
|
|
377
|
+
<th id="polledDP_col_2" data-type="text" data-name="name" style="background: #64b5f6" class="translate">name</th>
|
|
378
|
+
<th id="polledDP_col_3" data-type="text" data-name="parameter" style="background: #64b5f6" class="translate">addParameter</th>
|
|
379
|
+
<th data-buttons="up down delete" style="width: 100px; background: #64b5f6"></th>
|
|
380
|
+
</tr>
|
|
381
|
+
</thead>
|
|
382
|
+
</table>
|
|
383
|
+
</div>
|
|
317
384
|
</div>
|
|
385
|
+
</div>
|
|
318
386
|
|
|
319
|
-
|
|
320
|
-
<div id="tab-historyDP" class="col s12 page">
|
|
387
|
+
|
|
321
388
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
389
|
+
<!-- tab "tab-historyDP" -->
|
|
390
|
+
<div id="tab-historyDP" class="col s12 page">
|
|
391
|
+
|
|
392
|
+
<div class="row">
|
|
393
|
+
<div class="col s6">
|
|
394
|
+
<span class="translate">hint_ebusd_history</span>
|
|
326
395
|
</div>
|
|
396
|
+
</div>
|
|
327
397
|
|
|
328
|
-
|
|
398
|
+
<div class="col s12" id="historyDP">
|
|
329
399
|
|
|
330
|
-
|
|
400
|
+
<a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
|
|
331
401
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
</div>
|
|
402
|
+
<div class="table-values-div">
|
|
403
|
+
<table id="table_historyDP" class="table-values" style="width: 100%;">
|
|
404
|
+
<thead>
|
|
405
|
+
<tr>
|
|
406
|
+
<th id="historyDP_col_1" data-name="name" style="width: 20%; background: #64b5f6 " class="translate">name</th>
|
|
407
|
+
<th data-buttons="add up down delete" style="width: 100px; background: #64b5f6"></th>
|
|
408
|
+
</tr>
|
|
409
|
+
</thead>
|
|
410
|
+
</table>
|
|
342
411
|
</div>
|
|
343
412
|
</div>
|
|
344
|
-
|
|
345
413
|
</div>
|
|
414
|
+
|
|
415
|
+
</div>
|
|
346
416
|
</div>
|
|
347
417
|
</body>
|
|
348
418
|
</html>
|
package/admin/words.js
CHANGED
|
@@ -24,4 +24,6 @@ systemDictionary = {
|
|
|
24
24
|
"target_IP": { "en": "target IP", "de": "Ziel-IP", "ru": "целевой IP-адрес", "pt": "IP alvo", "nl": "doel-IP", "fr": "cible IP", "it": "IP di destinazione", "es": "IP objetivo", "pl": "docelowy adres IP", "uk": "цільовий IP", "zh-cn": "目标IP"},
|
|
25
25
|
"target_TelnetPort": { "en": "target telnet Port to write data", "de": "target telnet Port zum Schreiben von Daten", "ru": "целевой порт telnet для записи данных", "pt": "destino telnet porta para escrever dados", "nl": "doel telnet-poort om gegevens te schrijven", "fr": "Port telnet cible pour écrire des données", "it": "Porta telnet target per scrivere dati", "es": "target telnet Port para escribir datos", "pl": "docelowy port telnet do zapisu danych", "uk": "target telnet Порт для запису даних", "zh-cn": "目标telnet用于写入数据的端口"},
|
|
26
26
|
"useBoolean4Onoff": { "en": "use boolean instead string for datapoints with on/off values ", "de": "Verwenden Sie Boolean anstelle von Strings für Datenpunkte mit Ein-/Aus-Werten", "ru": "используйте логическое значение вместо строки для точек данных со значениями включения / выключения", "pt": "use booleano em vez de string para pontos de dados com valores on / off", "nl": "gebruik in plaats daarvan booleaanse string voor datapunten met aan/uit-waarden", "fr": "utiliser une chaîne booléenne à la place pour les points de données avec des valeurs activées/désactivées", "it": "usa la stringa booleana invece per i punti dati con valori on/off", "es": "use booleano en lugar de cadena para puntos de datos con valores de encendido / apagado", "pl": "użyj wartości logicznej zamiast ciągu dla punktów danych z wartościami włączonymi / wyłączonymi", "uk": "використовуйте логічне значення замість рядка для точок даних зі значеннями on/off", "zh-cn": "对具有开/关值的数据点使用布尔值代替字符串"},
|
|
27
|
+
"Circuit4Find": { "en": "Circuit in which parameters are searched ", "de": "Schaltung, in der nach Parametern gesucht wird", "ru": "Цепь, в которой ищутся параметры", "pt": "Circuito no qual se pesquisam parâmetros", "nl": "Circuit waarin parameters worden gezocht", "fr": "Circuit dans lequel les paramètres sont recherchés", "it": "Circuito in cui vengono cercati i parametri", "es": "Circuito en el que se buscan parámetros", "pl": "Obwód, w którym szukane są parametry", "uk": "Схема, в якій здійснюється пошук параметрів", "zh-cn": "搜索参数的电路"},
|
|
28
|
+
"active": { "en": "active", "de": "aktiv", "ru": "активный", "pt": "ativo", "nl": "actief", "fr": "actif", "it": "attivo", "es": "activo", "pl": "aktywny", "uk": "активний", "zh-cn": "积极的"},
|
|
27
29
|
};
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "ebus",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.2.0": {
|
|
7
|
+
"en": "Attention: polled variables must be set to active \n\r search for available variables added",
|
|
8
|
+
"de": "Achtung: Gepollte Variablen müssen auf aktiv gesetzt werden\n\r Suche nach verfügbaren Variablen hinzugefügt",
|
|
9
|
+
"ru": "Внимание: опрашиваемые переменные должны быть активны\n\r добавлен поиск доступных переменных",
|
|
10
|
+
"pt": "Atenção: as variáveis pesquisadas devem ser definidas como ativas\n\r busca por variáveis disponíveis adicionadas",
|
|
11
|
+
"nl": "Let op: polled variabelen moeten op actief staan\n\r zoeken naar beschikbare variabelen toegevoegd",
|
|
12
|
+
"fr": "Attention : les variables interrogées doivent être définies sur actives\n\r rechercher les variables disponibles ajoutées",
|
|
13
|
+
"it": "Attenzione: le variabili interrogate devono essere impostate come attive\n\r cerca le variabili disponibili aggiunte",
|
|
14
|
+
"es": "Atención: las variables encuestadas deben configurarse como activas\n\r búsqueda de variables disponibles añadidas",
|
|
15
|
+
"pl": "Uwaga: zmienne odpytywane muszą być ustawione jako aktywne\n\r dodano wyszukiwanie dostępnych zmiennych",
|
|
16
|
+
"uk": "Увага: опитувані змінні мають бути активними\n\r додано пошук доступних змінних",
|
|
17
|
+
"zh-cn": "注意:轮询的变量必须设置为活动的\n\r 搜索添加的可用变量"
|
|
18
|
+
},
|
|
6
19
|
"3.1.1": {
|
|
7
20
|
"en": "wait for all commands before update of data",
|
|
8
21
|
"de": "Warten Sie auf alle Befehle, bevor Sie die Daten aktualisieren",
|
|
@@ -60,7 +73,7 @@
|
|
|
60
73
|
"mode": "daemon",
|
|
61
74
|
"icon": "ebus.png",
|
|
62
75
|
"enabled": true,
|
|
63
|
-
"messagebox":
|
|
76
|
+
"messagebox": true,
|
|
64
77
|
"extIcon": "https://raw.githubusercontent.com/rg-engineering/ioBroker.ebus/master/admin/ebus.png",
|
|
65
78
|
"keywords": [
|
|
66
79
|
"ebus"
|
package/main.js
CHANGED
|
@@ -53,12 +53,29 @@ function startAdapter(options) {
|
|
|
53
53
|
callback();
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
stateChange: async (id, state) => {
|
|
58
58
|
await HandleStateChange(id, state);
|
|
59
59
|
},
|
|
60
60
|
//#######################################
|
|
61
61
|
//
|
|
62
|
+
message: async (obj) => {
|
|
63
|
+
if (obj) {
|
|
64
|
+
switch (obj.command) {
|
|
65
|
+
case "findParams":
|
|
66
|
+
// e.g. send email or pushover or whatever
|
|
67
|
+
adapter.log.debug("findParams command");
|
|
68
|
+
// Send response in callback if required
|
|
69
|
+
await FindParams(obj);
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
adapter.log.error("unknown message " + obj.command);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#######################################
|
|
78
|
+
//
|
|
62
79
|
});
|
|
63
80
|
adapter = new utils.Adapter(options);
|
|
64
81
|
|
|
@@ -82,7 +99,7 @@ async function main() {
|
|
|
82
99
|
|
|
83
100
|
await checkVariables();
|
|
84
101
|
|
|
85
|
-
subscribeVars();
|
|
102
|
+
await subscribeVars();
|
|
86
103
|
|
|
87
104
|
let readInterval = 5;
|
|
88
105
|
if (parseInt(adapter.config.readInterval) > 0) {
|
|
@@ -139,6 +156,10 @@ async function HandleStateChange(id, state) {
|
|
|
139
156
|
//see issue #77: only one request possible
|
|
140
157
|
//await Do();
|
|
141
158
|
}
|
|
159
|
+
//unhandled state change ebus.0.find
|
|
160
|
+
else if (ids[2] === "find") {
|
|
161
|
+
await ebusd_find();
|
|
162
|
+
}
|
|
142
163
|
else {
|
|
143
164
|
adapter.log.warn("unhandled state change " + id);
|
|
144
165
|
}
|
|
@@ -174,7 +195,14 @@ function FillPolledVars() {
|
|
|
174
195
|
|
|
175
196
|
if (typeof adapter.config.PolledDPs !== 'undefined' && adapter.config.PolledDPs != null && adapter.config.PolledDPs.length > 0) {
|
|
176
197
|
adapter.log.debug("use new object list for polled vars");
|
|
177
|
-
|
|
198
|
+
|
|
199
|
+
//2023-02-10 only active vars
|
|
200
|
+
for (let i = 0; i < adapter.config.PolledDPs.length; i++) {
|
|
201
|
+
if (adapter.config.PolledDPs[i].active) {
|
|
202
|
+
oPolledVars.push(adapter.config.PolledDPs[i]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
178
206
|
}
|
|
179
207
|
else {
|
|
180
208
|
//make it compatible to old versions
|
|
@@ -185,7 +213,7 @@ function FillPolledVars() {
|
|
|
185
213
|
|
|
186
214
|
for (let i = 0; i < oPolled.length; i++) {
|
|
187
215
|
if (oPolled[i].length > 0) {
|
|
188
|
-
console.log('add ' + oPolled[i]);
|
|
216
|
+
//console.log('add ' + oPolled[i]);
|
|
189
217
|
const value = {
|
|
190
218
|
circuit: "",
|
|
191
219
|
name: oPolled[i],
|
|
@@ -196,6 +224,9 @@ function FillPolledVars() {
|
|
|
196
224
|
}
|
|
197
225
|
}
|
|
198
226
|
}
|
|
227
|
+
|
|
228
|
+
adapter.log.info("list of polled vars " + JSON.stringify(oPolledVars));
|
|
229
|
+
|
|
199
230
|
}
|
|
200
231
|
|
|
201
232
|
let oHistoryVars = [];
|
|
@@ -297,11 +328,69 @@ async function ebusd_Command() {
|
|
|
297
328
|
}
|
|
298
329
|
}
|
|
299
330
|
|
|
331
|
+
async function ebusd_find(){
|
|
332
|
+
try {
|
|
333
|
+
const socket = new net.Socket();
|
|
334
|
+
const promiseSocket = new PromiseSocket(socket);
|
|
335
|
+
|
|
336
|
+
await promiseSocket.connect(parseInt(adapter.config.targetTelnetPort), adapter.config.targetIP);
|
|
337
|
+
adapter.log.debug("telnet connected for cmd");
|
|
338
|
+
promiseSocket.setTimeout(5000);
|
|
339
|
+
|
|
340
|
+
await promiseSocket.write("find -F circuit,name,comment\n");
|
|
341
|
+
|
|
342
|
+
const data = await promiseSocket.read();
|
|
343
|
+
|
|
344
|
+
if (data.includes("ERR")) {
|
|
345
|
+
adapter.log.warn("received error! sent find, received " + data + " please check ebusd logs for details!");
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
adapter.log.debug("received " + typeof data + " " + data);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
let str = new TextDecoder().decode(data);
|
|
352
|
+
let datas = str.split(/\r?\n/)
|
|
353
|
+
|
|
354
|
+
for (let i = 0; i < datas.length; i++) {
|
|
355
|
+
|
|
356
|
+
//adapter.log.debug(JSON.stringify(datas[i]));
|
|
357
|
+
|
|
358
|
+
let names = datas[i].split(",");
|
|
359
|
+
|
|
360
|
+
//circuit,name,comment
|
|
361
|
+
await UpdateDP(names[0], names[1], names[2]);
|
|
362
|
+
|
|
363
|
+
let cmd = "read -f -c " + names[0] + " " + names[1] ;
|
|
364
|
+
|
|
365
|
+
adapter.log.debug("send cmd " + cmd);
|
|
366
|
+
|
|
367
|
+
cmd += "\n";
|
|
368
|
+
await promiseSocket.write(cmd);
|
|
369
|
+
|
|
370
|
+
const result = await promiseSocket.read();
|
|
371
|
+
|
|
372
|
+
adapter.log.debug("received " + typeof result + " " + result);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
promiseSocket.destroy();
|
|
377
|
+
|
|
378
|
+
} catch (e) {
|
|
379
|
+
adapter.log.error("exception from tcp socket in ebusd_find" + "[" + e + "]");
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
300
385
|
|
|
301
386
|
//just call http://192.168.0.123:8889/data
|
|
302
387
|
|
|
303
|
-
function subscribeVars() {
|
|
388
|
+
async function subscribeVars() {
|
|
304
389
|
adapter.subscribeStates("cmd");
|
|
390
|
+
|
|
391
|
+
adapter.subscribeStates("find");
|
|
392
|
+
|
|
393
|
+
await adapter.setStateAsync("cmdResult", { ack: true, val: "" });
|
|
305
394
|
}
|
|
306
395
|
|
|
307
396
|
async function CreateObject(key, obj) {
|
|
@@ -338,6 +427,50 @@ async function CreateObject(key, obj) {
|
|
|
338
427
|
}
|
|
339
428
|
|
|
340
429
|
|
|
430
|
+
//circuit,name,comment
|
|
431
|
+
async function UpdateDP(circuit, name, comment) {
|
|
432
|
+
|
|
433
|
+
let key = circuit + ".messages." + name;
|
|
434
|
+
adapter.log.debug("update check for " + key);
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
// ehp.messages.Injection
|
|
438
|
+
//ebus.0.ehp.messages.Injection
|
|
439
|
+
|
|
440
|
+
const obj = await adapter.getObjectAsync(key);
|
|
441
|
+
adapter.log.debug("update check got " + JSON.stringify(obj));
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
//update check got null
|
|
445
|
+
|
|
446
|
+
if (obj != null) {
|
|
447
|
+
|
|
448
|
+
if (obj.common.name != comment) {
|
|
449
|
+
adapter.log.debug("update " + key + " " + comment);
|
|
450
|
+
await adapter.extendObject(key, {
|
|
451
|
+
common: {
|
|
452
|
+
name: comment,
|
|
453
|
+
read: true,
|
|
454
|
+
write: false
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
await adapter.setObjectNotExistsAsync(key, {
|
|
461
|
+
type: "channel",
|
|
462
|
+
common: {
|
|
463
|
+
name: comment,
|
|
464
|
+
read: true,
|
|
465
|
+
write: false
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
341
474
|
async function checkVariables() {
|
|
342
475
|
adapter.log.debug("init variables ");
|
|
343
476
|
|
|
@@ -370,6 +503,21 @@ async function checkVariables() {
|
|
|
370
503
|
};
|
|
371
504
|
await CreateObject(key, obj);
|
|
372
505
|
|
|
506
|
+
key = "find";
|
|
507
|
+
obj = {
|
|
508
|
+
type: "state",
|
|
509
|
+
common: {
|
|
510
|
+
name: "find existing data points",
|
|
511
|
+
type: "boolean",
|
|
512
|
+
role: "button",
|
|
513
|
+
read: false,
|
|
514
|
+
write: true
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
await CreateObject(key, obj);
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
373
521
|
adapter.log.debug("init common variables and " + oHistoryVars.length + " history DP's");
|
|
374
522
|
|
|
375
523
|
if (oHistoryVars.length > 0) {
|
|
@@ -406,7 +554,7 @@ async function checkVariables() {
|
|
|
406
554
|
obj= {
|
|
407
555
|
type: "state",
|
|
408
556
|
common: {
|
|
409
|
-
name: "ebus history date as JSON",
|
|
557
|
+
name: "ebus history date / time as JSON",
|
|
410
558
|
type: "string",
|
|
411
559
|
role: "value",
|
|
412
560
|
unit: "",
|
|
@@ -1005,6 +1153,77 @@ async function ebusd_ReadValues() {
|
|
|
1005
1153
|
}
|
|
1006
1154
|
|
|
1007
1155
|
|
|
1156
|
+
async function FindParams(obj) {
|
|
1157
|
+
|
|
1158
|
+
adapter.log.debug("FindParams " + JSON.stringify(obj));
|
|
1159
|
+
|
|
1160
|
+
let list = [];
|
|
1161
|
+
|
|
1162
|
+
try {
|
|
1163
|
+
let circuit = obj.message;
|
|
1164
|
+
|
|
1165
|
+
const socket = new net.Socket();
|
|
1166
|
+
const promiseSocket = new PromiseSocket(socket);
|
|
1167
|
+
|
|
1168
|
+
await promiseSocket.connect(parseInt(adapter.config.targetTelnetPort), adapter.config.targetIP);
|
|
1169
|
+
adapter.log.debug("telnet connected for cmd");
|
|
1170
|
+
promiseSocket.setTimeout(5000);
|
|
1171
|
+
|
|
1172
|
+
await promiseSocket.write("find -c " + circuit + " -F circuit,name\n");
|
|
1173
|
+
|
|
1174
|
+
const data = await promiseSocket.read();
|
|
1175
|
+
|
|
1176
|
+
if (data.includes("ERR")) {
|
|
1177
|
+
adapter.log.warn("received error! sent find, received " + data + " please check ebusd logs for details!");
|
|
1178
|
+
}
|
|
1179
|
+
else {
|
|
1180
|
+
adapter.log.debug("received " + typeof data + " " + data);
|
|
1181
|
+
}
|
|
1182
|
+
/*
|
|
1183
|
+
received object ehp,AccelerationTestModeehp,AccelerationTestModeehp,ActualEnvironmentPowerehp,ActualEnvironmentPowerehp,ActualEnvironmentPowerPercentageehp,ActualEnvironmentPowerPercentageehp,ApplianceCodeehp,ApplianceCodeehp,Backupehp,Backupehp,BackupHoursehp,BackupHoursHcehp,BackupHoursHwcehp,BackupHysteresisehp,BackupIntegralehp,BackupModeHcehp,BackupModeHwcehp,BackupPowerCutehp,BackupStartsehp,BackupStartsHcehp,BackupStartsHwcehp,BackupTypeehp,BivalentTempehp,Bleedingehp,Bleedingehp,CirPumpehp,CirPumpehp,Code1ehp,Code1Code2Validehp,Code2ehp,Compehp,Compehp,CompControlStateehp,CompCutPressHighCountehp,CompCutPressLowCountehp,CompCutTempCountehp,CompDemandehp,CompHoursehp,CompHoursHcehp,CompHoursHwcehp,CompHysteresisehp,CompIntegralehp,CompPressHighehp,CompPressHighehp,CompPressLowehp,CompPressLowehp,CompStartsehp,CompStartsHcehp,CompStartsHwcehp,CompStateehp,CondensorTempehp,CondensorTempehp,currenterrorehp,Dateehp,DateTimeehp,DeltaTempT6T7ehp,ElectricWiringDiagramehp,ElectricWiringDiagramehp,EnergyBalancingReleaseehp,errorhistoryehp,FlowTempehp,FlowTempehp,FlowtempCoolingMinehp,FlowTempOffsetehp,Hc1Pumpehp,Hc1Pumpehp,Hc1PumpHoursehp,Hc1PumpPortehp,Hc1PumpStartsehp,Hc2Pumpehp,Hc2PumpHoursehp,HcFlowTempehp,HcFlowTempOffsetehp,HcModeDemandHoursehp,HcModeFulfilledHoursehp,HcParallelStorageFillingEnabledehp,HcPressehp,HcReturnTempehp,HcReturnTempehp,HcReturnTempOffsetehp,HeatPumpStatusehp,HeatPumpStatusehp,HeatpumpTypeehp,HwcHcValveehp,HwcHcValveehp,HwcHcValveStartsehp,HwcLaggingTimeehp,HwcLoadingDelayehp,HwcModeDemandHoursehp,HwcModeFulfilledHoursehp,HwcPumpStartsehp,HwcSwitchehp,HwcTempehp,HwcTempehp,HwcTempOffsetehp,HydraulicSchemeehp,ICLOutehp,ICLOutehp,Injectionehp,Integralehp,Mixer1DutyCycleehp,NumberCompStartsehp,OutsideTempehp,OutsideTempOffsetehp,OverpressureThresholdehp,PhaseOrderehp,PhaseOrderehp,PhaseStatusehp,PhaseStatusehp,PowerCutehp,PowerCutPreloadingehp,PressSwitchehp,PressSwitchehp,RebootCounterehp,ReturnTempMaxehp,SetModeehp,SoftwareCodeehp,Source2PumpHoursehp,Sourceehp,Sourceehp,SourceHoursehp,SourcePortehp,SourcePressehp,SourcePumpPrerunTimeehp,SourceStartsehp,SourceSwitchehp,SourceSwitchehp,SourceTempInputehp,SourceTempInputehp,SourceTempInputOffsetehp,SourceTempOutputehp,SourceTempOutputehp,SourceTempOutputOffsetehp,SourceTempOutputT8Minehp,StateSoftwareCodeehp,StateSoftwareCodeehp,Status01ehp,Status02ehp,Status16ehp,Statusehp,StatusCirPumpehp,StorageTempBottomehp,StorageTempBottomehp,StorageTempBottomOffsetehp,StorageTempTopehp,StorageTempTopehp,StorageTempTopOffsetehp,Subcoolingehp,Superheatehp,T19MaxToCompOffehp,TempInputehp,TempInputehp,TempInputOffsetehp,TempOutputehp,TempOutputehp,TempOutputOffsetehp,Timeehp,TimeBetweenTwoCompStartsMinehp,TimeCompOffMinehp,TimeCompOnMinehp,TimeOfNextPredictedPowerCutehp,TimeOfNextPredictedPowerCutehp,Weekdayehp,YieldTotalehp,YieldTotal
|
|
1184
|
+
*/
|
|
1185
|
+
let str = new TextDecoder().decode(data);
|
|
1186
|
+
let datas = str.split(/\r?\n/)
|
|
1187
|
+
|
|
1188
|
+
for (let i = 0; i < datas.length; i++) {
|
|
1189
|
+
|
|
1190
|
+
//adapter.log.debug(JSON.stringify(datas[i]));
|
|
1191
|
+
|
|
1192
|
+
let names = datas[i].split(",");
|
|
1193
|
+
|
|
1194
|
+
//doppelte und leere herausfiltern
|
|
1195
|
+
let add = true;
|
|
1196
|
+
|
|
1197
|
+
if (names[0] == "" || names[1] == "") {
|
|
1198
|
+
add = false;
|
|
1199
|
+
}
|
|
1200
|
+
else {
|
|
1201
|
+
|
|
1202
|
+
for (let n = 0; n < list.length; n++) {
|
|
1203
|
+
|
|
1204
|
+
if (list[n].circuit == names[0] && list[n].name == names[1]) {
|
|
1205
|
+
add = false;
|
|
1206
|
+
//already in list
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
if (add) {
|
|
1212
|
+
let entry = {
|
|
1213
|
+
active: false,
|
|
1214
|
+
circuit: names[0],
|
|
1215
|
+
name: names[1]
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
list.push(entry);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
} catch (e) {
|
|
1222
|
+
adapter.log.error("exception in FindParams " + "[" + e + "]");
|
|
1223
|
+
}
|
|
1224
|
+
adapter.sendTo(obj.from, obj.command, list, obj.callback);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1008
1227
|
// If started as allInOne/compact mode => return function to create instance
|
|
1009
1228
|
if (module && module.parent) {
|
|
1010
1229
|
module.exports = startAdapter;
|