iobroker.sbfspot 4.1.0 → 4.1.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/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
@@ -51,8 +51,9 @@ sometimes npm intall must be called more then one time to successfully install a
51
51
 
52
52
  ## Changelog
53
53
 
54
- ### 4.1.0 (2022-04-21)
55
- * (René) add datapoint to show when data uploaded to sbfspot
54
+ ### 4.1.1 (2022-08-18)
55
+ * (René) tooltip in wizard added
56
+ * (René) flot and dependencies updated
56
57
 
57
58
  ### 4.0.8 (2021-07-11)
58
59
  * (René) bug fix color of labels in widget
package/io-package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sbfspot",
4
- "version": "4.1.0",
4
+ "version": "4.1.1",
5
5
  "news": {
6
- "4.1.0": {
7
- "en": "add datapoint to show when data uploaded to sbfspot",
8
- "de": "Datenpunkt hinzufügen, um anzuzeigen, wann Daten auf sbfspot hochgeladen wurden",
9
- "ru": "добавить точку данных, чтобы показать, когда данные загружаются в sbfspot",
10
- "pt": "adicionar ponto de dados para mostrar quando os dados são carregados no sbfspot",
11
- "nl": "voeg datapunt toe om te laten zien wanneer gegevens zijn geüpload naar sbfspot",
12
- "fr": "ajouter un point de données pour montrer quand les données sont téléchargées sur sbfspot",
13
- "it": "aggiungi datapoint per mostrare quando i dati sono stati caricati su sbfspot",
14
- "es": "agregue un punto de datos para mostrar cuándo se cargan los datos en sbfspot",
15
- "pl": "dodaj punkt danych, aby pokazać, kiedy dane zostały przesłane do sbfspot",
16
- "zh-cn": "添加数据点以显示何时将数据上传到 sbfspot"
6
+ "4.1.1": {
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
17
  },
18
18
  "4.0.8": {
19
19
  "en": "bug fix color of labels in widget",
package/main.js CHANGED
@@ -61,7 +61,7 @@ async function main() {
61
61
  adapter.terminate ? adapter.terminate(11) : process.exit(11);
62
62
  }
63
63
 
64
- await CheckInverterVariables();
64
+ //await CheckInverterVariables();
65
65
 
66
66
  killTimer = setTimeout(function () {
67
67
  //adapter.stop();
@@ -336,11 +336,45 @@ async function AddInverterVariables(serial) {
336
336
  }
337
337
 
338
338
 
339
+ async function CreateObject(key, obj) {
340
+
341
+ const obj_new = await adapter.getObjectAsync(key);
342
+ //adapter.log.warn("got object " + JSON.stringify(obj_new));
343
+
344
+ if (obj_new != null) {
345
+
346
+ if ((obj_new.common.role != obj.common.role
347
+ || obj_new.common.type != obj.common.type
348
+ || (obj_new.common.unit != obj.common.unit && obj.common.unit != null)
349
+ || obj_new.common.read != obj.common.read
350
+ || obj_new.common.write != obj.common.write
351
+ || obj_new.common.name != obj.common.name)
352
+ && obj.type === "state"
353
+ ) {
354
+ adapter.log.warn("change object " + JSON.stringify(obj) + " " + JSON.stringify(obj_new));
355
+ await adapter.extendObject(key, {
356
+ common: {
357
+ name: obj.common.name,
358
+ role: obj.common.role,
359
+ type: obj.common.type,
360
+ unit: obj.common.unit,
361
+ read: obj.common.read,
362
+ write: obj.common.write
363
+ }
364
+ });
365
+ }
366
+ }
367
+ else {
368
+ await adapter.setObjectNotExistsAsync(key, obj);
369
+ }
370
+ }
371
+
372
+
339
373
  async function AddObject(key, type, common_name, common_type, common_role, common_unit, common_read, common_write) {
340
374
 
341
375
  adapter.log.debug("addObject " + key);
342
376
 
343
- await adapter.setObjectNotExistsAsync(key, {
377
+ obj= {
344
378
  type: type,
345
379
  common: {
346
380
  name: common_name,
@@ -353,37 +387,9 @@ async function AddObject(key, type, common_name, common_type, common_role, commo
353
387
  native: {
354
388
  location: key
355
389
  }
356
- });
390
+ };
357
391
 
358
- const obj = await adapter.getObjectAsync(key);
359
-
360
- if (obj != null) {
361
- //adapter.log.debug(" got Object " + JSON.stringify(obj));
362
- if (obj.type != type
363
- || obj.common.name != common_name
364
- || obj.common.type != common_type
365
- || obj.common.role != common_role
366
- || obj.common.unit != common_unit
367
- || obj.common.read != common_read
368
- || obj.common.write != common_write ) {
369
- adapter.log.debug(" !!! need to extend for " + key);
370
- await adapter.extendObject(key, {
371
- type: type,
372
- common: {
373
- name: common_name,
374
- type: common_type,
375
- role: common_role,
376
- unit: common_unit,
377
- read: common_read,
378
- write: common_write
379
- },
380
- native: {
381
- location: key
382
- }
383
- });
384
- }
385
-
386
- }
392
+ await CreateObject(key, obj);
387
393
  }
388
394
 
389
395
 
@@ -394,11 +400,11 @@ sbfspot.0 2021-07-08 19:30:13.024 info State value to set for "sbfspot.0.2000562
394
400
  sbfspot.0 2021-07-08 19:30:12.888 info State value to set for "sbfspot.0.2000562095.history.last30Days" has to be type "number" but received type "string"
395
401
  */
396
402
 
397
-
403
+ /*
398
404
  async function CheckInverterVariables() {
399
405
 
400
406
  }
401
-
407
+ */
402
408
 
403
409
 
404
410
  async function DB_Connect() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sbfspot",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "sbfspot (SMA inverter) Adapter",
5
5
  "author": {
6
6
  "name": "René G.",
@@ -19,30 +19,29 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@iobroker/adapter-core": "2.6.0",
22
- "@sentry/node": "6.19.6",
23
- "better-sqlite3": "7.5.1",
22
+ "better-sqlite3": "7.6.2",
24
23
  "mysql2": "2.3.3",
25
24
  "suncalc2": "1.8.1"
26
25
  },
27
26
  "devDependencies": {
28
- "@iobroker/testing": "2.6.0",
29
- "@types/chai": "4.3.1",
27
+ "@iobroker/testing": "3.0.2",
28
+ "@types/chai": "4.3.3",
30
29
  "@types/chai-as-promised": "7.1.5",
31
30
  "@types/gulp": "4.0.9",
32
31
  "@types/mocha": "9.1.1",
33
- "@types/node": "17.0.25",
32
+ "@types/node": "18.7.3",
34
33
  "@types/proxyquire": "1.3.28",
35
34
  "@types/request-promise-native": "1.0.18",
36
- "@types/sinon": "10.0.11",
35
+ "@types/sinon": "10.0.13",
37
36
  "@types/sinon-chai": "3.2.8",
38
- "axios": "0.26.1",
37
+ "axios": "0.27.2",
39
38
  "chai": "4.3.6",
40
39
  "chai-as-promised": "7.1.1",
41
- "eslint": "8.13.0",
40
+ "eslint": "8.22.0",
42
41
  "gulp": "4.0.2",
43
- "mocha": "9.2.2",
42
+ "mocha": "10.0.0",
44
43
  "proxyquire": "2.1.3",
45
- "sinon": "13.0.2",
44
+ "sinon": "14.0.0",
46
45
  "sinon-chai": "3.7.0"
47
46
  },
48
47
  "main": "main.js",
package/sbfspot.njsproj CHANGED
@@ -70,8 +70,6 @@
70
70
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.canvaswrapper.js" />
71
71
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.colorhelpers.js" />
72
72
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.axislabels.js" />
73
- <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.axislabels_V2.js" />
74
- <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.axislabels_V3.js" />
75
73
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.browser.js" />
76
74
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.categories.js" />
77
75
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.composeImages.js" />
@@ -96,6 +94,10 @@
96
94
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.touchNavigate.js" />
97
95
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.flot.uiConstants.js" />
98
96
  <Content Include="widgets\sbfspot\lib\js\flot\jquery.js" />
97
+ <Content Include="widgets\sbfspot\lib\js\lib\globalize.culture.en-US.js" />
98
+ <Content Include="widgets\sbfspot\lib\js\lib\globalize.js" />
99
+ <Content Include="widgets\sbfspot\lib\js\lib\jquery.event.drag.js" />
100
+ <Content Include="widgets\sbfspot\lib\js\lib\jquery.mousewheel.js" />
99
101
  </ItemGroup>
100
102
  <ItemGroup>
101
103
  <Folder Include=".github\" />
@@ -128,6 +130,7 @@
128
130
  <Folder Include="widgets\sbfspot\lib\js\" />
129
131
  <Folder Include="widgets\sbfspot\lib\js\flot\" />
130
132
  <Folder Include="widgets\sbfspot\js\" />
133
+ <Folder Include="widgets\sbfspot\lib\js\lib\" />
131
134
  </ItemGroup>
132
135
  <ItemGroup>
133
136
  <TypeScriptCompile Include="typings\globals\node\index.d.ts" />
@@ -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 ));