smart-nodes 0.3.7 → 0.3.13
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 +82 -47
- package/compare/compare.js +1 -1
- package/delay/delay.js +11 -11
- package/examples/central.json +804 -0
- package/examples/central.png +0 -0
- package/examples/compare.json +916 -0
- package/examples/compare.png +0 -0
- package/examples/delay.json +198 -0
- package/examples/delay.png +0 -0
- package/examples/forwarder.json +152 -0
- package/examples/forwarder.png +0 -0
- package/examples/hysteresis.json +358 -0
- package/examples/hysteresis.png +0 -0
- package/examples/light-control.json +499 -0
- package/examples/light-control.png +0 -0
- package/examples/logic.json +562 -0
- package/examples/logic.png +0 -0
- package/examples/long-press-control.json +113 -0
- package/examples/long-press-control.png +0 -0
- package/examples/multi-press-control.json +136 -0
- package/examples/multi-press-control.png +0 -0
- package/examples/scene-control.json +535 -0
- package/examples/scene-control.png +0 -0
- package/examples/scheduler.json +164 -0
- package/examples/scheduler.png +0 -0
- package/examples/shutter-complex-control.json +489 -0
- package/examples/shutter-complex-control.png +0 -0
- package/examples/shutter-control.json +457 -0
- package/examples/shutter-control.png +0 -0
- package/examples/statistic.json +1112 -0
- package/examples/statistic.png +0 -0
- package/examples/text-exec.json +147 -0
- package/examples/text-exec.png +0 -0
- package/forwarder/forwarder.js +2 -2
- package/hysteresis/hysteresis.js +12 -12
- package/light-control/light-control.js +4 -4
- package/logic/logic.js +1 -1
- package/long-press-control/long-press-control.js +4 -5
- package/multi-press-control/multi-press-control.js +1 -1
- package/package.json +1 -1
- package/scene-control/scene-control.js +3 -3
- package/scheduler/scheduler.js +4 -4
- package/shutter-complex-control/shutter-complex-control.js +10 -10
- package/shutter-control/shutter-control.js +12 -12
- package/statistic/statistic.js +2 -2
- package/text-exec/text-exec.js +39 -3
|
Binary file
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "90448dd828d24ddd",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "Text Exec",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "",
|
|
8
|
+
"env": []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "2e14a6369ac138a3",
|
|
12
|
+
"type": "smart_text-exec",
|
|
13
|
+
"z": "90448dd828d24ddd",
|
|
14
|
+
"name": "",
|
|
15
|
+
"links": [
|
|
16
|
+
"767db1c6ace634a9",
|
|
17
|
+
"9907df9b18c77b8f"
|
|
18
|
+
],
|
|
19
|
+
"x": 470,
|
|
20
|
+
"y": 120,
|
|
21
|
+
"wires": []
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "485438cec89d4bea",
|
|
25
|
+
"type": "inject",
|
|
26
|
+
"z": "90448dd828d24ddd",
|
|
27
|
+
"name": "Essen an, Sofa aus",
|
|
28
|
+
"props": [
|
|
29
|
+
{
|
|
30
|
+
"p": "payload"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"repeat": "",
|
|
34
|
+
"crontab": "",
|
|
35
|
+
"once": false,
|
|
36
|
+
"onceDelay": 0.1,
|
|
37
|
+
"topic": "",
|
|
38
|
+
"payload": "Schalte Essen an und das Sofa aus",
|
|
39
|
+
"payloadType": "str",
|
|
40
|
+
"x": 190,
|
|
41
|
+
"y": 120,
|
|
42
|
+
"wires": [
|
|
43
|
+
[
|
|
44
|
+
"2e14a6369ac138a3"
|
|
45
|
+
]
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "9907df9b18c77b8f",
|
|
50
|
+
"type": "smart_light-control",
|
|
51
|
+
"z": "90448dd828d24ddd",
|
|
52
|
+
"name": "Essen",
|
|
53
|
+
"exec_text_names": "Essen, Wohnzimmer",
|
|
54
|
+
"max_time_on": "0",
|
|
55
|
+
"max_time_on_unit": "s",
|
|
56
|
+
"alarm_action": "NOTHING",
|
|
57
|
+
"links": [
|
|
58
|
+
"2e14a6369ac138a3"
|
|
59
|
+
],
|
|
60
|
+
"x": 230,
|
|
61
|
+
"y": 260,
|
|
62
|
+
"wires": [
|
|
63
|
+
[
|
|
64
|
+
"a11ef18f66c62bb4"
|
|
65
|
+
]
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "a11ef18f66c62bb4",
|
|
70
|
+
"type": "debug",
|
|
71
|
+
"z": "90448dd828d24ddd",
|
|
72
|
+
"name": "debug 55",
|
|
73
|
+
"active": true,
|
|
74
|
+
"tosidebar": true,
|
|
75
|
+
"console": false,
|
|
76
|
+
"tostatus": false,
|
|
77
|
+
"complete": "true",
|
|
78
|
+
"targetType": "full",
|
|
79
|
+
"statusVal": "",
|
|
80
|
+
"statusType": "auto",
|
|
81
|
+
"x": 480,
|
|
82
|
+
"y": 260,
|
|
83
|
+
"wires": []
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "767db1c6ace634a9",
|
|
87
|
+
"type": "smart_light-control",
|
|
88
|
+
"z": "90448dd828d24ddd",
|
|
89
|
+
"name": "Sofa",
|
|
90
|
+
"exec_text_names": "Sofa, Wohnzimmer",
|
|
91
|
+
"max_time_on": "0",
|
|
92
|
+
"max_time_on_unit": "s",
|
|
93
|
+
"alarm_action": "NOTHING",
|
|
94
|
+
"links": [
|
|
95
|
+
"2e14a6369ac138a3"
|
|
96
|
+
],
|
|
97
|
+
"x": 230,
|
|
98
|
+
"y": 320,
|
|
99
|
+
"wires": [
|
|
100
|
+
[
|
|
101
|
+
"2f496ef68d26b28b"
|
|
102
|
+
]
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "2f496ef68d26b28b",
|
|
107
|
+
"type": "debug",
|
|
108
|
+
"z": "90448dd828d24ddd",
|
|
109
|
+
"name": "debug 56",
|
|
110
|
+
"active": true,
|
|
111
|
+
"tosidebar": true,
|
|
112
|
+
"console": false,
|
|
113
|
+
"tostatus": false,
|
|
114
|
+
"complete": "true",
|
|
115
|
+
"targetType": "full",
|
|
116
|
+
"statusVal": "",
|
|
117
|
+
"statusType": "auto",
|
|
118
|
+
"x": 480,
|
|
119
|
+
"y": 320,
|
|
120
|
+
"wires": []
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "8a2c0707390be2e9",
|
|
124
|
+
"type": "inject",
|
|
125
|
+
"z": "90448dd828d24ddd",
|
|
126
|
+
"name": "Wohnzimmer an",
|
|
127
|
+
"props": [
|
|
128
|
+
{
|
|
129
|
+
"p": "payload"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"repeat": "",
|
|
133
|
+
"crontab": "",
|
|
134
|
+
"once": false,
|
|
135
|
+
"onceDelay": 0.1,
|
|
136
|
+
"topic": "",
|
|
137
|
+
"payload": "Schalte das Wohnzimmer ein",
|
|
138
|
+
"payloadType": "str",
|
|
139
|
+
"x": 200,
|
|
140
|
+
"y": 160,
|
|
141
|
+
"wires": [
|
|
142
|
+
[
|
|
143
|
+
"2e14a6369ac138a3"
|
|
144
|
+
]
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
]
|
|
Binary file
|
package/forwarder/forwarder.js
CHANGED
|
@@ -83,9 +83,9 @@ module.exports = function (RED)
|
|
|
83
83
|
let setStatus = () =>
|
|
84
84
|
{
|
|
85
85
|
if (nodeSettings.enabled)
|
|
86
|
-
node.status({ fill: "green", shape: "dot", text: "Forwarding enabled" });
|
|
86
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Forwarding enabled" });
|
|
87
87
|
else
|
|
88
|
-
node.status({ fill: "red", shape: "dot", text: "Forwarding disabled" });
|
|
88
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Forwarding disabled" });
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
setStatus();
|
package/hysteresis/hysteresis.js
CHANGED
|
@@ -22,15 +22,15 @@ module.exports = function (RED)
|
|
|
22
22
|
switch (nodeSettings.active)
|
|
23
23
|
{
|
|
24
24
|
case true:
|
|
25
|
-
node.status({ fill: "
|
|
25
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Load last state: Higher" });
|
|
26
26
|
break;
|
|
27
27
|
|
|
28
28
|
case false:
|
|
29
|
-
node.status({ fill: "
|
|
29
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Load last state: Lower" });
|
|
30
30
|
break;
|
|
31
31
|
|
|
32
32
|
default:
|
|
33
|
-
node.status({ fill: "yellow", shape: "ring", text: "No last state available" });
|
|
33
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": No last state available" });
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -64,7 +64,7 @@ module.exports = function (RED)
|
|
|
64
64
|
{
|
|
65
65
|
case "setpoint":
|
|
66
66
|
setpoint = value;
|
|
67
|
-
node.status({ fill: "
|
|
67
|
+
node.status({ fill: nodeSettings.active ? "green" : "red", shape: "ring", text: (new Date()).toLocaleString() + ": New setpoint: " + value + "" });
|
|
68
68
|
|
|
69
69
|
if (config.save_state)
|
|
70
70
|
smartContext.set(node.id, nodeSettings);
|
|
@@ -72,7 +72,7 @@ module.exports = function (RED)
|
|
|
72
72
|
|
|
73
73
|
case "hysteresis":
|
|
74
74
|
hysteresis = value;
|
|
75
|
-
node.status({ fill: "
|
|
75
|
+
node.status({ fill: nodeSettings.active ? "green" : "red", shape: "ring", text: (new Date()).toLocaleString() + ": New hysteresis: " + value + "" });
|
|
76
76
|
|
|
77
77
|
if (config.save_state)
|
|
78
78
|
smartContext.set(node.id, nodeSettings);
|
|
@@ -81,24 +81,24 @@ module.exports = function (RED)
|
|
|
81
81
|
case "resend":
|
|
82
82
|
if (nodeSettings.active === true && nodeSettings.lastMessage != null)
|
|
83
83
|
{
|
|
84
|
-
node.status({ fill: "green", shape: "dot", text: "Resend higher value
|
|
84
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Resend higher value" });
|
|
85
85
|
node.send([nodeSettings.lastMessage, null]);
|
|
86
86
|
}
|
|
87
87
|
else if (nodeSettings.active === false && nodeSettings.lastMessage != null)
|
|
88
88
|
{
|
|
89
|
-
node.status({ fill: "
|
|
89
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Resend lower value" });
|
|
90
90
|
node.send([null, nodeSettings.lastMessage]);
|
|
91
91
|
}
|
|
92
92
|
else
|
|
93
93
|
{
|
|
94
|
-
node.status({ fill: "
|
|
94
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": No resend, state is unknown" });
|
|
95
95
|
}
|
|
96
96
|
break;
|
|
97
97
|
|
|
98
98
|
default:
|
|
99
99
|
if (value >= setpoint + hysteresis && nodeSettings.active !== true)
|
|
100
100
|
{
|
|
101
|
-
node.status({ fill: "green", shape: "dot", text: "Turned higher by value " + value });
|
|
101
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Turned higher by value " + value + "" });
|
|
102
102
|
nodeSettings.active = true;
|
|
103
103
|
nodeSettings.lastMessage = out_higher ?? msg;
|
|
104
104
|
|
|
@@ -109,7 +109,7 @@ module.exports = function (RED)
|
|
|
109
109
|
}
|
|
110
110
|
else if (value <= setpoint - hysteresis && nodeSettings.active !== false)
|
|
111
111
|
{
|
|
112
|
-
node.status({ fill: "
|
|
112
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Turned lower by value " + value + "" });
|
|
113
113
|
nodeSettings.active = false;
|
|
114
114
|
nodeSettings.lastMessage = out_lower ?? msg;
|
|
115
115
|
|
|
@@ -120,7 +120,7 @@ module.exports = function (RED)
|
|
|
120
120
|
}
|
|
121
121
|
else
|
|
122
122
|
{
|
|
123
|
-
node.status({ fill: "
|
|
123
|
+
node.status({ fill: nodeSettings.active ? "green" : "red", shape: "ring", text: (new Date()).toLocaleString() + ": No change by value " + value + "" });
|
|
124
124
|
}
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
@@ -130,7 +130,7 @@ module.exports = function (RED)
|
|
|
130
130
|
{
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
if (config.save_state && config.resend_on_start && nodeSettings.active && nodeSettings.lastMessage != null)
|
|
133
|
+
if (config.save_state && config.resend_on_start && nodeSettings.active != null && nodeSettings.lastMessage != null)
|
|
134
134
|
{
|
|
135
135
|
setTimeout(() =>
|
|
136
136
|
{
|
|
@@ -212,18 +212,18 @@ module.exports = function (RED)
|
|
|
212
212
|
{
|
|
213
213
|
if (alarm_active)
|
|
214
214
|
{
|
|
215
|
-
node.status({ fill: "red", shape: "dot", text: "ALARM is active" });
|
|
215
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": ALARM is active" });
|
|
216
216
|
}
|
|
217
217
|
else if (nodeSettings.last_value)
|
|
218
218
|
{
|
|
219
219
|
if (isPermanent || isMotion || current_timeout_ms <= 0)
|
|
220
|
-
node.status({ fill: "green", shape: "dot", text: "On" });
|
|
220
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": On" });
|
|
221
221
|
else if (max_time_on_timeout)
|
|
222
|
-
node.status({ fill: "yellow", shape: "ring", text: "Wait " + helper.formatMsToStatus(current_timeout_ms, "until") + " for auto off" });
|
|
222
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": Wait " + helper.formatMsToStatus(current_timeout_ms, "until") + " for auto off" });
|
|
223
223
|
}
|
|
224
224
|
else
|
|
225
225
|
{
|
|
226
|
-
node.status({ fill: "red", shape: "dot", text: "Off" });
|
|
226
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Off" });
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
|
package/logic/logic.js
CHANGED
|
@@ -153,7 +153,7 @@ module.exports = function (RED)
|
|
|
153
153
|
let result = getResult();
|
|
154
154
|
let resultText = (invert_output ? "!" : "") + result;
|
|
155
155
|
|
|
156
|
-
node.status({ fill: "yellow", shape: "ring", text: "[" + state.join(", ") + "] => " + resultText });
|
|
156
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": [" + state.join(", ") + "] => " + resultText });
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
if (config.save_state && config.resend_on_start && nodeSettings.last_message != null)
|
|
@@ -22,7 +22,7 @@ module.exports = function (RED)
|
|
|
22
22
|
{
|
|
23
23
|
if (msg.payload)
|
|
24
24
|
{
|
|
25
|
-
node.status({ fill: "yellow", shape: "ring", text: "Wait for button release..." });
|
|
25
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": Wait for button release..." });
|
|
26
26
|
on_time = Date.now();
|
|
27
27
|
startAutoLongPress();
|
|
28
28
|
}
|
|
@@ -36,13 +36,13 @@ module.exports = function (RED)
|
|
|
36
36
|
|
|
37
37
|
if (pressTime < long_press_ms)
|
|
38
38
|
{
|
|
39
|
-
node.status({ fill: "green", shape: "dot", text: "Last was short" });
|
|
39
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Last was short" });
|
|
40
40
|
if (short)
|
|
41
41
|
node.send([short, null]);
|
|
42
42
|
}
|
|
43
43
|
else
|
|
44
44
|
{
|
|
45
|
-
node.status({ fill: "green", shape: "dot", text: "Last was long" });
|
|
45
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Last was long" });
|
|
46
46
|
if (long)
|
|
47
47
|
node.send([null, long]);
|
|
48
48
|
}
|
|
@@ -55,7 +55,7 @@ module.exports = function (RED)
|
|
|
55
55
|
max_time_on_timeout = setTimeout(() =>
|
|
56
56
|
{
|
|
57
57
|
on_time = null;
|
|
58
|
-
node.status({ fill: "green", shape: "dot", text: "Last was long" });
|
|
58
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Last was long" });
|
|
59
59
|
node.send([null, long]);
|
|
60
60
|
}, long_press_ms);
|
|
61
61
|
};
|
|
@@ -64,7 +64,6 @@ module.exports = function (RED)
|
|
|
64
64
|
{
|
|
65
65
|
if (max_time_on_timeout != null)
|
|
66
66
|
{
|
|
67
|
-
node.status({});
|
|
68
67
|
clearTimeout(max_time_on_timeout);
|
|
69
68
|
max_time_on_timeout = null;
|
|
70
69
|
}
|
|
@@ -55,7 +55,7 @@ module.exports = function (RED)
|
|
|
55
55
|
|
|
56
56
|
let sendResult = () =>
|
|
57
57
|
{
|
|
58
|
-
node.status({ fill: "green", shape: "dot", text: "Last was press " + count + " time" + (count == 1 ? "" : "s") });
|
|
58
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Last was press " + count + " time" + (count == 1 ? "" : "s") });
|
|
59
59
|
let data = Array.from({ length: config.outputs }).fill(null);
|
|
60
60
|
data[count - 1] = outs[count - 1];
|
|
61
61
|
node.send(data);
|
package/package.json
CHANGED
|
@@ -244,13 +244,13 @@ module.exports = function (RED)
|
|
|
244
244
|
if (scene != 0)
|
|
245
245
|
{
|
|
246
246
|
if (isPermanent || current_timeout_ms <= 0)
|
|
247
|
-
node.status({ fill: "green", shape: "dot", text: "Scene " + scene + " active" });
|
|
247
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Scene " + scene + " active" });
|
|
248
248
|
else if (max_time_on_timeout)
|
|
249
|
-
node.status({ fill: "yellow", shape: "ring", text: "Scene " + scene + " active, wait " + helper.formatMsToStatus(current_timeout_ms, "until") + " for auto off" });
|
|
249
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": Scene " + scene + " active, wait " + helper.formatMsToStatus(current_timeout_ms, "until") + " for auto off" });
|
|
250
250
|
}
|
|
251
251
|
else
|
|
252
252
|
{
|
|
253
|
-
node.status({ fill: "red", shape: "dot", text: "Off" });
|
|
253
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Off" });
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
package/scheduler/scheduler.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = function (RED)
|
|
|
27
27
|
|
|
28
28
|
if (nodeSettings.enabled)
|
|
29
29
|
initTimeouts();
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
setStatus();
|
|
32
32
|
}, 1000);
|
|
33
33
|
|
|
@@ -177,7 +177,7 @@ module.exports = function (RED)
|
|
|
177
177
|
node.status({
|
|
178
178
|
fill: "red",
|
|
179
179
|
shape: "dot",
|
|
180
|
-
text: "Scheduler disabled"
|
|
180
|
+
text: (new Date()).toLocaleString() + ": Scheduler disabled"
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
else if (nextEvents.filter(d => d).lenght == 0)
|
|
@@ -185,7 +185,7 @@ module.exports = function (RED)
|
|
|
185
185
|
node.status({
|
|
186
186
|
fill: "red",
|
|
187
187
|
shape: "dot",
|
|
188
|
-
text: "No events planned"
|
|
188
|
+
text: (new Date()).toLocaleString() + ": No events planned"
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
else
|
|
@@ -198,7 +198,7 @@ module.exports = function (RED)
|
|
|
198
198
|
node.status({
|
|
199
199
|
fill: "yellow",
|
|
200
200
|
shape: "dot",
|
|
201
|
-
text: "Wait " + helper.formatMsToStatus(time, "until") + " to raise next event"
|
|
201
|
+
text: (new Date()).toLocaleString() + ": Wait " + helper.formatMsToStatus(time, "until") + " to raise next event"
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -123,7 +123,7 @@ module.exports = function (RED)
|
|
|
123
123
|
resultUp = true;
|
|
124
124
|
startAutoOff(false, helper.getTimeInMsFromString(msg.time_on) || null);
|
|
125
125
|
if (!alarm_active)
|
|
126
|
-
node.status({ fill: "green", shape: "dot", text: "Up" });
|
|
126
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Up" });
|
|
127
127
|
break;
|
|
128
128
|
|
|
129
129
|
case "stop":
|
|
@@ -141,7 +141,7 @@ module.exports = function (RED)
|
|
|
141
141
|
}
|
|
142
142
|
off_time = Date.now();
|
|
143
143
|
stopAutoOff();
|
|
144
|
-
node.status({ fill: "red", shape: "dot", text: "Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
144
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
145
145
|
break;
|
|
146
146
|
|
|
147
147
|
case "down":
|
|
@@ -164,7 +164,7 @@ module.exports = function (RED)
|
|
|
164
164
|
resultDown = true;
|
|
165
165
|
startAutoOff(true, helper.getTimeInMsFromString(msg.time_on) || null);
|
|
166
166
|
if (!alarm_active)
|
|
167
|
-
node.status({ fill: "green", shape: "dot", text: "Down" });
|
|
167
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Down" });
|
|
168
168
|
break;
|
|
169
169
|
|
|
170
170
|
case "position":
|
|
@@ -188,7 +188,7 @@ module.exports = function (RED)
|
|
|
188
188
|
else
|
|
189
189
|
nodeSettings.last_position = Math.min(100, nodeSettings.last_position + change_percentage);
|
|
190
190
|
|
|
191
|
-
node.status({ fill: "gray", shape: "dot", text: "Update current position to " + nodeSettings.last_position + "%" });
|
|
191
|
+
node.status({ fill: "gray", shape: "dot", text: (new Date()).toLocaleString() + ": Update current position to " + nodeSettings.last_position + "%" });
|
|
192
192
|
|
|
193
193
|
// Runs in the wrong direction at the moment, so stop first
|
|
194
194
|
if (nodeSettings.last_direction_up && value > nodeSettings.last_position)
|
|
@@ -226,7 +226,7 @@ module.exports = function (RED)
|
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
node.status({ fill: "green", shape: "dot", text: "Set position from " + nodeSettings.last_position + "% to " + value + "%" });
|
|
229
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Set position from " + nodeSettings.last_position + "% to " + value + "%" });
|
|
230
230
|
break;
|
|
231
231
|
|
|
232
232
|
case "alarm":
|
|
@@ -234,7 +234,7 @@ module.exports = function (RED)
|
|
|
234
234
|
|
|
235
235
|
if (alarm_active)
|
|
236
236
|
{
|
|
237
|
-
node.status({ fill: "red", shape: "dot", text: "ALARM is active" });
|
|
237
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": ALARM is active" });
|
|
238
238
|
|
|
239
239
|
switch (alarm_action)
|
|
240
240
|
{
|
|
@@ -290,12 +290,12 @@ module.exports = function (RED)
|
|
|
290
290
|
|
|
291
291
|
if (wait_time_ms < 0)
|
|
292
292
|
{
|
|
293
|
-
node.status({ fill: "red", shape: "dot", text: "time_on value has to be greater than 0" });
|
|
293
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": time_on value has to be greater than 0" });
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
if (!alarm_active)
|
|
298
|
-
node.status({ fill: "yellow", shape: "ring", text: (down ? "Down" : "Up") + ", wait " + helper.formatMsToStatus(max_time_on, "until") + " for auto off" });
|
|
298
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": " + (down ? "Down" : "Up") + ", wait " + helper.formatMsToStatus(max_time_on, "until") + " for auto off" });
|
|
299
299
|
|
|
300
300
|
max_time_timeout = setTimeout(() =>
|
|
301
301
|
{
|
|
@@ -312,7 +312,7 @@ module.exports = function (RED)
|
|
|
312
312
|
{
|
|
313
313
|
// console.log("stopAutoOff");
|
|
314
314
|
if (!alarm_active)
|
|
315
|
-
node.status({ fill: "green", shape: "dot", text: "Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
315
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
316
316
|
clearTimeout(max_time_timeout);
|
|
317
317
|
off_time = Date.now();
|
|
318
318
|
max_time_timeout = null;
|
|
@@ -396,7 +396,7 @@ module.exports = function (RED)
|
|
|
396
396
|
setTimeout(() =>
|
|
397
397
|
{
|
|
398
398
|
node.send([{ payload: false }, { payload: false }, { payload: nodeSettings.last_position }]);
|
|
399
|
-
node.status({ fill: "red", shape: "dot", text: "Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
399
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
400
400
|
notifyCentral(false);
|
|
401
401
|
}, 10000);
|
|
402
402
|
}
|
|
@@ -34,7 +34,7 @@ module.exports = function (RED)
|
|
|
34
34
|
}
|
|
35
35
|
RED.events.on(event, handler);
|
|
36
36
|
|
|
37
|
-
node.status({ fill: "red", shape: "dot", text: "Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
37
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped at " + Math.round(nodeSettings.last_position) + "%" });
|
|
38
38
|
|
|
39
39
|
node.on("input", function (msg)
|
|
40
40
|
{
|
|
@@ -94,7 +94,7 @@ module.exports = function (RED)
|
|
|
94
94
|
if (is_running && (msg.payload == 0 || msg.payload == 100))
|
|
95
95
|
is_running = false;
|
|
96
96
|
|
|
97
|
-
node.status({ fill: "yellow", shape: "ring", text: "Position status received: " + msg.payload + "%" });
|
|
97
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": Position status received: " + msg.payload + "%" });
|
|
98
98
|
return;
|
|
99
99
|
|
|
100
100
|
// This is only used to track starting of the shutter
|
|
@@ -103,16 +103,16 @@ module.exports = function (RED)
|
|
|
103
103
|
is_running = true;
|
|
104
104
|
|
|
105
105
|
if (nodeSettings.last_direction_up)
|
|
106
|
-
node.status({ fill: "green", shape: "dot", text: "Up" });
|
|
106
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Up" });
|
|
107
107
|
else
|
|
108
|
-
node.status({ fill: "green", shape: "dot", text: "Down" });
|
|
108
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Down" });
|
|
109
109
|
return;
|
|
110
110
|
|
|
111
111
|
case "up":
|
|
112
112
|
nodeSettings.last_direction_up = true;
|
|
113
113
|
is_running = true;
|
|
114
114
|
resultUpDown = false;
|
|
115
|
-
node.status({ fill: "green", shape: "dot", text: "Up" });
|
|
115
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Up" });
|
|
116
116
|
startAutoOffIfNeeded(msg);
|
|
117
117
|
break;
|
|
118
118
|
|
|
@@ -120,14 +120,14 @@ module.exports = function (RED)
|
|
|
120
120
|
is_running = false;
|
|
121
121
|
resultStop = true;
|
|
122
122
|
stopAutoOff();
|
|
123
|
-
node.status({ fill: "green", shape: "dot", text: "Stopped" });
|
|
123
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped" });
|
|
124
124
|
break;
|
|
125
125
|
|
|
126
126
|
case "down":
|
|
127
127
|
nodeSettings.last_direction_up = false;
|
|
128
128
|
is_running = true;
|
|
129
129
|
resultUpDown = true;
|
|
130
|
-
node.status({ fill: "green", shape: "dot", text: "Down" });
|
|
130
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Down" });
|
|
131
131
|
startAutoOffIfNeeded(msg);
|
|
132
132
|
break;
|
|
133
133
|
|
|
@@ -138,7 +138,7 @@ module.exports = function (RED)
|
|
|
138
138
|
if (value > 100) value = 100;
|
|
139
139
|
// is_running = true; // Not guaranteed that the shutter starts running.
|
|
140
140
|
resultPosition = value;
|
|
141
|
-
node.status({ fill: "green", shape: "dot", text: "Set position to " + value + "%" });
|
|
141
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Set position to " + value + "%" });
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -166,23 +166,23 @@ module.exports = function (RED)
|
|
|
166
166
|
let timeMs = helper.getTimeInMsFromString(msg.time_on);
|
|
167
167
|
if (isNaN(timeMs))
|
|
168
168
|
{
|
|
169
|
-
node.status({ fill: "red", shape: "dot", text: "Invalid time_on value send: " + msg.time_on });
|
|
169
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": Invalid time_on value send: " + msg.time_on });
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
if (timeMs <= 0)
|
|
174
174
|
{
|
|
175
|
-
node.status({ fill: "red", shape: "dot", text: "time_on value has to be greater than 0" });
|
|
175
|
+
node.status({ fill: "red", shape: "dot", text: (new Date()).toLocaleString() + ": time_on value has to be greater than 0" });
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
// Stop if any timeout is set
|
|
180
180
|
stopAutoOff();
|
|
181
181
|
|
|
182
|
-
node.status({ fill: "yellow", shape: "ring", text: "Wait " + (timeMs / 1000).toFixed(1) + " sec for auto off" });
|
|
182
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": Wait " + (timeMs / 1000).toFixed(1) + " sec for auto off" });
|
|
183
183
|
max_time_on_timeout = setTimeout(() =>
|
|
184
184
|
{
|
|
185
|
-
node.status({ fill: "green", shape: "dot", text: "Stopped" });
|
|
185
|
+
node.status({ fill: "green", shape: "dot", text: (new Date()).toLocaleString() + ": Stopped" });
|
|
186
186
|
is_running = false;
|
|
187
187
|
node.send([null, { payload: true }, null]);
|
|
188
188
|
notifyCentral(false);
|
package/statistic/statistic.js
CHANGED
|
@@ -176,9 +176,9 @@ module.exports = function (RED)
|
|
|
176
176
|
return;
|
|
177
177
|
|
|
178
178
|
if (operation === "ABS")
|
|
179
|
-
node.status({ fill: "yellow", shape: "ring", text: operation + " => " + msg.payload });
|
|
179
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": " + operation + " => " + msg.payload });
|
|
180
180
|
else
|
|
181
|
-
node.status({ fill: "yellow", shape: "ring", text: operation + "(" + Object.entries(nodeSettings.values).map(v => v[1]).join(",") + ") => " + msg.payload });
|
|
181
|
+
node.status({ fill: "yellow", shape: "ring", text: (new Date()).toLocaleString() + ": " + operation + "(" + Object.entries(nodeSettings.values).map(v => v[1]).join(",") + ") => " + msg.payload });
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
if (config.save_state && config.resend_on_start && nodeSettings.lastMessage != null)
|