node-red-contrib-3dm-space 1.0.2 → 1.0.5
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/3dm-cloud-config.html +35 -73
- package/3dm-cloud-config.js +826 -123
- package/3dm-config-store.html +206 -236
- package/3dm-config-store.js +900 -883
- package/README.md +4 -4
- package/package.json +2 -2
- package/node-red-contrib-3dm-space-1.0.0.tgz +0 -0
package/3dm-config-store.html
CHANGED
|
@@ -1,236 +1,206 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
</
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
</
|
|
177
|
-
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</p>
|
|
208
|
-
|
|
209
|
-
<pre>output1
|
|
210
|
-
output2
|
|
211
|
-
output3</pre>
|
|
212
|
-
|
|
213
|
-
<p>
|
|
214
|
-
If multiple schedule/control entries use the same output, they are combined using OR logic.
|
|
215
|
-
If any entry wants the output ON, the final output is ON.
|
|
216
|
-
</p>
|
|
217
|
-
|
|
218
|
-
<h3>Local Storage</h3>
|
|
219
|
-
|
|
220
|
-
<p>
|
|
221
|
-
Config is saved locally on the gateway. If Node-RED restarts, the last saved config is loaded again.
|
|
222
|
-
</p>
|
|
223
|
-
|
|
224
|
-
<h3>Output Mode</h3>
|
|
225
|
-
|
|
226
|
-
<ul>
|
|
227
|
-
<li><b>Only when output changes</b>: sends an output only when the final state changes.</li>
|
|
228
|
-
<li><b>Every check</b>: sends outputs every check cycle.</li>
|
|
229
|
-
</ul>
|
|
230
|
-
|
|
231
|
-
<h3>Config Output</h3>
|
|
232
|
-
|
|
233
|
-
<p>
|
|
234
|
-
Optional. Select an output if you want the full stored config sent out as a message.
|
|
235
|
-
</p>
|
|
236
|
-
</script>
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
(function () {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
function clampOutputs(value) {
|
|
6
|
+
var n = parseInt(value, 10);
|
|
7
|
+
|
|
8
|
+
if (isNaN(n)) {
|
|
9
|
+
n = 24;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return Math.max(1, Math.min(n, 24));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function populateConfigOutputOptions(maxOutputs, currentValue) {
|
|
16
|
+
var select = $("#node-input-configOutput");
|
|
17
|
+
var current = parseInt(currentValue, 10);
|
|
18
|
+
|
|
19
|
+
if (isNaN(current)) {
|
|
20
|
+
current = 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
select.empty();
|
|
24
|
+
|
|
25
|
+
select.append(
|
|
26
|
+
$("<option></option>")
|
|
27
|
+
.attr("value", "0")
|
|
28
|
+
.text("Disabled")
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
for (var i = 1; i <= maxOutputs; i += 1) {
|
|
32
|
+
select.append(
|
|
33
|
+
$("<option></option>")
|
|
34
|
+
.attr("value", String(i))
|
|
35
|
+
.text("Output " + i)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (current > maxOutputs) {
|
|
40
|
+
current = 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
select.val(String(current));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
RED.nodes.registerType("3dm-config-store", {
|
|
47
|
+
category: "3DM.space",
|
|
48
|
+
color: "#6D6D6D",
|
|
49
|
+
defaults: {
|
|
50
|
+
name: { value: "" },
|
|
51
|
+
configName: { value: "" },
|
|
52
|
+
outputs: {
|
|
53
|
+
value: 24,
|
|
54
|
+
validate: function (v) {
|
|
55
|
+
var n = Number(v);
|
|
56
|
+
return !isNaN(n) && n >= 1 && n <= 24;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
tickSeconds: {
|
|
60
|
+
value: 20,
|
|
61
|
+
validate: function (v) {
|
|
62
|
+
var n = Number(v);
|
|
63
|
+
return !isNaN(n) && n >= 1 && n <= 60;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
outputMode: { value: "change" },
|
|
67
|
+
configOutput: { value: 0 },
|
|
68
|
+
emitConfigOnUpdate: { value: false }
|
|
69
|
+
},
|
|
70
|
+
inputs: 1,
|
|
71
|
+
outputs: 24,
|
|
72
|
+
icon: "font-awesome/fa-database",
|
|
73
|
+
label: function () {
|
|
74
|
+
return this.name || "3DM config store";
|
|
75
|
+
},
|
|
76
|
+
paletteLabel: "3DM config store",
|
|
77
|
+
outputLabels: function (index) {
|
|
78
|
+
return "Output " + (index + 1);
|
|
79
|
+
},
|
|
80
|
+
oneditprepare: function () {
|
|
81
|
+
var outputCount = clampOutputs(this.outputs || 24);
|
|
82
|
+
|
|
83
|
+
$("#node-input-outputs").val(outputCount);
|
|
84
|
+
populateConfigOutputOptions(outputCount, this.configOutput || 0);
|
|
85
|
+
|
|
86
|
+
$("#node-input-outputs").on("input change", function () {
|
|
87
|
+
var count = clampOutputs($(this).val());
|
|
88
|
+
populateConfigOutputOptions(count, $("#node-input-configOutput").val());
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
oneditsave: function () {
|
|
92
|
+
var outputCount = clampOutputs($("#node-input-outputs").val());
|
|
93
|
+
var configOutput = parseInt($("#node-input-configOutput").val(), 10);
|
|
94
|
+
|
|
95
|
+
this.outputs = outputCount;
|
|
96
|
+
|
|
97
|
+
if (isNaN(configOutput) || configOutput > outputCount) {
|
|
98
|
+
this.configOutput = 0;
|
|
99
|
+
$("#node-input-configOutput").val("0");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
})();
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<script type="text/html" data-template-name="3dm-config-store">
|
|
107
|
+
<div class="form-row">
|
|
108
|
+
<label for="node-input-name">
|
|
109
|
+
<i class="fa fa-tag"></i> Node Name
|
|
110
|
+
</label>
|
|
111
|
+
<input type="text" id="node-input-name" placeholder="Optional, e.g. Pump Config Store">
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div class="form-row">
|
|
115
|
+
<label for="node-input-configName">
|
|
116
|
+
<i class="fa fa-folder-open"></i> Config Name
|
|
117
|
+
</label>
|
|
118
|
+
<input type="text" id="node-input-configName" placeholder="Optional, e.g. b1">
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="form-row">
|
|
122
|
+
<label for="node-input-outputs">
|
|
123
|
+
<i class="fa fa-random"></i> Active Outputs
|
|
124
|
+
</label>
|
|
125
|
+
<input type="number" id="node-input-outputs" min="1" max="24" placeholder="24" style="width:100px;">
|
|
126
|
+
<span> outputs</span>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div class="form-row">
|
|
130
|
+
<label for="node-input-tickSeconds">
|
|
131
|
+
<i class="fa fa-clock-o"></i> Check Every
|
|
132
|
+
</label>
|
|
133
|
+
<input type="number" id="node-input-tickSeconds" min="1" max="60" placeholder="20" style="width:100px;">
|
|
134
|
+
<span> seconds</span>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class="form-row">
|
|
138
|
+
<label for="node-input-outputMode">
|
|
139
|
+
<i class="fa fa-sign-out"></i> Output Mode
|
|
140
|
+
</label>
|
|
141
|
+
<select id="node-input-outputMode" style="width:70%;">
|
|
142
|
+
<option value="change">Only when output changes</option>
|
|
143
|
+
<option value="always">Every check</option>
|
|
144
|
+
</select>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div class="form-row">
|
|
148
|
+
<label for="node-input-configOutput">
|
|
149
|
+
<i class="fa fa-share-square-o"></i> Config Output
|
|
150
|
+
</label>
|
|
151
|
+
<select id="node-input-configOutput" style="width:70%;"></select>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="form-row">
|
|
155
|
+
<label for="node-input-emitConfigOnUpdate">
|
|
156
|
+
<i class="fa fa-refresh"></i> Send Config
|
|
157
|
+
</label>
|
|
158
|
+
<input type="checkbox" id="node-input-emitConfigOnUpdate" style="display:inline-block; width:auto; vertical-align:top;">
|
|
159
|
+
<span> send stored config when updated</span>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div class="form-tips">
|
|
163
|
+
<b>Tip:</b> Leave Config Name blank to allow this node to store and use all config blocks sent under <code>configStore</code>.
|
|
164
|
+
</div>
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<script type="text/html" data-help-name="3dm-config-store">
|
|
168
|
+
<p>
|
|
169
|
+
Stores configuration sent from 3DM.space and runs local schedule/control logic.
|
|
170
|
+
</p>
|
|
171
|
+
|
|
172
|
+
<p>
|
|
173
|
+
This node is normally placed after a <b>3DM In</b> node.
|
|
174
|
+
</p>
|
|
175
|
+
|
|
176
|
+
<pre>3DM In → 3DM Config Store → active outputs</pre>
|
|
177
|
+
|
|
178
|
+
<h3>Config Name</h3>
|
|
179
|
+
|
|
180
|
+
<p>
|
|
181
|
+
Leave <b>Config Name</b> blank to allow all config blocks.
|
|
182
|
+
</p>
|
|
183
|
+
|
|
184
|
+
<p>
|
|
185
|
+
Enter a name such as <code>b1</code> if this node should only use one matching config block.
|
|
186
|
+
</p>
|
|
187
|
+
|
|
188
|
+
<h3>Active Outputs</h3>
|
|
189
|
+
|
|
190
|
+
<p>
|
|
191
|
+
Sets how many outputs are visible on the node. The node supports 1 to 24 outputs.
|
|
192
|
+
</p>
|
|
193
|
+
|
|
194
|
+
<h3>Output Mode</h3>
|
|
195
|
+
|
|
196
|
+
<ul>
|
|
197
|
+
<li><b>Only when output changes</b>: sends an output only when the final state changes.</li>
|
|
198
|
+
<li><b>Every check</b>: sends outputs every check cycle.</li>
|
|
199
|
+
</ul>
|
|
200
|
+
|
|
201
|
+
<h3>Config Output</h3>
|
|
202
|
+
|
|
203
|
+
<p>
|
|
204
|
+
Optional. Select an active output if you want the full stored config sent out as a message.
|
|
205
|
+
</p>
|
|
206
|
+
</script>
|