iobroker.ebus 3.1.1 → 3.2.1
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 +8 -0
- package/admin/index_m.html +109 -39
- package/admin/words.js +2 -0
- package/io-package.json +28 -2
- package/main.js +232 -13
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -55,6 +55,14 @@ Attention: command in datapoint ebus.0.cmd is deleted after executing of command
|
|
|
55
55
|
|
|
56
56
|
## Changelog
|
|
57
57
|
|
|
58
|
+
### 3.2.1 (2023-04-07)
|
|
59
|
+
* (René) dependencies updated
|
|
60
|
+
|
|
61
|
+
### 3.2.0 (2023-02-11)
|
|
62
|
+
* (René) **Attention** polled variables must be set as active in admin now
|
|
63
|
+
* (René) search available variables per circuit added in admin
|
|
64
|
+
* (René) DP "find" added to force read of all existing datapoints (Attention: might take a while) and update name in data point tree
|
|
65
|
+
|
|
58
66
|
### 3.1.1 (2023-01-31)
|
|
59
67
|
* (René) support ebusd 23.1
|
|
60
68
|
* (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
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
systemDictionary = {
|
|
11
|
+
"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": "搜索参数的电路"},
|
|
12
|
+
"active": { "en": "active", "de": "aktiv", "ru": "активный", "pt": "ativo", "nl": "actief", "fr": "actif", "it": "attivo", "es": "activo", "pl": "aktywny", "uk": "активний", "zh-cn": "积极的"},
|
|
11
13
|
"addParameter": { "en": "additional parameter", "de": "zusätzliche Parameter", "ru": "дополнительный параметр", "pt": "parâmetro adicional", "nl": "extra parameter", "fr": "paramètre supplémentaire", "it": "parametro aggiuntivo", "es": "parámetro adicional", "pl": "dodatkowy parametr", "uk": "додатковий параметр", "zh-cn": "附加参数"},
|
|
12
14
|
"circuit": { "en": "circuit", "de": "Schaltkreis", "ru": "схема", "pt": "o circuito", "nl": "stroomkring", "fr": "circuit", "it": "circuito", "es": "circuito", "pl": "okrążenie", "uk": "схема", "zh-cn": "电路"},
|
|
13
15
|
"ebus_adapter_settings": { "en": "ebus adapter settings", "de": "ebus Adaptereinstellungen", "ru": "настройки адаптера ebus", "pt": "Configurações do adaptador ebus", "nl": "ebus-adapterinstellingen", "fr": "Paramètres de l'adaptateur ebus", "it": "impostazioni dell'adattatore ebus", "es": "configuración del adaptador ebus", "pl": "ustawienia adaptera ebus", "uk": "налаштування адаптера ebus", "zh-cn": "ebus适配器设置"},
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "ebus",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.2.1": {
|
|
7
|
+
"en": "dependencies updated",
|
|
8
|
+
"de": "Abhängigkeiten aktualisiert",
|
|
9
|
+
"ru": "зависимости обновлены",
|
|
10
|
+
"pt": "dependências atualizadas",
|
|
11
|
+
"nl": "afhankelijkheden bijgewerkt",
|
|
12
|
+
"fr": "dépendances mises à jour",
|
|
13
|
+
"it": "dipendenze aggiornate",
|
|
14
|
+
"es": "dependencias actualizadas",
|
|
15
|
+
"pl": "zaktualizowane zależności",
|
|
16
|
+
"uk": "залежності оновлено",
|
|
17
|
+
"zh-cn": "依赖更新"
|
|
18
|
+
},
|
|
19
|
+
"3.2.0": {
|
|
20
|
+
"en": "Attention: polled variables must be set to active \n\r search for available variables added",
|
|
21
|
+
"de": "Achtung: Gepollte Variablen müssen auf aktiv gesetzt werden\n\r Suche nach verfügbaren Variablen hinzugefügt",
|
|
22
|
+
"ru": "Внимание: опрашиваемые переменные должны быть активны\n\r добавлен поиск доступных переменных",
|
|
23
|
+
"pt": "Atenção: as variáveis pesquisadas devem ser definidas como ativas\n\r busca por variáveis disponíveis adicionadas",
|
|
24
|
+
"nl": "Let op: polled variabelen moeten op actief staan\n\r zoeken naar beschikbare variabelen toegevoegd",
|
|
25
|
+
"fr": "Attention : les variables interrogées doivent être définies sur actives\n\r rechercher les variables disponibles ajoutées",
|
|
26
|
+
"it": "Attenzione: le variabili interrogate devono essere impostate come attive\n\r cerca le variabili disponibili aggiunte",
|
|
27
|
+
"es": "Atención: las variables encuestadas deben configurarse como activas\n\r búsqueda de variables disponibles añadidas",
|
|
28
|
+
"pl": "Uwaga: zmienne odpytywane muszą być ustawione jako aktywne\n\r dodano wyszukiwanie dostępnych zmiennych",
|
|
29
|
+
"uk": "Увага: опитувані змінні мають бути активними\n\r додано пошук доступних змінних",
|
|
30
|
+
"zh-cn": "注意:轮询的变量必须设置为活动的\n\r 搜索添加的可用变量"
|
|
31
|
+
},
|
|
6
32
|
"3.1.1": {
|
|
7
33
|
"en": "wait for all commands before update of data",
|
|
8
34
|
"de": "Warten Sie auf alle Befehle, bevor Sie die Daten aktualisieren",
|
|
@@ -60,7 +86,7 @@
|
|
|
60
86
|
"mode": "daemon",
|
|
61
87
|
"icon": "ebus.png",
|
|
62
88
|
"enabled": true,
|
|
63
|
-
"messagebox":
|
|
89
|
+
"messagebox": true,
|
|
64
90
|
"extIcon": "https://raw.githubusercontent.com/rg-engineering/ioBroker.ebus/master/admin/ebus.png",
|
|
65
91
|
"keywords": [
|
|
66
92
|
"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
|
}
|
|
@@ -172,9 +193,16 @@ async function DataRequest() {
|
|
|
172
193
|
let oPolledVars = [];
|
|
173
194
|
function FillPolledVars() {
|
|
174
195
|
|
|
175
|
-
if (
|
|
196
|
+
if ( 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,12 +224,15 @@ 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 = [];
|
|
202
233
|
function FillHistoryVars() {
|
|
203
234
|
|
|
204
|
-
if (
|
|
235
|
+
if (adapter.config.HistoryDPs !== undefined && adapter.config.HistoryDPs != null && adapter.config.HistoryDPs.length > 0) {
|
|
205
236
|
adapter.log.debug("use new object list for history vars");
|
|
206
237
|
oHistoryVars = adapter.config.HistoryDPs;
|
|
207
238
|
}
|
|
@@ -237,7 +268,7 @@ function FillHistoryVars() {
|
|
|
237
268
|
async function ebusd_Command() {
|
|
238
269
|
const obj = await adapter.getStateAsync("cmd");
|
|
239
270
|
|
|
240
|
-
if (
|
|
271
|
+
if (obj !== undefined && obj != null) {
|
|
241
272
|
const cmds = obj.val;
|
|
242
273
|
if (cmds !== "") {
|
|
243
274
|
adapter.log.debug("got command(s): " + cmds);
|
|
@@ -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: "",
|
|
@@ -564,7 +712,7 @@ async function ebusd_ReceiveData() {
|
|
|
564
712
|
|
|
565
713
|
let value = newData[org_key];
|
|
566
714
|
|
|
567
|
-
if (value == null || value
|
|
715
|
+
if (value == null || value === undefined) {
|
|
568
716
|
adapter.log.debug('Key : ' + key + ', Value : ' + newData[org_key] + " name " + name);
|
|
569
717
|
}
|
|
570
718
|
|
|
@@ -719,7 +867,7 @@ async function UpdateHistory(values, dates) {
|
|
|
719
867
|
|
|
720
868
|
const obj = await adapter.getStateAsync("history.date");
|
|
721
869
|
|
|
722
|
-
if (
|
|
870
|
+
if (obj !== undefined && obj != null) {
|
|
723
871
|
try {
|
|
724
872
|
let oEbusDates = [];
|
|
725
873
|
//adapter.log.debug("before " + obj.val);
|
|
@@ -787,7 +935,7 @@ async function UpdateHistoryValues(values, ctr, curDateCtr) {
|
|
|
787
935
|
|
|
788
936
|
const obj = await adapter.getStateAsync("history.value" + ctr);
|
|
789
937
|
|
|
790
|
-
if (
|
|
938
|
+
if (obj !== undefined && obj != null) {
|
|
791
939
|
try {
|
|
792
940
|
let oEbusValues = [];
|
|
793
941
|
if (obj !== null) {
|
|
@@ -895,7 +1043,7 @@ async function AddObject(key, type) {
|
|
|
895
1043
|
|
|
896
1044
|
async function UpdateObject(key, value) {
|
|
897
1045
|
try {
|
|
898
|
-
if (
|
|
1046
|
+
if (value === undefined) {
|
|
899
1047
|
adapter.log.warn("updateObject: not updated " + key + " value: " + value + " " + typeof value);
|
|
900
1048
|
}
|
|
901
1049
|
else if (value == null ) {
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.ebus",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "ioBroker ebus Adapter",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "René G.",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"url": "https://github.com/rg-engineering/ioBroker.ebus"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@iobroker/adapter-core": "2.6.
|
|
23
|
+
"@iobroker/adapter-core": "2.6.8",
|
|
24
24
|
"flat": "5.0.2",
|
|
25
25
|
"net": "1.0.2",
|
|
26
26
|
"promise-socket": "7.0.0",
|
|
27
|
-
"cron": "2.
|
|
27
|
+
"cron": "2.3.0",
|
|
28
28
|
"axios": "0.27.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/chai-as-promised": "7.1.5",
|
|
35
35
|
"@types/gulp": "4.0.10",
|
|
36
36
|
"@types/mocha": "10.0.1",
|
|
37
|
-
"@types/node": "18.11
|
|
37
|
+
"@types/node": "18.15.11",
|
|
38
38
|
"@types/proxyquire": "1.3.28",
|
|
39
39
|
"@types/request-promise-native": "1.0.18",
|
|
40
40
|
"@types/sinon": "10.0.13",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"axios": "0.27.2",
|
|
43
43
|
"chai": "4.3.7",
|
|
44
44
|
"chai-as-promised": "7.1.1",
|
|
45
|
-
"eslint": "8.
|
|
45
|
+
"eslint": "8.37.0",
|
|
46
46
|
"gulp": "4.0.2",
|
|
47
47
|
"mocha": "10.2.0",
|
|
48
48
|
"proxyquire": "2.1.3",
|
|
49
|
-
"sinon": "15.0.
|
|
49
|
+
"sinon": "15.0.3",
|
|
50
50
|
"sinon-chai": "3.7.0"
|
|
51
51
|
},
|
|
52
52
|
"main": "main.js",
|