iobroker.ebus 3.0.2 → 3.0.3

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/LICENSE CHANGED
@@ -1,7 +1,21 @@
1
- Copyright (C) <2017 - 2022> <info@rg-engineering.eu>
1
+ MIT License
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Copyright (c) 2017-2022 rg-engineering <info@rg-engineering.eu>
4
4
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -55,6 +55,13 @@ Attention: command in datapoint ebus.0.cmd is deleted after executing of command
55
55
 
56
56
  ## Changelog
57
57
 
58
+ ### 3.0.3 (2022-08-18)
59
+ * (René) tooltip in wizard added
60
+ * (René) flot and dependencies updated
61
+ * (René) errors from ebusd are shown as warning here in adapter, details schould be checked in logs of ebusd
62
+ * (René) bug fix in widget: if less data available x axes grid point were not shown
63
+ * (René) except null as valid value from ebusd (e.g. to reset CurrentError)
64
+
58
65
  ### 3.0.2 (2022-04-02)
59
66
  * (René) message for installation added
60
67
 
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "ebus",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "news": {
6
+ "3.0.3": {
7
+ "en": "widget with tooltip",
8
+ "de": "Widget mit Tooltip",
9
+ "ru": "виджет с подсказкой",
10
+ "pt": "widget com dica de ferramenta",
11
+ "nl": "widget met knopinfo",
12
+ "fr": "widget avec info-bulle",
13
+ "it": "widget con descrizione comando",
14
+ "es": "widget con información sobre herramientas",
15
+ "pl": "widżet z podpowiedź",
16
+ "zh-cn": "带有工具提示的小部件"
17
+ },
6
18
  "3.0.2": {
7
19
  "en": "message installation hint added",
8
20
  "de": "Nachricht Installationshinweis hinzugefügt",
package/main.js CHANGED
@@ -48,10 +48,12 @@ function startAdapter(options) {
48
48
  },
49
49
  //#######################################
50
50
  //
51
- SIGINT: function () {
52
- adapter && adapter.log && adapter.log.info && adapter.log.info("cleaned everything up...");
53
- CronStop();
54
- },
51
+ //SIGINT: function () {
52
+ // clearInterval(intervalID);
53
+ // intervalID = null;
54
+ // adapter && adapter.log && adapter.log.info && adapter.log.info("cleaned everything up...");
55
+ // CronStop();
56
+ //},
55
57
  //#######################################
56
58
  // is called if a subscribed object changes
57
59
  //objectChange: function (id, obj) {
@@ -259,7 +261,7 @@ async function ebusd_Command() {
259
261
  const data = await promiseSocket.read();
260
262
 
261
263
  if (data.includes("ERR")) {
262
- adapter.log.error("sent " + oCmds[n] + ", received " + data);
264
+ adapter.log.warn("sent " + oCmds[n] + ", received " + data + " please check ebusd logs for details!";
263
265
  }
264
266
  else {
265
267
  adapter.log.debug("received " + data);
@@ -295,6 +297,39 @@ function subscribeVars() {
295
297
  adapter.subscribeStates("cmd");
296
298
  }
297
299
 
300
+ async function CreateObject(key, obj) {
301
+
302
+ const obj_new = await adapter.getObjectAsync(key);
303
+ //adapter.log.warn("got object " + JSON.stringify(obj_new));
304
+
305
+ if (obj_new != null) {
306
+
307
+ if ((obj_new.common.role != obj.common.role
308
+ || obj_new.common.type != obj.common.type
309
+ || (obj_new.common.unit != obj.common.unit && obj.common.unit != null)
310
+ || obj_new.common.read != obj.common.read
311
+ || obj_new.common.write != obj.common.write
312
+ || obj_new.common.name != obj.common.name)
313
+ && obj.type === "state"
314
+ ) {
315
+ adapter.log.warn("change object " + JSON.stringify(obj) + " " + JSON.stringify(obj_new));
316
+ await adapter.extendObject(key, {
317
+ common: {
318
+ name: obj.common.name,
319
+ role: obj.common.role,
320
+ type: obj.common.type,
321
+ unit: obj.common.unit,
322
+ read: obj.common.read,
323
+ write: obj.common.write
324
+ }
325
+ });
326
+ }
327
+ }
328
+ else {
329
+ await adapter.setObjectNotExistsAsync(key, obj);
330
+ }
331
+ }
332
+
298
333
 
299
334
  async function checkVariables() {
300
335
  adapter.log.debug("init variables ");
@@ -303,7 +338,7 @@ async function checkVariables() {
303
338
  let obj;
304
339
 
305
340
  key = "cmd";
306
- await adapter.setObjectNotExistsAsync(key, {
341
+ obj= {
307
342
  type: "state",
308
343
  common: {
309
344
  name: "ebusd command",
@@ -312,23 +347,11 @@ async function checkVariables() {
312
347
  read: true,
313
348
  write: true
314
349
  }
315
- });
316
-
317
- obj = await adapter.getObjectAsync(key);
318
-
319
- if (obj != null) {
320
-
321
- if (obj.common.role != "text") {
322
- await adapter.extendObject(key, {
323
- common: {
324
- role: "text",
325
- }
326
- });
327
- }
328
- }
350
+ };
351
+ await CreateObject(key, obj);
329
352
 
330
353
  key = "cmdResult";
331
- await adapter.setObjectNotExistsAsync(key, {
354
+ obj = {
332
355
  type: "state",
333
356
  common: {
334
357
  name: "ebusd command result",
@@ -337,25 +360,11 @@ async function checkVariables() {
337
360
  read: true,
338
361
  write: false
339
362
  }
340
- });
341
- obj = await adapter.getObjectAsync(key);
342
-
343
- if (obj != null) {
344
-
345
- if (obj.common.role != "text") {
346
- await adapter.extendObject(key, {
347
- common: {
348
- role: "text",
349
- }
350
- });
351
- }
352
- }
353
-
354
-
363
+ };
364
+ await CreateObject(key, obj);
355
365
 
356
366
  adapter.log.debug("init common variables and " + oHistoryVars.length + " history DP's");
357
367
 
358
-
359
368
  if (oHistoryVars.length > 0) {
360
369
 
361
370
  if (oHistoryVars.length > 4) {
@@ -367,7 +376,7 @@ async function checkVariables() {
367
376
  if (oHistoryVars[n - 1].name.length > 0) {
368
377
  const name = "history value " + n + " as JSON " + oHistoryVars[n - 1].name;
369
378
  key = "history.value" + n;
370
- await adapter.setObjectNotExistsAsync(key, {
379
+ obj= {
371
380
  type: "state",
372
381
  common: {
373
382
  name: name,
@@ -378,21 +387,8 @@ async function checkVariables() {
378
387
  write: false
379
388
  },
380
389
  native: { location: key }
381
- });
382
-
383
- obj = await adapter.getObjectAsync(key);
384
-
385
- if (obj != null) {
386
-
387
- if (obj.common.role != "value" || obj.common.name != name) {
388
- await adapter.extendObject(key, {
389
- common: {
390
- name: name,
391
- role: "value",
392
- }
393
- });
394
- }
395
- }
390
+ };
391
+ await CreateObject(key, obj);
396
392
  }
397
393
  else {
398
394
  adapter.log.warn("ignoring history value " + n + " (invalid name)");
@@ -400,42 +396,36 @@ async function checkVariables() {
400
396
  }
401
397
 
402
398
  key = "history.date";
403
- await adapter.setObjectNotExistsAsync(key, {
399
+ obj= {
404
400
  type: "state",
405
- common: { name: "ebus history date as JSON", type: "string", role: "value", unit: "", read: true, write: false },
406
- native: { location: key }
407
- });
408
- obj = await adapter.getObjectAsync(key);
409
-
410
- if (obj != null) {
411
-
412
- if (obj.common.role != "value") {
413
- await adapter.extendObject(key, {
414
- common: {
415
- role: "value",
416
- }
417
- });
401
+ common: {
402
+ name: "ebus history date as JSON",
403
+ type: "string",
404
+ role: "value",
405
+ unit: "",
406
+ read: true,
407
+ write: false
408
+ },
409
+ native: {
410
+ location: key
418
411
  }
419
- }
412
+ };
413
+ await CreateObject(key, obj);
420
414
  }
421
415
  key = "history.error";
422
- await adapter.setObjectNotExistsAsync(key, {
416
+ obj= {
423
417
  type: "state",
424
- common: { name: "ebus error", type: "string", role: "value", unit: "", read: true, write: false },
418
+ common: {
419
+ name: "ebus error",
420
+ type: "string",
421
+ role: "value",
422
+ unit: "",
423
+ read: true,
424
+ write: false
425
+ },
425
426
  native: { location: key }
426
- });
427
- obj = await adapter.getObjectAsync(key);
428
-
429
- if (obj != null) {
430
-
431
- if (obj.common.role != "value") {
432
- await adapter.extendObject(key, {
433
- common: {
434
- role: "value",
435
- }
436
- });
437
- }
438
- }
427
+ };
428
+ await CreateObject(key, obj);
439
429
  }
440
430
 
441
431
 
@@ -534,7 +524,7 @@ async function ebusd_ReceiveData() {
534
524
  //adapter.log.info("in version, value " + value);
535
525
  const versionInfo = value.split('.');
536
526
  if (versionInfo.length > 1) {
537
- adapter.log.info("found ebusd version " + versionInfo[0] + "." + versionInfo[1]);
527
+ adapter.log.info("installed ebusd version is " + versionInfo[0] + "." + versionInfo[1]);
538
528
 
539
529
  ebusdVersion[0] = versionInfo[0];
540
530
  ebusdVersion[1] = versionInfo[1];
@@ -578,11 +568,17 @@ async function ebusd_ReceiveData() {
578
568
 
579
569
 
580
570
  if (name === "hcmode2") {
581
- adapter.log.debug("in hcmode2, value " + value);
582
- if (parseInt(value) === 5) {
583
- adapter.log.info(key + " with value 5");
571
+ if (parseInt(value) === 0) {
572
+ adapter.log.info(key + "in hcmode2 with value 0: off");
573
+ value = "off";
574
+ }
575
+ else if (parseInt(value) === 5) {
576
+ adapter.log.info(key + " with value 5: EVU Sperrzeit");
584
577
  value = "EVU Sperrzeit";
585
578
  }
579
+ else {
580
+ adapter.log.debug("in hcmode2, value " + value);
581
+ }
586
582
  }
587
583
 
588
584
  let type = typeof value;
@@ -894,12 +890,15 @@ async function AddObject(key, type) {
894
890
 
895
891
  async function UpdateObject(key, value) {
896
892
  try {
897
- if (value == null || value == undefined) {
898
- adapter.log.debug("updateObject: not updated " + key + " value: " + value);
893
+ if (typeof value == undefined) {
894
+ adapter.log.warn("updateObject: not updated " + key + " value: " + value + " " + typeof value);
895
+ }
896
+ else if (value == null ) {
897
+ adapter.log.debug("updateObject: update to null " + key + " value: " + value);
898
+ await adapter.setStateAsync(key, { ack: true, val: null });
899
899
  }
900
900
  else {
901
901
  adapter.log.debug("updateObject " + key + " : " + value);
902
-
903
902
  await adapter.setStateAsync(key, { ack: true, val: value });
904
903
  }
905
904
  } catch (e) {
@@ -963,7 +962,7 @@ async function ebusd_ReadValues() {
963
962
 
964
963
  //received ERR: arbitration lost for YieldThisYear
965
964
  if (data.includes("ERR")) {
966
- adapter.log.error("sent " + cmd + ", received " + data + " for " + JSON.stringify(oPolledVars[nCtr]));
965
+ adapter.log.warn("sent " + cmd + ", received " + data + " for " + JSON.stringify(oPolledVars[nCtr]) + " please check ebusd logs for details!");
967
966
 
968
967
  /*
969
968
  * sent read -f YieldLastYear, received ERR: arbitration lost for {"circuit":"","name":"YieldLastYear","parameter":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.ebus",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "ioBroker ebus Adapter",
5
5
  "author": {
6
6
  "name": "René G.",
@@ -21,31 +21,31 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@iobroker/adapter-core": "2.6.0",
24
- "@sentry/node": "6.19.3",
25
24
  "flat": "5.0.2",
26
25
  "net": "1.0.2",
27
26
  "promise-socket": "7.0.0",
28
- "cron": "1.8.2"
27
+ "cron": "2.1.0",
28
+ "axios": "0.27.2"
29
29
  },
30
30
  "devDependencies": {
31
- "@iobroker/testing": "2.5.6",
32
- "@types/chai": "4.3.0",
31
+ "@iobroker/testing": "3.0.2",
32
+ "@types/chai": "4.3.3",
33
33
  "@types/chai-as-promised": "7.1.5",
34
34
  "@types/gulp": "4.0.9",
35
- "@types/mocha": "9.1.0",
36
- "@types/node": "17.0.23",
35
+ "@types/mocha": "9.1.1",
36
+ "@types/node": "18.7.3",
37
37
  "@types/proxyquire": "1.3.28",
38
38
  "@types/request-promise-native": "1.0.18",
39
- "@types/sinon": "10.0.11",
39
+ "@types/sinon": "10.0.13",
40
40
  "@types/sinon-chai": "3.2.8",
41
- "axios": "0.26.1",
41
+ "axios": "0.27.2",
42
42
  "chai": "4.3.6",
43
43
  "chai-as-promised": "7.1.1",
44
- "eslint": "8.12.0",
44
+ "eslint": "8.22.0",
45
45
  "gulp": "4.0.2",
46
- "mocha": "9.2.2",
46
+ "mocha": "10.0.0",
47
47
  "proxyquire": "2.1.3",
48
- "sinon": "13.0.1",
48
+ "sinon": "14.0.0",
49
49
  "sinon-chai": "3.7.0"
50
50
  },
51
51
  "main": "main.js",
@@ -372,8 +372,6 @@ don't work unless the canvas is attached to the DOM.
372
372
 
373
373
  // Tweak the div's position to match the text's alignment
374
374
 
375
- console.log('add text ' + text);
376
-
377
375
  if (halign === 'center') {
378
376
  x -= info.width / 2;
379
377
  } else if (halign === 'right') {
@@ -144,10 +144,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
144
144
  };
145
145
 
146
146
  function init(plot) {
147
- plot.hooks.processOptions.push(function (plot, options) {
148
-
149
- console.log('??????? ');
150
-
147
+ plot.hooks.processOptions.push(function(plot, options) {
151
148
  if (!options.axisLabels.show) {
152
149
  return;
153
150
  }
@@ -45,6 +45,8 @@ the tooltip from webcharts).
45
45
  var lastMouseMoveEvent;
46
46
  var highlights = [];
47
47
 
48
+ console.log("hover init");
49
+
48
50
  function bindEvents(plot, eventHolder) {
49
51
  var o = plot.getOptions();
50
52
 
@@ -99,6 +99,8 @@ Licensed under the MIT license.
99
99
  // where series is either just the data as [ [x1, y1], [x2, y2], ... ]
100
100
  // or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }
101
101
 
102
+ console.log("xxx Plot started...");
103
+
102
104
  var series = [],
103
105
  options = {
104
106
  // the color theme used for graphs
@@ -380,6 +382,8 @@ Licensed under the MIT license.
380
382
  Canvas: Canvas
381
383
  };
382
384
 
385
+ console.log("init plugins " + plugins.length);
386
+
383
387
  for (var i = 0; i < plugins.length; ++i) {
384
388
  var p = plugins[i];
385
389
  p.init(plot, classes);
@@ -1520,7 +1524,7 @@ Licensed under the MIT license.
1520
1524
  var magn = parseFloat('1e' + (-dec)),
1521
1525
  norm = delta / magn;
1522
1526
 
1523
- if (norm > 2.25 && norm < 3 && (dec + 1) <= tickDecimals) {
1527
+ if (norm > 2.25 && norm < 3 && (tickDecimals == null || (dec + 1) <= tickDecimals)) {
1524
1528
  //we need an extra decimals when tickSize is 2.5
1525
1529
  ++dec;
1526
1530
  }
@@ -1777,37 +1781,35 @@ Licensed under the MIT license.
1777
1781
  surface.clear();
1778
1782
  executeHooks(hooks.drawBackground, [ctx]);
1779
1783
 
1780
-
1781
1784
  var grid = options.grid;
1782
-
1785
+
1783
1786
  // draw background, if any
1784
1787
  if (grid.show && grid.backgroundColor) {
1785
1788
  drawBackground();
1786
1789
  }
1787
-
1790
+
1788
1791
  if (grid.show && !grid.aboveData) {
1789
1792
  drawGrid();
1790
1793
  }
1791
-
1794
+
1792
1795
  for (var i = 0; i < series.length; ++i) {
1793
1796
  executeHooks(hooks.drawSeries, [ctx, series[i], i, getColorOrGradient]);
1794
1797
  drawSeries(series[i]);
1795
1798
  }
1796
-
1799
+
1797
1800
  executeHooks(hooks.draw, [ctx]);
1798
-
1801
+
1799
1802
  if (grid.show && grid.aboveData) {
1800
1803
  drawGrid();
1801
1804
  }
1802
-
1805
+
1803
1806
  surface.render();
1804
-
1807
+
1805
1808
  // A draw implies that either the axes or data have changed, so we
1806
1809
  // should probably update the overlay highlights as well.
1807
1810
  triggerRedrawOverlay();
1808
-
1809
- ShowTickLabels();
1810
1811
 
1812
+ ShowTickLabels();
1811
1813
  }
1812
1814
 
1813
1815
  //*******************************************************************
@@ -2447,9 +2449,9 @@ Licensed under the MIT license.
2447
2449
  //*******************************************************************
2448
2450
  //labelBoxes.push(drawAxisLabel(axis.ticks[0], labelBoxes));
2449
2451
  //labelBoxes.push(drawAxisLabel(axis.ticks[axis.ticks.length - 1], labelBoxes));
2450
- for (i = 1; i < axis.ticks.length - 1; ++i) {
2451
- //labelBoxes.push(drawAxisLabel(axis.ticks[i], labelBoxes));
2452
- }
2452
+ //for (i = 1; i < axis.ticks.length - 1; ++i) {
2453
+ // labelBoxes.push(drawAxisLabel(axis.ticks[i], labelBoxes));
2454
+ //}
2453
2455
  break;
2454
2456
  case 'all':
2455
2457
  //*******************************************************************
@@ -2458,9 +2460,9 @@ Licensed under the MIT license.
2458
2460
  //*******************************************************************
2459
2461
  //labelBoxes.push(drawAxisLabel(axis.ticks[0], []));
2460
2462
  //labelBoxes.push(drawAxisLabel(axis.ticks[axis.ticks.length - 1], labelBoxes));
2461
- for (i = 1; i < axis.ticks.length - 1; ++i) {
2462
- //labelBoxes.push(drawAxisLabel(axis.ticks[i], labelBoxes));
2463
- }
2463
+ //for (i = 1; i < axis.ticks.length - 1; ++i) {
2464
+ // labelBoxes.push(drawAxisLabel(axis.ticks[i], labelBoxes));
2465
+ //}
2464
2466
  break;
2465
2467
  }
2466
2468
  });
@@ -31,11 +31,11 @@ API.txt for details.
31
31
 
32
32
  var oldSetTime = newDate.setTime.bind(newDate);
33
33
  newDate.update = function(microEpoch) {
34
- oldSetTime(microEpoch);
35
-
36
34
  // Round epoch to 3 decimal accuracy
37
35
  microEpoch = Math.round(microEpoch * 1000) / 1000;
38
36
 
37
+ oldSetTime(microEpoch);
38
+
39
39
  // Microseconds are stored as integers
40
40
  this.microseconds = 1000 * (microEpoch - Math.floor(microEpoch));
41
41
  };
@@ -395,11 +395,10 @@ API.txt for details.
395
395
  // reset smaller components
396
396
 
397
397
  if (step >= timeUnitSize.millisecond) {
398
- if (step >= timeUnitSize.second) {
399
- d.setMicroseconds(0);
400
- } else {
401
- d.setMicroseconds(d.getMilliseconds() * 1000);
402
- }
398
+ d.setMicroseconds(0);
399
+ }
400
+ if (step >= timeUnitSize.second) {
401
+ d.setMilliseconds(0);
403
402
  }
404
403
  if (step >= timeUnitSize.minute) {
405
404
  d.setSeconds(0);
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Globalize Culture en-US
3
+ *
4
+ * http://github.com/jquery/globalize
5
+ *
6
+ * Copyright Software Freedom Conservancy, Inc.
7
+ * Dual licensed under the MIT or GPL Version 2 licenses.
8
+ * http://jquery.org/license
9
+ *
10
+ * This file was generated by the Globalize Culture Generator
11
+ * Translation: bugs found in this file need to be fixed in the generator
12
+ */
13
+
14
+ (function( window, undefined ) {
15
+
16
+ var Globalize;
17
+
18
+ if ( typeof require !== "undefined" &&
19
+ typeof exports !== "undefined" &&
20
+ typeof module !== "undefined" ) {
21
+ // Assume CommonJS
22
+ Globalize = require( "globalize" );
23
+ } else {
24
+ // Global variable
25
+ Globalize = window.Globalize;
26
+ }
27
+
28
+ Globalize.addCultureInfo( "en-US", "default", {
29
+ name: "en-US",
30
+ englishName: "English (United States)"
31
+ });
32
+
33
+ }( this ));