smart-nodes 0.3.2 → 0.3.4
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/package.json +1 -1
- package/scene-control/scene-control.js +6 -0
- package/shutter-complex-control/shutter-complex-control.js +6 -0
- package/shutter-control/shutter-control.js +6 -0
- package/text-exec/text-exec.js +28 -4
- package/examples/central.json +0 -804
- package/examples/central.png +0 -0
- package/examples/compare.json +0 -916
- package/examples/compare.png +0 -0
- package/examples/delay.json +0 -198
- package/examples/delay.png +0 -0
- package/examples/forwarder.json +0 -152
- package/examples/forwarder.png +0 -0
- package/examples/hysteresis.json +0 -358
- package/examples/hysteresis.png +0 -0
- package/examples/light-control.json +0 -499
- package/examples/light-control.png +0 -0
- package/examples/logic.json +0 -562
- package/examples/logic.png +0 -0
- package/examples/long-press-control.json +0 -113
- package/examples/long-press-control.png +0 -0
- package/examples/multi-press-control.json +0 -136
- package/examples/multi-press-control.png +0 -0
- package/examples/scene-control.json +0 -535
- package/examples/scene-control.png +0 -0
- package/examples/scheduler.json +0 -164
- package/examples/scheduler.png +0 -0
- package/examples/shutter-complex-control.json +0 -489
- package/examples/shutter-complex-control.png +0 -0
- package/examples/shutter-control.json +0 -457
- package/examples/shutter-control.png +0 -0
- package/examples/statistic.json +0 -1112
- package/examples/statistic.png +0 -0
- package/examples/text-exec.json +0 -147
- package/examples/text-exec.png +0 -0
package/package.json
CHANGED
|
@@ -8,6 +8,12 @@ module.exports = function (RED)
|
|
|
8
8
|
const smartContext = require("../persistence.js")(RED);
|
|
9
9
|
const helper = require("../smart_helper.js");
|
|
10
10
|
|
|
11
|
+
// used from text-exec node
|
|
12
|
+
if (typeof config.exec_text_names == "string")
|
|
13
|
+
node.exec_text_names = config.exec_text_names.split(",").map(n => n.trim().toLowerCase());
|
|
14
|
+
else
|
|
15
|
+
node.exec_text_names = [];
|
|
16
|
+
|
|
11
17
|
// persistent values
|
|
12
18
|
var nodeSettings = Object.assign({}, {
|
|
13
19
|
last_values: [], // light is on or off for a scene
|
|
@@ -8,6 +8,12 @@ module.exports = function (RED)
|
|
|
8
8
|
const smartContext = require("../persistence.js")(RED);
|
|
9
9
|
const helper = require("../smart_helper.js");
|
|
10
10
|
|
|
11
|
+
// used from text-exec node
|
|
12
|
+
if (typeof config.exec_text_names == "string")
|
|
13
|
+
node.exec_text_names = config.exec_text_names.split(",").map(n => n.trim().toLowerCase());
|
|
14
|
+
else
|
|
15
|
+
node.exec_text_names = [];
|
|
16
|
+
|
|
11
17
|
// persistent values
|
|
12
18
|
var nodeSettings = Object.assign({}, {
|
|
13
19
|
last_position: 0, // 0 = opened, 100 = closed
|
|
@@ -8,6 +8,12 @@ module.exports = function (RED)
|
|
|
8
8
|
const smartContext = require("../persistence.js")(RED);
|
|
9
9
|
const helper = require("../smart_helper.js");
|
|
10
10
|
|
|
11
|
+
// used from text-exec node
|
|
12
|
+
if (typeof config.exec_text_names == "string")
|
|
13
|
+
node.exec_text_names = config.exec_text_names.split(",").map(n => n.trim().toLowerCase());
|
|
14
|
+
else
|
|
15
|
+
node.exec_text_names = [];
|
|
16
|
+
|
|
11
17
|
// persistent values
|
|
12
18
|
var nodeSettings = Object.assign({}, {
|
|
13
19
|
last_position: 0, // 0 = opened, 100 = closed
|
package/text-exec/text-exec.js
CHANGED
|
@@ -19,6 +19,8 @@ module.exports = function (RED)
|
|
|
19
19
|
{
|
|
20
20
|
let mode = "light"; // light || shutter
|
|
21
21
|
let action = null; // on || off || up || stop || down
|
|
22
|
+
let number = null;
|
|
23
|
+
|
|
22
24
|
let message = null;
|
|
23
25
|
|
|
24
26
|
if (typeof msg.payload == "string")
|
|
@@ -78,6 +80,7 @@ module.exports = function (RED)
|
|
|
78
80
|
case "ein":
|
|
79
81
|
case "einschalten":
|
|
80
82
|
// node.log("Set action to on");
|
|
83
|
+
mode = "light";
|
|
81
84
|
action = "on";
|
|
82
85
|
break;
|
|
83
86
|
|
|
@@ -85,6 +88,7 @@ module.exports = function (RED)
|
|
|
85
88
|
case "off":
|
|
86
89
|
case "ausschalten":
|
|
87
90
|
// node.log("Set action to off");
|
|
91
|
+
mode = "light";
|
|
88
92
|
action = "off";
|
|
89
93
|
break;
|
|
90
94
|
|
|
@@ -94,6 +98,7 @@ module.exports = function (RED)
|
|
|
94
98
|
case "öffne":
|
|
95
99
|
case "open":
|
|
96
100
|
// node.log("Set action to up");
|
|
101
|
+
mode = "shutter";
|
|
97
102
|
action = "up";
|
|
98
103
|
break;
|
|
99
104
|
|
|
@@ -103,12 +108,23 @@ module.exports = function (RED)
|
|
|
103
108
|
case "schließe":
|
|
104
109
|
case "close":
|
|
105
110
|
// node.log("Set action to down");
|
|
111
|
+
mode = "shutter";
|
|
106
112
|
action = "down";
|
|
107
113
|
break;
|
|
108
114
|
|
|
115
|
+
case "prozent":
|
|
116
|
+
case "percent":
|
|
117
|
+
case "percentage":
|
|
118
|
+
// node.log("Set action to position");
|
|
119
|
+
mode = "shutter";
|
|
120
|
+
action = "position";
|
|
121
|
+
break;
|
|
122
|
+
|
|
109
123
|
case "stoppe":
|
|
110
124
|
case "stop":
|
|
125
|
+
case "anhalten":
|
|
111
126
|
// node.log("Set action to stop");
|
|
127
|
+
mode = "shutter";
|
|
112
128
|
action = "stop";
|
|
113
129
|
break;
|
|
114
130
|
|
|
@@ -118,6 +134,7 @@ module.exports = function (RED)
|
|
|
118
134
|
{
|
|
119
135
|
action = null;
|
|
120
136
|
affectedNodes = [];
|
|
137
|
+
number = null;
|
|
121
138
|
}
|
|
122
139
|
break;
|
|
123
140
|
|
|
@@ -129,12 +146,19 @@ module.exports = function (RED)
|
|
|
129
146
|
let room = rooms[parseInt(word.substring(1), 10)];
|
|
130
147
|
// node.log("Found room " + room);
|
|
131
148
|
|
|
132
|
-
|
|
149
|
+
if (lookup[mode] && lookup[mode][room] && Array.isArray(lookup[mode][room]))
|
|
133
150
|
{
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
for (const node of lookup[mode][room])
|
|
152
|
+
{
|
|
153
|
+
if (!affectedNodes.includes(node))
|
|
154
|
+
affectedNodes.push(node);
|
|
155
|
+
}
|
|
136
156
|
}
|
|
137
157
|
}
|
|
158
|
+
else if (Number.isInteger(word))
|
|
159
|
+
{
|
|
160
|
+
number = parseInt(word, 10);
|
|
161
|
+
}
|
|
138
162
|
else
|
|
139
163
|
{
|
|
140
164
|
// node.log("Ignore word " + word);
|
|
@@ -167,7 +191,7 @@ module.exports = function (RED)
|
|
|
167
191
|
|
|
168
192
|
for (const name of linkedNode.exec_text_names)
|
|
169
193
|
{
|
|
170
|
-
//
|
|
194
|
+
// console.log(linkedNode);
|
|
171
195
|
switch (linkedNode.type)
|
|
172
196
|
{
|
|
173
197
|
case "smart_light-control":
|