smart-nodes 0.3.36 → 0.4.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/CHANGELOG.md +62 -0
- package/README.md +35 -17
- package/central/central.html +27 -24
- package/central/central.js +84 -26
- package/central/locales/de-DE/central.html +10 -0
- package/central/locales/de-DE/central.json +14 -0
- package/central/locales/en-US/central.html +10 -0
- package/central/locales/en-US/central.json +14 -0
- package/compare/compare.html +64 -87
- package/compare/compare.js +69 -29
- package/compare/locales/de-DE/compare.html +36 -0
- package/compare/locales/de-DE/compare.json +35 -0
- package/compare/locales/en-US/compare.html +36 -0
- package/compare/locales/en-US/compare.json +35 -0
- package/counter/counter.html +70 -72
- package/counter/counter.js +43 -20
- package/counter/locales/de-DE/counter.html +48 -0
- package/counter/locales/de-DE/counter.json +21 -0
- package/counter/locales/en-US/counter.html +48 -0
- package/counter/locales/en-US/counter.json +21 -0
- package/delay/delay.html +30 -102
- package/delay/delay.js +63 -20
- package/delay/locales/de-DE/delay.html +71 -0
- package/delay/locales/de-DE/delay.json +19 -0
- package/delay/locales/en-US/delay.html +76 -0
- package/delay/locales/en-US/delay.json +19 -0
- package/forwarder/forwarder.html +11 -42
- package/forwarder/forwarder.js +59 -18
- package/forwarder/locales/de-DE/forwarder.html +32 -0
- package/forwarder/locales/de-DE/forwarder.json +15 -0
- package/forwarder/locales/en-US/forwarder.html +32 -0
- package/forwarder/locales/en-US/forwarder.json +15 -0
- package/heating-curve/heating-curve.html +10 -51
- package/heating-curve/heating-curve.js +38 -13
- package/heating-curve/locales/de-DE/heating-curve.html +38 -0
- package/heating-curve/locales/de-DE/heating-curve.json +12 -0
- package/heating-curve/locales/en-US/heating-curve.html +38 -0
- package/heating-curve/locales/en-US/heating-curve.json +12 -0
- package/hysteresis/hysteresis.html +49 -69
- package/hysteresis/hysteresis.js +94 -68
- package/hysteresis/locales/de-DE/hysteresis.html +36 -0
- package/hysteresis/locales/de-DE/hysteresis.json +27 -0
- package/hysteresis/locales/en-US/hysteresis.html +36 -0
- package/hysteresis/locales/en-US/hysteresis.json +27 -0
- package/light/light.html +250 -0
- package/{light-control/light-control.js → light/light.js} +151 -32
- package/light/locales/de-DE/light.html +149 -0
- package/light/locales/de-DE/light.json +24 -0
- package/light/locales/en-US/light.html +148 -0
- package/light/locales/en-US/light.json +24 -0
- package/logic/locales/de-DE/logic.html +12 -0
- package/logic/locales/de-DE/logic.json +26 -0
- package/logic/locales/en-US/logic.html +12 -0
- package/logic/locales/en-US/logic.json +26 -0
- package/logic/logic.html +48 -64
- package/logic/logic.js +63 -29
- package/long-press/locales/de-DE/long-press.html +5 -0
- package/long-press/locales/de-DE/long-press.json +13 -0
- package/long-press/locales/en-US/long-press.html +5 -0
- package/long-press/locales/en-US/long-press.json +13 -0
- package/{long-press-control/long-press-control.html → long-press/long-press.html} +10 -14
- package/long-press/long-press.js +163 -0
- package/mixing-valve/locales/de-DE/mixing-valve.html +65 -0
- package/mixing-valve/locales/de-DE/mixing-valve.json +19 -0
- package/mixing-valve/locales/en-US/mixing-valve.html +66 -0
- package/mixing-valve/locales/en-US/mixing-valve.json +19 -0
- package/mixing-valve/mixing-valve.html +27 -93
- package/mixing-valve/mixing-valve.js +87 -61
- package/multi-press/locales/de-DE/multi-press.html +5 -0
- package/multi-press/locales/de-DE/multi-press.json +12 -0
- package/multi-press/locales/en-US/multi-press.html +5 -0
- package/multi-press/locales/en-US/multi-press.json +12 -0
- package/{multi-press-control/multi-press-control.html → multi-press/multi-press.html} +9 -13
- package/{multi-press-control/multi-press-control.js → multi-press/multi-press.js} +53 -5
- package/package.json +7 -7
- package/persistence.js +1 -0
- package/scene/locales/de-DE/scene.html +105 -0
- package/scene/locales/de-DE/scene.json +21 -0
- package/scene/locales/en-US/scene.html +107 -0
- package/scene/locales/en-US/scene.json +20 -0
- package/{scene-control/scene-control.html → scene/scene.html} +30 -132
- package/{scene-control/scene-control.js → scene/scene.js} +76 -26
- package/scheduler/locales/de-DE/scheduler.html +30 -0
- package/scheduler/locales/de-DE/scheduler.json +21 -0
- package/scheduler/locales/en-US/scheduler.html +30 -0
- package/scheduler/locales/en-US/scheduler.json +21 -0
- package/scheduler/scheduler.html +34 -64
- package/scheduler/scheduler.js +85 -53
- package/shutter/locales/de-DE/shutter.html +127 -0
- package/shutter/locales/de-DE/shutter.json +11 -0
- package/shutter/locales/en-US/shutter.html +133 -0
- package/shutter/locales/en-US/shutter.json +11 -0
- package/{shutter-control/shutter-control.html → shutter/shutter.html} +7 -133
- package/{shutter-control/shutter-control.js → shutter/shutter.js} +116 -56
- package/shutter-complex/locales/de-DE/shutter-complex.html +120 -0
- package/shutter-complex/locales/de-DE/shutter-complex.json +20 -0
- package/shutter-complex/locales/en-US/shutter-complex.html +120 -0
- package/shutter-complex/locales/en-US/shutter-complex.json +20 -0
- package/{shutter-complex-control/shutter-complex-control.html → shutter-complex/shutter-complex.html} +36 -140
- package/shutter-complex/shutter-complex.js +578 -0
- package/smart_helper.js +52 -9
- package/statistic/locales/de-DE/statistic.html +10 -0
- package/statistic/locales/de-DE/statistic.json +29 -0
- package/statistic/locales/en-US/statistic.html +10 -0
- package/statistic/locales/en-US/statistic.json +29 -0
- package/statistic/statistic.html +38 -43
- package/statistic/statistic.js +57 -28
- package/text-exec/locales/de-DE/text-exec.html +18 -0
- package/text-exec/locales/de-DE/text-exec.json +7 -0
- package/text-exec/locales/en-US/text-exec.html +18 -0
- package/text-exec/locales/en-US/text-exec.json +7 -0
- package/text-exec/text-exec.html +9 -25
- package/text-exec/text-exec.js +43 -2
- package/light-control/light-control.html +0 -363
- package/long-press-control/long-press-control.js +0 -76
- package/shutter-complex-control/shutter-complex-control.js +0 -442
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scene": {
|
|
3
|
+
"ui": {
|
|
4
|
+
"name": "Name",
|
|
5
|
+
"text": "Text",
|
|
6
|
+
"controlled_by_words": "Diese Node kann über die eingegebenen Wörter gesteuert werden. Mehrere Wörter werden durch ein Komma getrennt.",
|
|
7
|
+
"time_on": "Zeit Ein",
|
|
8
|
+
"controlled_by_central": "Dieser Baustein wird von folgenden Zentralbausteinen gesteuert:",
|
|
9
|
+
|
|
10
|
+
"outputs": "Ausgänge",
|
|
11
|
+
"scenes": "Szenen",
|
|
12
|
+
"links": "Links",
|
|
13
|
+
|
|
14
|
+
"milliseconds": "Millisekunden",
|
|
15
|
+
"seconds": "Sekunden",
|
|
16
|
+
"minutes": "Minuten",
|
|
17
|
+
"hours": "Stunden"
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script type="text/html" data-help-name="smart_scene-control">
|
|
2
|
+
<p>
|
|
3
|
+
This node controls several outputs that are switched on or off based on a defined scene.
|
|
4
|
+
|
|
5
|
+
<code>msg.payload = true</code> or <code>msg.payload = false</code> is always sent to each output to switch it on or off.
|
|
6
|
+
|
|
7
|
+
</p>
|
|
8
|
+
<p>
|
|
9
|
+
<b>Note:</b> Smart nodes use topics in the format <code>name#number</code>, so different smart nodes can be controlled with the same topic.<br />
|
|
10
|
+
This node uses both the <code>name</code> and <code>number</code> parts. Depending on the message, both values may need to be set.
|
|
11
|
+
</p>
|
|
12
|
+
<p>
|
|
13
|
+
The following topics are accepted:
|
|
14
|
+
<table>
|
|
15
|
+
<thead>
|
|
16
|
+
<tr>
|
|
17
|
+
<th>Topic</th>
|
|
18
|
+
<th>Description</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr>
|
|
23
|
+
<td><code>status#2</code></td>
|
|
24
|
+
<td>
|
|
25
|
+
Indicates the current status of output <code>2</code> via <code>msg.payload = true</code> or <code>msg.payload = false</code>.<br />
|
|
26
|
+
When an output changes, the time measurement is started for the stored or sent time, if available.
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
<tr>
|
|
30
|
+
<td><code>on</code></td>
|
|
31
|
+
<td>Switches all outputs on and starts the time measurement for the stored or sent time, if available.</td>
|
|
32
|
+
</tr>
|
|
33
|
+
<tr>
|
|
34
|
+
<td><code>off</code></td>
|
|
35
|
+
<td>Switches all outputs off.</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td><code>set</code></td>
|
|
39
|
+
<td>
|
|
40
|
+
Switches all outputs on when <code>msg.payload = true</code> and off when <code>msg.payload = false</code>.<br />
|
|
41
|
+
When changing from switched off to switched on, the time measurement is started for the stored or sent time, if available.
|
|
42
|
+
</td>
|
|
43
|
+
</tr>
|
|
44
|
+
<tr>
|
|
45
|
+
<td><code>set_permanent</code></td>
|
|
46
|
+
<td>
|
|
47
|
+
Switches all outputs permanently on when <code>msg.payload = true</code> and off when <code>msg.payload = false</code>.<br />
|
|
48
|
+
No time measurement is started.
|
|
49
|
+
</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td><code>scene_x,y,z</code></td>
|
|
53
|
+
<td>
|
|
54
|
+
Switches the outputs on or off according to the specified scene numbers (x, y and z).<br />
|
|
55
|
+
When the message arrives, it is checked which scene is currently active. If the number appears in the list, the next specified scene is activated.<br />
|
|
56
|
+
If the scene does not appear in the list, the first scene listed is activated.<br />
|
|
57
|
+
If only one scene is specified, the block switches between the specified scene and off.<br />
|
|
58
|
+
If at least one output is switched on, the time measurement starts again.
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td><code>toggle</code> (default)</td>
|
|
63
|
+
<td>
|
|
64
|
+
Switches all outputs off if at least one is already switched on.<br />
|
|
65
|
+
If all outputs are already switched off, all are switched on.
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
</tbody>
|
|
69
|
+
</table>
|
|
70
|
+
</p>
|
|
71
|
+
<p>
|
|
72
|
+
This node has an adjustable maximum runtime before all outputs are automatically switched off again.
|
|
73
|
+
This time measurement is used as in the table above.
|
|
74
|
+
The set time can be overwritten specifically.
|
|
75
|
+
Example: <code>msg = { "topic": "on", "time_on": 5000 }</code> or <code>msg = { "topic": "on", "time_on": "5s" }</code><br />
|
|
76
|
+
This message switches the light on for 5000 milliseconds / 5 seconds and then off again.
|
|
77
|
+
The next message without <code>time_on</code> specification uses the preset time again.
|
|
78
|
+
If the time is set to 0, the light will <b>not</b> be switched off automatically.<br />
|
|
79
|
+
The following values can be used as the unit for the time:
|
|
80
|
+
<table>
|
|
81
|
+
<thead>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Unit</th>
|
|
84
|
+
<th>Description</th>
|
|
85
|
+
</tr>
|
|
86
|
+
</thead>
|
|
87
|
+
<tbody>
|
|
88
|
+
<tr>
|
|
89
|
+
<td><code>ms</code> (default)</td>
|
|
90
|
+
<td>Milliseconds</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td><code>s</code> or <code>sec</code></td>
|
|
94
|
+
<td>Seconds</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td><code>m</code> or <code>min</code></td>
|
|
98
|
+
<td>Mintun.</td>
|
|
99
|
+
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td><code>h</code></td>
|
|
102
|
+
<td>Hours</td>
|
|
103
|
+
</tr>
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
</p>
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scene": {
|
|
3
|
+
"ui": {
|
|
4
|
+
"name": "Name",
|
|
5
|
+
"text": "Text",
|
|
6
|
+
"controlled_by_words": "This node can be controlled using the words entered. Multiple words are separated by a comma.",
|
|
7
|
+
"time_on": "Time On",
|
|
8
|
+
"controlled_by_central": "This block is controlled by the following central blocks:",
|
|
9
|
+
|
|
10
|
+
"outputs": "Outputs",
|
|
11
|
+
"scenes": "Scenes",
|
|
12
|
+
"links": "Links",
|
|
13
|
+
|
|
14
|
+
"milliseconds": "Milliseconds",
|
|
15
|
+
"seconds": "Seconds",
|
|
16
|
+
"minutes": "Minutes",
|
|
17
|
+
"hours": "Hours"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -204,7 +204,8 @@
|
|
|
204
204
|
{
|
|
205
205
|
let value = $(inputs[i]).typedInput("value");
|
|
206
206
|
$(inputs[i]).typedInput("types", [{
|
|
207
|
-
|
|
207
|
+
value: "output",
|
|
208
|
+
multiple: true,
|
|
208
209
|
options: options
|
|
209
210
|
}]);
|
|
210
211
|
$(inputs[i]).typedInput("value", value);
|
|
@@ -242,6 +243,7 @@
|
|
|
242
243
|
oneditprepare: function ()
|
|
243
244
|
{
|
|
244
245
|
let node = this;
|
|
246
|
+
|
|
245
247
|
onEditPrepare(this, ["smart_central-control"]);
|
|
246
248
|
initTreeList(node, ["smart_central-control"]);
|
|
247
249
|
|
|
@@ -268,7 +270,7 @@
|
|
|
268
270
|
.appendTo(row);
|
|
269
271
|
|
|
270
272
|
// Output name
|
|
271
|
-
var outputName = $("<input/>", { class: "node-input-prop-name", placeholder: "
|
|
273
|
+
var outputName = $("<input/>", { class: "node-input-prop-name", placeholder: node._("scene.ui.name"), type: "text" })
|
|
272
274
|
.css("width", "80%")
|
|
273
275
|
.appendTo(row);
|
|
274
276
|
|
|
@@ -312,7 +314,7 @@
|
|
|
312
314
|
.appendTo(row);
|
|
313
315
|
|
|
314
316
|
// Scene name
|
|
315
|
-
var sceneName = $("<input/>", { class: "node-input-prop-name", placeholder: "
|
|
317
|
+
var sceneName = $("<input/>", { class: "node-input-prop-name", placeholder: node._("scene.ui.name"), type: "text" })
|
|
316
318
|
.css("width", "30%")
|
|
317
319
|
.appendTo(row);
|
|
318
320
|
|
|
@@ -326,10 +328,11 @@
|
|
|
326
328
|
.css("width", "calc(70% - 55px)")
|
|
327
329
|
.appendTo(row)
|
|
328
330
|
.typedInput({
|
|
331
|
+
type: "output",
|
|
329
332
|
types: [{
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
]
|
|
333
|
+
value: "output",
|
|
334
|
+
multiple: true,
|
|
335
|
+
options: []
|
|
333
336
|
}]
|
|
334
337
|
});
|
|
335
338
|
|
|
@@ -370,19 +373,19 @@
|
|
|
370
373
|
tabs.addTab({
|
|
371
374
|
id: "scene-tab-outputs",
|
|
372
375
|
iconClass: "fa fa-lightbulb-o",
|
|
373
|
-
label: "
|
|
376
|
+
label: node._("scene.ui.outputs")
|
|
374
377
|
});
|
|
375
378
|
|
|
376
379
|
tabs.addTab({
|
|
377
380
|
id: "scene-tab-scenes",
|
|
378
381
|
iconClass: "fa fa-list-ul",
|
|
379
|
-
label: "
|
|
382
|
+
label: node._("scene.ui.scenes")
|
|
380
383
|
});
|
|
381
384
|
|
|
382
385
|
tabs.addTab({
|
|
383
386
|
id: "scene-tab-links",
|
|
384
387
|
iconClass: "fa fa-links",
|
|
385
|
-
label: "
|
|
388
|
+
label: node._("scene.ui.links")
|
|
386
389
|
});
|
|
387
390
|
|
|
388
391
|
|
|
@@ -404,21 +407,22 @@
|
|
|
404
407
|
$("#node-input-max_time_on_unit")
|
|
405
408
|
.css("max-width", "10rem")
|
|
406
409
|
.typedInput({
|
|
407
|
-
types: [
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
],
|
|
410
|
+
types: [{
|
|
411
|
+
default: "s",
|
|
412
|
+
value: "max_time_on_unit",
|
|
413
|
+
options: [
|
|
414
|
+
{ value: "ms", label: node._("scene.ui.milliseconds") },
|
|
415
|
+
{ value: "s", label: node._("scene.ui.seconds") },
|
|
416
|
+
{ value: "min", label: node._("scene.ui.minutes") },
|
|
417
|
+
{ value: "h", label: node._("scene.ui.hours") },
|
|
418
|
+
],
|
|
419
|
+
}],
|
|
418
420
|
});
|
|
419
421
|
},
|
|
420
422
|
oneditsave: function ()
|
|
421
423
|
{
|
|
424
|
+
let node = this;
|
|
425
|
+
|
|
422
426
|
// Set scenes
|
|
423
427
|
var items = $("#node-input-property-scenes").editableList("items");
|
|
424
428
|
var result = getScenes(items);
|
|
@@ -441,16 +445,16 @@
|
|
|
441
445
|
|
|
442
446
|
<script type="text/html" data-template-name="smart_scene-control">
|
|
443
447
|
<div class="form-row">
|
|
444
|
-
<label for="node-input-name"><i class="fa fa-tag"></i>
|
|
445
|
-
<input type="text" id="node-input-name"
|
|
448
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="scene.ui.name"></span></label>
|
|
449
|
+
<input type="text" id="node-input-name" data-i18n="[placeholder]scene.ui.name" />
|
|
446
450
|
</div>
|
|
447
451
|
<div class="form-row">
|
|
448
|
-
<label for="node-input-exec_text_names"><i class="fa fa-comments-o"></i>
|
|
452
|
+
<label for="node-input-exec_text_names"><i class="fa fa-comments-o"></i> <span data-i18n="scene.ui.text"></span></label>
|
|
449
453
|
<input id="node-input-exec_text_names" type="text" />
|
|
450
|
-
<div style="max-width: 450px;"
|
|
454
|
+
<div style="max-width: 450px;" data-i18n="scene.ui.controlled_by_words"></div>
|
|
451
455
|
</div>
|
|
452
456
|
<div class="form-row">
|
|
453
|
-
<label for="node-input-max_time_on"><i class="fa fa-clock-o"></i>
|
|
457
|
+
<label for="node-input-max_time_on"><i class="fa fa-clock-o"></i> <span data-i18n="scene.ui.time_on"></span></label>
|
|
454
458
|
<input id="node-input-max_time_on" value="0" />
|
|
455
459
|
<input id="node-input-max_time_on_unit" />
|
|
456
460
|
</div>
|
|
@@ -467,115 +471,9 @@
|
|
|
467
471
|
<ol id="node-input-property-scenes"></ol>
|
|
468
472
|
</div>
|
|
469
473
|
<div id="scene-tab-links" style="display: none;">
|
|
470
|
-
<span><i class="fa fa-link"></i>
|
|
474
|
+
<span><i class="fa fa-link"></i> <span data-i18n="scene.ui.controlled_by_central"></span></span>
|
|
471
475
|
<div class="form-row node-input-link-row node-input-link-rows"></div>
|
|
472
476
|
</div>
|
|
473
477
|
</div>
|
|
474
478
|
</div>
|
|
475
|
-
</script>
|
|
476
|
-
|
|
477
|
-
<script type="text/html" data-help-name="smart_scene-control">
|
|
478
|
-
<p>
|
|
479
|
-
Diese Node steuert mehrere Ausgänge die anhand einer definierten Szene ein- bzw. ausgeschaltet werden.
|
|
480
|
-
An jeden Ausgang wird immer <code>msg.payload = true</code> oder <code>msg.payload = false</code> gesendet um ihn ein-, bzw. auszuschalten.
|
|
481
|
-
</p>
|
|
482
|
-
<p>
|
|
483
|
-
<b>Hinweis:</b> Smart Nodes verwenden Topics im Format <code>name#nummer</code>, damit können verschiedene Smart Nodes mit dem gleichen Topic angesteuert werden.<br/>
|
|
484
|
-
Diese Node verwendet sowohl den Teil <code>name</code> als auch <code>nummer</code>. Je nach Nachricht müssen evtl. beide Werte gesetzt sein.
|
|
485
|
-
</p>
|
|
486
|
-
<p>
|
|
487
|
-
Folgende topics werden akzeptiert:
|
|
488
|
-
<table>
|
|
489
|
-
<thead>
|
|
490
|
-
<tr>
|
|
491
|
-
<th>Topic</th>
|
|
492
|
-
<th>Beschreibung</th>
|
|
493
|
-
</tr>
|
|
494
|
-
</thead>
|
|
495
|
-
<tbody>
|
|
496
|
-
<tr>
|
|
497
|
-
<td><code>status#2</code></td>
|
|
498
|
-
<td>
|
|
499
|
-
Gibt über <code>msg.payload = true</code> oder <code>msg.payload = false</code> den aktuellen Status des Ausgangs <code>2</code> an.<br/>
|
|
500
|
-
Bei einem Wechsel eines Ausgangs wird die Zeitmessung für die hinterlegte, bzw. mitgesendete Zeit gestartet, sofern vorhanden.
|
|
501
|
-
</td>
|
|
502
|
-
</tr>
|
|
503
|
-
<tr>
|
|
504
|
-
<td><code>on</code></td>
|
|
505
|
-
<td>Schaltet alle Ausgänge ein und startet die Zeitmessung für die hinterlegte, bzw. mitgesendete Zeit gestartet, sofern vorhanden.</td>
|
|
506
|
-
</tr>
|
|
507
|
-
<tr>
|
|
508
|
-
<td><code>off</code></td>
|
|
509
|
-
<td>Schaltet alle Ausgänge aus.</td>
|
|
510
|
-
</tr>
|
|
511
|
-
<tr>
|
|
512
|
-
<td><code>set</code></td>
|
|
513
|
-
<td>
|
|
514
|
-
Schaltet alle Ausgänge bei <code>msg.payload = true</code> ein und bei <code>msg.payload = false</code> aus.<br/>
|
|
515
|
-
Bei einem Wechsel von ausgeschaltet nach eingeschaltet wird die Zeitmessung für die hinterlegte, bzw. mitgesendete Zeit gestartet, sofern vorhanden.
|
|
516
|
-
</td>
|
|
517
|
-
</tr>
|
|
518
|
-
<tr>
|
|
519
|
-
<td><code>set_permanent</code></td>
|
|
520
|
-
<td>
|
|
521
|
-
Schaltet alle Ausgänge bei <code>msg.payload = true</code>dauerhaft ein und bei <code>msg.payload = false</code> aus.<br/>
|
|
522
|
-
Es wird dabei keine Zeitmessung gestartet.
|
|
523
|
-
</td>
|
|
524
|
-
</tr>
|
|
525
|
-
<tr>
|
|
526
|
-
<td><code>scene_x,y,z</code></td>
|
|
527
|
-
<td>
|
|
528
|
-
Schaltet die Ausgänge entsprechend der mitgegebenen Szenennummern (x, y und z) an, bzw. aus.<br/>
|
|
529
|
-
Beim Eintreffen der Nachricht wird geschaut welche Szene aktuell aktiv ist. Taucht die Nummer in der Liste auf, wird die nächste angegebene Szene aktiviert.<br/>
|
|
530
|
-
Taucht die Szene nicht in der Liste auf, wird die erste aufgelistete Szene aktiviert.<br/>
|
|
531
|
-
Wenn nur eine Szene angegeben ist, wechselt der Baustein zwischen der angegebenen Szene und aus.<br/>
|
|
532
|
-
Sollte mindestens ein Ausgang eingeschaltet sein, startet die Zeitmessung erneut.
|
|
533
|
-
</td>
|
|
534
|
-
</tr>
|
|
535
|
-
<tr>
|
|
536
|
-
<td><code>toggle</code> (default)</td>
|
|
537
|
-
<td>
|
|
538
|
-
Schaltet alle Ausgänge aus, falls mindestens einer bereits eingeschaltet wahr.<br/>
|
|
539
|
-
Sollten bereits alle Ausgänge ausgeschaltet sein, werden alle eingeschalten.
|
|
540
|
-
</td>
|
|
541
|
-
</tr>
|
|
542
|
-
</tbody>
|
|
543
|
-
</table>
|
|
544
|
-
</p>
|
|
545
|
-
<p>
|
|
546
|
-
Diese Node hat eine einstellbare Maximallaufzeit, bevor alle Ausgänge automatisch wieder ausgeschalten werden.
|
|
547
|
-
Diese Zeitmessung wird wie in der Tabelle oben verwendet.
|
|
548
|
-
Die eingestellte Zeit kann gezielt überschrieben werden.
|
|
549
|
-
Beispiel: <code>msg = { "topic": "on", "time_on": 5000 }</code> oder <code>msg = { "topic": "on", "time_on": "5s" }</code><br/>
|
|
550
|
-
Diese Nachricht schaltet das Licht für 5000 Millisekunden / 5 Sekunden an und anschließend wieder aus.
|
|
551
|
-
Die nächste Nachricht ohne <code>time_on</code> Angabe verwendet wieder die voreingestellte Zeit.
|
|
552
|
-
Ist die Zeit auf 0 eingestellt, wird das Licht <b>nicht</b> automatisch ausgeschalten.<br/>
|
|
553
|
-
Als Einheit für die Zeit können folgende Werte verwendet werden:
|
|
554
|
-
<table>
|
|
555
|
-
<thead>
|
|
556
|
-
<tr>
|
|
557
|
-
<th>Einheit</th>
|
|
558
|
-
<th>Beschreibung</th>
|
|
559
|
-
</tr>
|
|
560
|
-
</thead>
|
|
561
|
-
<tbody>
|
|
562
|
-
<tr>
|
|
563
|
-
<td><code>ms</code> (default)</td>
|
|
564
|
-
<td>Millisekunden</td>
|
|
565
|
-
</tr>
|
|
566
|
-
<tr>
|
|
567
|
-
<td><code>s</code> oder <code>sec</code></td>
|
|
568
|
-
<td>Sekunden</td>
|
|
569
|
-
</tr>
|
|
570
|
-
<tr>
|
|
571
|
-
<td><code>m</code> oder <code>min</code></td>
|
|
572
|
-
<td>Mintun.</td>
|
|
573
|
-
</tr>
|
|
574
|
-
<tr>
|
|
575
|
-
<td><code>h</code></td>
|
|
576
|
-
<td>Stunden</td>
|
|
577
|
-
</tr>
|
|
578
|
-
</tbody>
|
|
579
|
-
</table>
|
|
580
|
-
</p>
|
|
581
479
|
</script>
|
|
@@ -7,29 +7,62 @@ module.exports = function (RED)
|
|
|
7
7
|
const node = this;
|
|
8
8
|
RED.nodes.createNode(node, config);
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
// ###################
|
|
12
|
+
// # Class constants #
|
|
13
|
+
// ###################
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// #######################
|
|
17
|
+
// # Global help objects #
|
|
18
|
+
// #######################
|
|
10
19
|
const smart_context = require("../persistence.js")(RED);
|
|
11
20
|
const helper = require("../smart_helper.js");
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
|
|
23
|
+
// ############################
|
|
24
|
+
// # Used from text-exec node #
|
|
25
|
+
// ############################
|
|
14
26
|
if (typeof config.exec_text_names == "string")
|
|
15
27
|
node.exec_text_names = config.exec_text_names.split(",").map(n => n.trim().toLowerCase());
|
|
16
28
|
else
|
|
17
29
|
node.exec_text_names = [];
|
|
18
30
|
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
|
|
32
|
+
// #####################
|
|
33
|
+
// # persistent values #
|
|
34
|
+
// #####################
|
|
35
|
+
var node_settings = helper.cloneObject({
|
|
21
36
|
last_values: [], // light is on or off for a scene
|
|
22
37
|
}, smart_context.get(node.id));
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
|
|
40
|
+
// ##################
|
|
41
|
+
// # Dynamic config #
|
|
42
|
+
// ##################
|
|
25
43
|
let max_time_on = helper.getTimeInMs(config.max_time_on, config.max_time_on_unit);
|
|
26
44
|
|
|
27
|
-
//
|
|
28
|
-
|
|
45
|
+
// ##################
|
|
46
|
+
// # Runtime values #
|
|
47
|
+
// ##################
|
|
48
|
+
|
|
49
|
+
// Here the setTimeout return value is stored to turn off the light.
|
|
50
|
+
// That means if it is null, the light will not be turned off automatically.
|
|
51
|
+
let timeout = null;
|
|
52
|
+
|
|
53
|
+
// If isPermanent is true, then a default on time value is ignored
|
|
54
|
+
// Also if the motion sensor turns off, no timeout is started.
|
|
29
55
|
let isPermanent = false;
|
|
30
|
-
let current_timeout_ms = 0;
|
|
31
56
|
|
|
32
|
-
|
|
57
|
+
|
|
58
|
+
// Here the date is stored, when the light should go off.
|
|
59
|
+
// This is used to calculate the node status.
|
|
60
|
+
let timeout_end_date = null;
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
// #########################
|
|
64
|
+
// # Central node handling #
|
|
65
|
+
// #########################
|
|
33
66
|
var event = "node:" + config.id;
|
|
34
67
|
var handler = function (msg)
|
|
35
68
|
{
|
|
@@ -38,14 +71,14 @@ module.exports = function (RED)
|
|
|
38
71
|
RED.events.on(event, handler);
|
|
39
72
|
|
|
40
73
|
|
|
74
|
+
// Per default expect that all outputs are off
|
|
41
75
|
if (node_settings.last_values.length != config.scenes.length)
|
|
42
|
-
{
|
|
43
|
-
// Per default expect that all outputs are off
|
|
44
76
|
node_settings.last_values = new Array(config.outputs).fill(false);
|
|
45
|
-
}
|
|
46
77
|
|
|
47
|
-
node.status({});
|
|
48
78
|
|
|
79
|
+
// ###############
|
|
80
|
+
// # Node events #
|
|
81
|
+
// ###############
|
|
49
82
|
node.on("input", function (msg)
|
|
50
83
|
{
|
|
51
84
|
handleTopic(msg);
|
|
@@ -54,7 +87,7 @@ module.exports = function (RED)
|
|
|
54
87
|
if (getCurrentScene() != 0)
|
|
55
88
|
startAutoOffIfNeeded(helper.getTimeInMsFromString(msg.time_on ?? max_time_on));
|
|
56
89
|
|
|
57
|
-
|
|
90
|
+
setStatus();
|
|
58
91
|
smart_context.set(node.id, node_settings);
|
|
59
92
|
});
|
|
60
93
|
|
|
@@ -64,6 +97,12 @@ module.exports = function (RED)
|
|
|
64
97
|
RED.events.off(event, handler);
|
|
65
98
|
});
|
|
66
99
|
|
|
100
|
+
|
|
101
|
+
// #####################
|
|
102
|
+
// # Private functions #
|
|
103
|
+
// #####################
|
|
104
|
+
|
|
105
|
+
// This is the main function which handles all topics that was received.
|
|
67
106
|
let handleTopic = msg =>
|
|
68
107
|
{
|
|
69
108
|
let currentScene = getCurrentScene();
|
|
@@ -211,7 +250,16 @@ module.exports = function (RED)
|
|
|
211
250
|
timeMs = max_time_on;
|
|
212
251
|
}
|
|
213
252
|
|
|
214
|
-
|
|
253
|
+
// calculate end date for status message
|
|
254
|
+
if (timeMs > 0)
|
|
255
|
+
{
|
|
256
|
+
timeout_end_date = new Date();
|
|
257
|
+
timeout_end_date.setMilliseconds(timeout_end_date.getMilliseconds() + timeMs);
|
|
258
|
+
}
|
|
259
|
+
else
|
|
260
|
+
{
|
|
261
|
+
timeout_end_date = null;
|
|
262
|
+
}
|
|
215
263
|
|
|
216
264
|
// Stop if any timeout is set
|
|
217
265
|
stopAutoOff();
|
|
@@ -220,35 +268,36 @@ module.exports = function (RED)
|
|
|
220
268
|
if (timeMs <= 0 || isPermanent || getCurrentScene() == 0)
|
|
221
269
|
return;
|
|
222
270
|
|
|
223
|
-
|
|
271
|
+
timeout = setTimeout(() =>
|
|
224
272
|
{
|
|
273
|
+
timeout = null;
|
|
225
274
|
node_settings.last_values = new Array(config.outputs).fill(false);
|
|
226
275
|
node.send(node_settings.last_values.map(val => { return { payload: val }; }));
|
|
227
276
|
notifyCentral();
|
|
228
277
|
|
|
229
|
-
|
|
278
|
+
setStatus();
|
|
230
279
|
smart_context.set(node.id, node_settings);
|
|
231
280
|
}, timeMs);
|
|
232
281
|
}
|
|
233
282
|
|
|
234
283
|
let stopAutoOff = () =>
|
|
235
284
|
{
|
|
236
|
-
if (
|
|
285
|
+
if (timeout != null)
|
|
237
286
|
{
|
|
238
|
-
clearTimeout(
|
|
239
|
-
|
|
287
|
+
clearTimeout(timeout);
|
|
288
|
+
timeout = null;
|
|
240
289
|
}
|
|
241
290
|
}
|
|
242
291
|
|
|
243
|
-
let
|
|
292
|
+
let setStatus = () =>
|
|
244
293
|
{
|
|
245
294
|
let scene = getCurrentScene();
|
|
246
295
|
if (scene != 0)
|
|
247
296
|
{
|
|
248
|
-
if (isPermanent ||
|
|
297
|
+
if (isPermanent || timeout_end_date == null)
|
|
249
298
|
node.status({ fill: "green", shape: "dot", text: helper.getCurrentTimeForStatus() + ": Scene " + scene + " active" });
|
|
250
|
-
else if (
|
|
251
|
-
node.status({ fill: "yellow", shape: "ring", text: helper.getCurrentTimeForStatus() + ": Scene " + scene + " active, wait " + helper.
|
|
299
|
+
else if (timeout)
|
|
300
|
+
node.status({ fill: "yellow", shape: "ring", text: helper.getCurrentTimeForStatus() + ": Scene " + scene + " active, wait " + helper.formatDateToStatus(timeout_end_date, "until") + " for auto off" });
|
|
252
301
|
}
|
|
253
302
|
else
|
|
254
303
|
{
|
|
@@ -265,8 +314,8 @@ module.exports = function (RED)
|
|
|
265
314
|
|
|
266
315
|
config.links.forEach(link =>
|
|
267
316
|
{
|
|
268
|
-
|
|
269
|
-
|
|
317
|
+
helper.log(node.id + " -> " + link);
|
|
318
|
+
helper.log({ source: node.id, state: state });
|
|
270
319
|
RED.events.emit("node:" + link, { source: node.id, state: state });
|
|
271
320
|
});
|
|
272
321
|
}
|
|
@@ -275,7 +324,8 @@ module.exports = function (RED)
|
|
|
275
324
|
if (getCurrentScene() != 0)
|
|
276
325
|
startAutoOffIfNeeded(helper.getTimeInMsFromString(max_time_on));
|
|
277
326
|
|
|
278
|
-
|
|
327
|
+
setStatus();
|
|
279
328
|
}
|
|
329
|
+
|
|
280
330
|
RED.nodes.registerType("smart_scene-control", SceneControlNode);
|
|
281
331
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script type="text/html" data-help-name="smart_scheduler">
|
|
2
|
+
<p>
|
|
3
|
+
Diese Node sendet zu den angegebenen Zeitpunkten die entsprechenden Nachrichten an den Ausgang.
|
|
4
|
+
</p>
|
|
5
|
+
<p>
|
|
6
|
+
Folgende topics werden akzeptiert:
|
|
7
|
+
<table>
|
|
8
|
+
<thead>
|
|
9
|
+
<tr>
|
|
10
|
+
<th>Topic</th>
|
|
11
|
+
<th>Beschreibung</th>
|
|
12
|
+
</tr>
|
|
13
|
+
</thead>
|
|
14
|
+
<tbody>
|
|
15
|
+
<tr>
|
|
16
|
+
<td><code>enable</code></td>
|
|
17
|
+
<td>Aktiviert den Scheduler.</td>
|
|
18
|
+
</tr>
|
|
19
|
+
<tr>
|
|
20
|
+
<td><code>disable</code></td>
|
|
21
|
+
<td>Deaktiviert den Scheduler.</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td><code>set_state</code></td>
|
|
25
|
+
<td>Aktiviert den Scheduler, wenn <code>msg.payload = true</code> oder deaktiviert den Scheduler, wenn <code>msg.payload = false</code>.</td>
|
|
26
|
+
</tr>
|
|
27
|
+
</tbody>
|
|
28
|
+
</table>
|
|
29
|
+
</p>
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scheduler": {
|
|
3
|
+
"ui": {
|
|
4
|
+
"name": "Name",
|
|
5
|
+
"scheduler_enabled": "Scheduler aktiviert",
|
|
6
|
+
"schedules": "Schedules",
|
|
7
|
+
|
|
8
|
+
"system_start": "Systemstart",
|
|
9
|
+
"save_state": "Zustand speichern",
|
|
10
|
+
"send_after_start": "Letze Nachricht 10 Sekunden nach dem Start senden",
|
|
11
|
+
|
|
12
|
+
"monday": "Montag",
|
|
13
|
+
"tuesday": "Dienstag",
|
|
14
|
+
"wednesday": "Mittwoch",
|
|
15
|
+
"thursday": "Donnerstag",
|
|
16
|
+
"friday": "Freitag",
|
|
17
|
+
"saturday": "Samstag",
|
|
18
|
+
"sunday": "Sonntag"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|