smart-nodes 0.4.15 → 0.4.16

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.md CHANGED
@@ -1,21 +1,21 @@
1
- # The MIT License (MIT)
2
-
3
- Copyright (c) 2024 BergenSoft
4
-
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:
11
- >
12
- > The above copyright notice and this permission notice shall be included in
13
- > all 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
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 BergenSoft
4
+
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:
11
+ >
12
+ > The above copyright notice and this permission notice shall be included in
13
+ > all 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
21
21
  > THE SOFTWARE.
package/light/light.html CHANGED
@@ -139,7 +139,6 @@
139
139
  defaults: {
140
140
  name: { value: "" },
141
141
  exec_text_names: { value: "" },
142
- data_type: { value: "SIMPLE" }, // SIMPLE || HOMEASSISTANT
143
142
  max_time_on: { value: "0" },
144
143
  max_time_on_unit: { value: "s" },
145
144
  alarm_action: { value: 'NOTHING' }, // NOTHING | ON | OFF
@@ -160,19 +159,6 @@
160
159
  onEditPrepare(this, ["smart_central-control"]);
161
160
  initTreeList(node, ["smart_central-control"]);
162
161
 
163
- $("#node-input-data_type")
164
- .css("max-width", "70%")
165
- .typedInput({
166
- types: [{
167
- value: "data_type",
168
- default: "SIMPLE",
169
- options: [
170
- { value: "SIMPLE", label: node._("light.ui.simple") },
171
- { value: "HOMEASSISTANT", label: node._("light.ui.home_assistant") }
172
- ],
173
- }],
174
- });
175
-
176
162
  $("#node-input-max_time_on")
177
163
  .css("max-width", "4rem")
178
164
  .spinner({
@@ -251,10 +237,6 @@
251
237
  <input id="node-input-exec_text_names" type="text" />
252
238
  <div style="max-width: 450px;" data-i18n="light.ui.controlled_by_words"></div>
253
239
  </div>
254
- <div class="form-row">
255
- <label for="node-input-data_type"><i class="fa fa-file-code-o"></i> <span data-i18n="light.ui.data_type"></span></label>
256
- <input id="node-input-data_type"/>
257
- </div>
258
240
  <div class="form-row">
259
241
  <label for="node-input-max_time_on"><i class="fa fa-clock-o"></i> <span data-i18n="light.ui.max_time_on"></span></label>
260
242
  <input id="node-input-max_time_on" value="0" />
package/light/light.js CHANGED
@@ -45,7 +45,6 @@ module.exports = function (RED)
45
45
  let max_time_on = helper.getTimeInMs(config.max_time_on, config.max_time_on_unit);
46
46
  let alarm_action = config.alarm_action || "NOTHING";
47
47
  let alarm_off_action = config.alarm_off_action || "NOTHING";
48
- let data_type = config.data_type || "SIMPLE";
49
48
 
50
49
  // ##################
51
50
  // # Runtime values #
@@ -231,7 +230,7 @@ module.exports = function (RED)
231
230
  if (!node_settings.alarm_active)
232
231
  {
233
232
  isBlinking = true;
234
- sendState(!node_settings.last_value)
233
+ node.send({ payload: !node_settings.last_value });
235
234
  setStatus();
236
235
  setTimeout(
237
236
  () =>
@@ -239,7 +238,7 @@ module.exports = function (RED)
239
238
  isBlinking = false;
240
239
  if (!node_settings.alarm_active)
241
240
  {
242
- sendState(node_settings.last_value)
241
+ node.send({ payload: node_settings.last_value });
243
242
  setStatus();
244
243
  }
245
244
  },
@@ -284,7 +283,7 @@ module.exports = function (RED)
284
283
  }
285
284
 
286
285
  if (node_settings.alarm_active || helper.getTopicName(msg.topic) != "status")
287
- sendState(node_settings.last_value)
286
+ node.send({ payload: node_settings.last_value });
288
287
 
289
288
  // Output is on, now
290
289
  if (node_settings.last_value && doRestartTimer)
@@ -327,7 +326,7 @@ module.exports = function (RED)
327
326
  {
328
327
  timeout = null;
329
328
  node_settings.last_value = false;
330
- sendTurnOff();
329
+ node.send({ payload: false });
331
330
  notifyCentral(false);
332
331
 
333
332
  setStatus();
@@ -373,67 +372,6 @@ module.exports = function (RED)
373
372
  }
374
373
  }
375
374
 
376
- /**
377
- * Turns the output to the given state and returns the sent message
378
- * @param {bool} state The new state of the output
379
- * @returns The sent message
380
- */
381
- let sendState = state =>
382
- {
383
- if (state)
384
- return sendTurnOn();
385
-
386
- return sendTurnOff();
387
- }
388
-
389
- /**
390
- * Turns the output on and returns the sent message
391
- * @returns The sent message
392
- */
393
- let sendTurnOn = () =>
394
- {
395
- let data = null;
396
- switch (data_type)
397
- {
398
- case "SIMPLE":
399
- data = { payload: true };
400
- break;
401
-
402
- case "HOMEASSISTANT":
403
- data = { payload: { action: "homeassistant.turn_on" } };
404
- break;
405
-
406
- default:
407
- return null;
408
- }
409
- node.send(data);
410
- return data;
411
- }
412
-
413
- /**
414
- * Turns the output off and returns the sent message
415
- * @returns The sent message
416
- */
417
- let sendTurnOff = () =>
418
- {
419
- let data = null;
420
- switch (data_type)
421
- {
422
- case "SIMPLE":
423
- data = { payload: false };
424
- break;
425
-
426
- case "HOMEASSISTANT":
427
- data = { payload: { action: "homeassistant.turn_off" } };
428
- break;
429
-
430
- default:
431
- return null;
432
- }
433
- node.send(data);
434
- return data;
435
- }
436
-
437
375
  /**
438
376
  * Notify all connected central nodes
439
377
  * @param {boolean} state The state if the light is on
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "Diese Node kann über die eingegebenen Wörter gesteuert werden. Mehrere Wörter werden durch ein Komma getrennt.",
7
-
8
- "data_type": "Datentyp",
9
- "simple": "Einfaches Format",
10
- "home_assistant": "HA Action Format",
11
-
12
7
  "max_time_on": "Max Zeit Ein",
13
8
  "alarm_on": "Alarm Ein",
14
9
  "alarm_off": "Alarm Aus",
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "This node can be controlled using the words entered. Multiple words are separated by a comma.",
7
-
8
- "data_type": "Data type",
9
- "simple": "Simple format",
10
- "home_assistant": "HA Action format",
11
-
12
7
  "max_time_on": "Max time on",
13
8
  "alarm_on": "Alarm on",
14
9
  "alarm_off": "Alarm off",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-nodes",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Smart Nodes",
5
5
  "keywords": [
6
6
  "node-red",
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "Diese Node kann über die eingegebenen Wörter gesteuert werden. Mehrere Wörter werden durch ein Komma getrennt.",
7
-
8
- "data_type": "Datentyp",
9
- "simple": "Einfaches Format",
10
- "home_assistant": "HA Action Format",
11
-
12
7
  "time_on": "Zeit Ein",
13
8
  "controlled_by_central": "Dieser Baustein wird von folgenden Zentralbausteinen gesteuert:",
14
9
 
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "This node can be controlled using the words entered. Multiple words are separated by a comma.",
7
-
8
- "data_type": "Data type",
9
- "simple": "Simple format",
10
- "home_assistant": "HA Action format",
11
-
12
7
  "time_on": "Time On",
13
8
  "controlled_by_central": "This block is controlled by the following central blocks:",
14
9
 
package/scene/scene.html CHANGED
@@ -144,7 +144,7 @@
144
144
  $("#node-input-property-outputs").editableList("height", outputHeight);
145
145
 
146
146
  // links tree list
147
- var rows = $("#dialog-form>div:not(#smart-control-scenes)");
147
+ var rows = $("#dialog-form>div:not(#light-control-scenes)");
148
148
  var height = $("#dialog-form").height();
149
149
  for (var i = 0; i < rows.length; i++)
150
150
  {
@@ -219,7 +219,6 @@
219
219
  defaults: {
220
220
  name: { value: "" },
221
221
  exec_text_names: { value: "" },
222
- data_type: { value: "SIMPLE" }, // SIMPLE || HOMEASSISTANT
223
222
  max_time_on: { value: "0" },
224
223
  max_time_on_unit: { value: "s" },
225
224
  outputs: { value: 1 },
@@ -248,19 +247,6 @@
248
247
  onEditPrepare(this, ["smart_central-control"]);
249
248
  initTreeList(node, ["smart_central-control"]);
250
249
 
251
- $("#node-input-data_type")
252
- .css("max-width", "70%")
253
- .typedInput({
254
- types: [{
255
- value: "data_type",
256
- default: "SIMPLE",
257
- options: [
258
- { value: "SIMPLE", label: node._("scene.ui.simple") },
259
- { value: "HOMEASSISTANT", label: node._("scene.ui.home_assistant") }
260
- ],
261
- }],
262
- });
263
-
264
250
  // Output list
265
251
  var outputList = $("#node-input-property-outputs").css("min-height", "120px").css("min-width", "445px");
266
252
 
@@ -469,17 +455,13 @@
469
455
  <input id="node-input-exec_text_names" type="text" />
470
456
  <div style="max-width: 450px;" data-i18n="scene.ui.controlled_by_words"></div>
471
457
  </div>
472
- <div class="form-row">
473
- <label for="node-input-data_type"><i class="fa fa-file-code-o"></i> <span data-i18n="scene.ui.data_type"></span></label>
474
- <input id="node-input-data_type"/>
475
- </div>
476
458
  <div class="form-row">
477
459
  <label for="node-input-max_time_on"><i class="fa fa-clock-o"></i> <span data-i18n="scene.ui.time_on"></span></label>
478
460
  <input id="node-input-max_time_on" value="0" />
479
461
  <input id="node-input-max_time_on_unit" />
480
462
  </div>
481
463
 
482
- <div id="smart-control-scenes">
464
+ <div id="light-control-scenes">
483
465
  <div class="form-row scene-tabs-row">
484
466
  <ul style="min-width: 600px; margin-bottom: 20px;" id="scene-tabs"></ul>
485
467
  </div>
package/scene/scene.js CHANGED
@@ -41,8 +41,6 @@ module.exports = function (RED)
41
41
  // # Dynamic config #
42
42
  // ##################
43
43
  let max_time_on = helper.getTimeInMs(config.max_time_on, config.max_time_on_unit);
44
- let data_type = config.data_type || "SIMPLE";
45
-
46
44
 
47
45
  // ##################
48
46
  // # Runtime values #
@@ -205,7 +203,7 @@ module.exports = function (RED)
205
203
 
206
204
  stopAutoOff();
207
205
 
208
- sendStates(node_settings.last_values);
206
+ node.send(node_settings.last_values.map(val => { return { payload: val }; }));
209
207
  notifyCentral();
210
208
  }
211
209
 
@@ -274,7 +272,7 @@ module.exports = function (RED)
274
272
  {
275
273
  timeout = null;
276
274
  node_settings.last_values = new Array(config.outputs).fill(false);
277
- sendStates(node_settings.last_values);
275
+ node.send(node_settings.last_values.map(val => { return { payload: val }; }));
278
276
  notifyCentral();
279
277
 
280
278
  setStatus();
@@ -307,31 +305,6 @@ module.exports = function (RED)
307
305
  }
308
306
  }
309
307
 
310
- /**
311
- * Turns the outputs to the given states and returns the sent messages
312
- * @param {bool[]} states The new states of the outputs
313
- * @returns The sent messages
314
- */
315
- let sendStates = states =>
316
- {
317
- let data = null;
318
- switch (data_type)
319
- {
320
- case "SIMPLE":
321
- data = states.map(val => { return { payload: val }; });
322
- break;
323
-
324
- case "HOMEASSISTANT":
325
- data = states.map(val => { return { payload: { action: val ? "homeassistant.turn_on" : "homeassistant.turn_off" } }; });
326
- break;
327
-
328
- default:
329
- return null;
330
- }
331
- node.send(data);
332
- return data;
333
- }
334
-
335
308
  let notifyCentral = () =>
336
309
  {
337
310
  if (!config.links)
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "Diese Node kann über die eingegebenen Wörter gesteuert werden. Mehrere Wörter werden durch ein Komma getrennt.",
7
-
8
- "data_type": "Datentyp",
9
- "simple": "Einfaches Format",
10
- "home_assistant": "HA Action Format",
11
-
12
7
  "time_short": "Zeit kurz",
13
8
  "controlled_by_central": "Dieser Baustein wird von folgenden Zentralbausteinen gesteuert:"
14
9
  }
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "This node can be controlled using the words entered. Multiple words are separated by a comma.",
7
-
8
- "data_type": "Data type",
9
- "simple": "Simple format",
10
- "home_assistant": "HA Action format",
11
-
12
7
  "time_short": "Time short",
13
8
  "controlled_by_central": "This module is controlled by the following central modules:"
14
9
  }
@@ -139,20 +139,12 @@
139
139
  defaults: {
140
140
  name: { value: "" },
141
141
  exec_text_names: { value: "" },
142
- data_type: { value: "SIMPLE" }, // SIMPLE || HOMEASSISTANT
143
- outputs: { value: 3 },
144
142
  short_time_on_ms: { value: 200 },
145
143
  links: { value: [], type: "smart_central-control[]" }
146
144
  },
147
145
  inputs: 1,
148
146
  outputs: 3,
149
- outputLabels: function (index)
150
- {
151
- if (this.data_type == "SIMPLE")
152
- return ["Up/Down", "Stop", "Position"][index];
153
-
154
- return "HA Shutter";
155
- },
147
+ outputLabels: ["Up/Down", "Stop", "Position"],
156
148
  icon: "font-awesome/fa-align-justify",
157
149
  label: function ()
158
150
  {
@@ -165,22 +157,6 @@
165
157
  onEditPrepare(this, ["smart_central-control"]);
166
158
  initTreeList(node, ["smart_central-control"]);
167
159
 
168
- $("#node-input-data_type")
169
- .css("max-width", "70%")
170
- .typedInput({
171
- types: [{
172
- value: "data_type",
173
- default: "SIMPLE",
174
- options: [
175
- { value: "SIMPLE", label: node._("shutter.ui.simple") },
176
- { value: "HOMEASSISTANT", label: node._("shutter.ui.home_assistant") }
177
- ],
178
- }],
179
- }).on("change", function (event, type, value)
180
- {
181
- node.outputs = value == "SIMPLE" ? 3 : 1;
182
- });
183
-
184
160
  $("#node-input-short_time_on_ms")
185
161
  .css("max-width", "4rem")
186
162
  .spinner({
@@ -215,10 +191,6 @@
215
191
  <input id="node-input-exec_text_names" type="text" />
216
192
  <div style="max-width: 450px;" data-i18n="shutter.ui.controlled_by_words"></div>
217
193
  </div>
218
- <div class="form-row">
219
- <label for="node-input-data_type"><i class="fa fa-file-code-o"></i> <span data-i18n="shutter.ui.data_type"></span></label>
220
- <input id="node-input-data_type"/>
221
- </div>
222
194
  <div class="form-row">
223
195
  <label for="node-input-short_time_on_ms"><i class="fa fa-clock-o"></i> <span data-i18n="shutter.ui.time_short"></span></label>
224
196
  <input id="node-input-short_time_on_ms" placeholder="200" /> ms
@@ -41,7 +41,6 @@ module.exports = function (RED)
41
41
  // # Dynamic config #
42
42
  // ##################
43
43
  let short_time_on_ms = parseInt(config.short_time_on_ms || 200, 10);
44
- let data_type = config.data_type || "SIMPLE";
45
44
 
46
45
 
47
46
  // ##################
@@ -180,17 +179,17 @@ module.exports = function (RED)
180
179
 
181
180
  if (resultUpDown != null)
182
181
  {
183
- sendDirection(resultUpDown);
182
+ node.send([{ payload: resultUpDown }, null, null]);
184
183
  notifyCentral(true);
185
184
  }
186
185
  else if (resultStop != null)
187
186
  {
188
- sendStop();
187
+ node.send([null, { payload: resultStop }, null]);
189
188
  notifyCentral(false);
190
189
  }
191
190
  else if (resultPosition != null)
192
191
  {
193
- sendPosition(cover.set_cover_position);
192
+ node.send([null, null, { payload: resultPosition }]);
194
193
  }
195
194
  };
196
195
 
@@ -219,7 +218,7 @@ module.exports = function (RED)
219
218
  is_running = false;
220
219
  timeout = null;
221
220
 
222
- sendStop();
221
+ node.send([null, { payload: true }, null]);
223
222
  notifyCentral(false);
224
223
 
225
224
  smart_context.set(node.id, node_settings);
@@ -239,6 +238,7 @@ module.exports = function (RED)
239
238
  timeout = null;
240
239
  }
241
240
  };
241
+
242
242
  /**
243
243
  * Set the current node status
244
244
  */
@@ -262,118 +262,6 @@ module.exports = function (RED)
262
262
  node.status({ fill, shape, text: helper.getCurrentTimeForStatus() + ": " + texts.join(", ") });
263
263
  }
264
264
 
265
- /**
266
- * Turns the shutter to the given direction and returns the sent message
267
- * @param {bool} down True if down, else up
268
- * @returns The sent message
269
- */
270
- let sendDirection = down =>
271
- {
272
- if (down)
273
- return sendTurnDown();
274
-
275
- return sendTurnUp();
276
- }
277
-
278
- /**
279
- * Turns the shutter up and returns the sent message
280
- * @returns The sent message
281
- */
282
- let sendTurnUp = () =>
283
- {
284
- let data = null;
285
- switch (data_type)
286
- {
287
- case "SIMPLE":
288
- data = [{ payload: false }, null, null];
289
- break;
290
-
291
- case "HOMEASSISTANT":
292
- data = { payload: { action: "cover.open_cover" } };
293
- break;
294
-
295
- default:
296
- return null;
297
- }
298
- node.send(data);
299
- return data;
300
- }
301
-
302
- /**
303
- * Turns the shutter down and returns the sent message
304
- * @returns The sent message
305
- */
306
- let sendTurnDown = () =>
307
- {
308
- let data = null;
309
- switch (data_type)
310
- {
311
- case "SIMPLE":
312
- data = [{ payload: true }, null, null];
313
- break;
314
-
315
- case "HOMEASSISTANT":
316
- data = { payload: { action: "cover.close_cover" } };
317
- break;
318
-
319
- default:
320
- return null;
321
- }
322
- node.send(data);
323
- return data;
324
- }
325
-
326
- /**
327
- * Stops the shutter and returns the sent message
328
- * @returns The sent message
329
- */
330
- let sendStop = () =>
331
- {
332
- let data = null;
333
- switch (data_type)
334
- {
335
- case "SIMPLE":
336
- data = [null, { payload: true }, null];
337
- break;
338
-
339
- case "HOMEASSISTANT":
340
- data = { payload: { action: "cover.stop_cover" } };
341
- break;
342
-
343
- default:
344
- return null;
345
- }
346
- node.send(data);
347
- return data;
348
- }
349
-
350
- /**
351
- * Turns the shutter to the given position and returns the sent message
352
- * @returns The sent message
353
- */
354
- let sendPosition = position =>
355
- {
356
- let data = null;
357
- switch (data_type)
358
- {
359
- case "SIMPLE":
360
- data = [null, null, { payload: position }];
361
- break;
362
-
363
- case "HOMEASSISTANT":
364
- // In Simple, 0% is open
365
- // In HomeAssistant 100% is open
366
- data = { payload: { action: "cover.set_cover_position", data: { position: 100 - position } } };
367
- break;
368
-
369
- default:
370
- return null;
371
- }
372
- node.send(data);
373
- return data;
374
- }
375
-
376
-
377
265
  /**
378
266
  * Notify all connected central nodes
379
267
  * @param {boolean} state The state if the shutter is running
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "Diese Node kann über die eingegebenen Wörter gesteuert werden. Mehrere Wörter werden durch ein Komma getrennt.",
7
-
8
- "data_type": "Datentyp",
9
- "simple": "Einfaches Format",
10
- "home_assistant": "HA Action Format",
11
-
12
7
  "time_up": "Zeit auf",
13
8
  "time_down": "Zeit ab",
14
9
  "pause_change": "Pause Wechsel",
@@ -4,11 +4,6 @@
4
4
  "name": "Name",
5
5
  "text": "Text",
6
6
  "controlled_by_words": "This node can be controlled using the words entered. Multiple words are separated by a comma.",
7
-
8
- "data_type": "Data type",
9
- "simple": "Simple format",
10
- "home_assistant": "HA Action format",
11
-
12
7
  "time_up": "Time up",
13
8
  "time_down": "Time down",
14
9
  "pause_change": "Pause change",
@@ -139,7 +139,6 @@
139
139
  defaults: {
140
140
  name: { value: "" },
141
141
  exec_text_names: { value: "" },
142
- data_type: { value: "SIMPLE" }, // SIMPLE || HOMEASSISTANT
143
142
  max_time: { value: 60 },
144
143
  max_time_up: { value: 60 },
145
144
  max_time_down: { value: 60 },
@@ -150,13 +149,7 @@
150
149
  },
151
150
  inputs: 1,
152
151
  outputs: 3,
153
- outputLabels: function (index)
154
- {
155
- if (this.data_type == "SIMPLE")
156
- return ["Up", "Down", "Status Position"][index];
157
-
158
- return ["HA Up", "HA Down", "HA Status Position"][index];
159
- },
152
+ outputLabels: ["Up", "Down", "Status Position"],
160
153
  icon: "font-awesome/fa-align-justify",
161
154
  label: function ()
162
155
  {
@@ -169,19 +162,6 @@
169
162
  onEditPrepare(this, ["smart_central-control"]);
170
163
  initTreeList(node, ["smart_central-control"]);
171
164
 
172
- $("#node-input-data_type")
173
- .css("max-width", "70%")
174
- .typedInput({
175
- types: [{
176
- value: "data_type",
177
- default: "SIMPLE",
178
- options: [
179
- { value: "SIMPLE", label: node._("shutter.ui.simple") },
180
- { value: "HOMEASSISTANT", label: node._("shutter.ui.home_assistant") }
181
- ],
182
- }],
183
- });
184
-
185
165
  $("#node-input-max_time_up")
186
166
  .css("max-width", "4rem")
187
167
  .spinner({
@@ -285,10 +265,6 @@
285
265
  <input id="node-input-exec_text_names" type="text" />
286
266
  <div style="max-width: 450px;" data-i18n="shutter.ui.controlled_by_words"></div>
287
267
  </div>
288
- <div class="form-row">
289
- <label for="node-input-data_type"><i class="fa fa-file-code-o"></i> <span data-i18n="shutter.ui.data_type"></span></label>
290
- <input id="node-input-data_type"/>
291
- </div>
292
268
  <div class="form-row">
293
269
  <label for="node-input-max_time_up"><i class="fa fa-clock-o"></i> <span data-i18n="shutter.ui.time_up"></span></label>
294
270
  <input id="node-input-max_time_up" placeholder="Komplette Fahrt auf" /> s
@@ -61,7 +61,6 @@ module.exports = function (RED)
61
61
  let revert_time_ms = parseInt(config.revert_time_ms || 100, 10);
62
62
  let alarm_action = config.alarm_action || "NOTHING";
63
63
  let alarm_off_action = config.alarm_off_action || "NOTHING";
64
- let data_type = config.data_type || "SIMPLE";
65
64
 
66
65
 
67
66
  // ##################
@@ -485,10 +484,7 @@ module.exports = function (RED)
485
484
  else if (down)
486
485
  node_settings.last_direction_up = false;
487
486
 
488
- if (up || down)
489
- sendDirection(down);
490
- else
491
- sendStop()
487
+ node.send([{ payload: up }, { payload: down }, { payload: node_settings.last_position }]);
492
488
 
493
489
  // Inform central nodes that shutter is running/stopped
494
490
  notifyCentral(up || down);
@@ -545,117 +541,6 @@ module.exports = function (RED)
545
541
  node.status({ fill, shape, text: helper.getCurrentTimeForStatus() + ": " + texts.join(", ") });
546
542
  }
547
543
 
548
- /**
549
- * Turns the shutter to the given direction and returns the sent message
550
- * @param {bool} down True if down, else up
551
- * @returns The sent message
552
- */
553
- let sendDirection = down =>
554
- {
555
- if (down)
556
- return sendTurnDown();
557
-
558
- return sendTurnUp();
559
- }
560
-
561
- /**
562
- * Turns the shutter up and returns the sent message
563
- * @returns The sent message
564
- */
565
- let sendTurnUp = () =>
566
- {
567
- let data = null;
568
- switch (data_type)
569
- {
570
- case "SIMPLE":
571
- data = [{ payload: true }, { payload: false }, { payload: node_settings.last_position }];
572
- break;
573
-
574
- case "HOMEASSISTANT":
575
- data = [{ payload: { action: "homeassistant.turn_on" } }, { payload: { action: "homeassistant.turn_off" } }, { payload: { action: "number.set_value", data: { "value": node_settings.last_position } } }];
576
- break;
577
-
578
- default:
579
- return null;
580
- }
581
- node.send(data);
582
- return data;
583
- }
584
-
585
- /**
586
- * Turns the shutter down and returns the sent message
587
- * @returns The sent message
588
- */
589
- let sendTurnDown = () =>
590
- {
591
- let data = null;
592
- switch (data_type)
593
- {
594
- case "SIMPLE":
595
- data = [{ payload: false }, { payload: true }, { payload: node_settings.last_position }];
596
- break;
597
-
598
- case "HOMEASSISTANT":
599
- data = [{ payload: { action: "homeassistant.turn_off" } }, { payload: { action: "homeassistant.turn_on" } }, { payload: { action: "number.set_value", data: { "value": node_settings.last_position } } }];
600
- break;
601
-
602
- default:
603
- return null;
604
- }
605
- node.send(data);
606
- return data;
607
- }
608
-
609
- /**
610
- * Stops the shutter and returns the sent message
611
- * @returns The sent message
612
- */
613
- let sendStop = () =>
614
- {
615
- let data = null;
616
- switch (data_type)
617
- {
618
- case "SIMPLE":
619
- data = [null, { payload: true }, null];
620
- break;
621
-
622
- case "HOMEASSISTANT":
623
- data = [{ payload: { action: "homeassistant.turn_off" } }, { payload: { action: "homeassistant.turn_off" } }, { payload: { action: "number.set_value", data: { "value": node_settings.last_position } } }];
624
- break;
625
-
626
- default:
627
- return null;
628
- }
629
- node.send(data);
630
- return data;
631
- }
632
-
633
- /**
634
- * Sets the current position state of the shutter to the given value and returns the sent message
635
- * @param {int} position The current position in percent
636
- * @returns The sent message
637
- */
638
- let sendPositionState = position =>
639
- {
640
- let data = null;
641
- switch (data_type)
642
- {
643
- case "SIMPLE":
644
- data = [null, null, { payload: position }];
645
- break;
646
-
647
- case "HOMEASSISTANT":
648
- data = [null, null, { payload: { action: "number.set_value", data: { "value": node_settings.last_position } } }];
649
- break;
650
-
651
- default:
652
- return null;
653
- }
654
- node.send(data);
655
- return data;
656
- }
657
-
658
-
659
544
  /**
660
545
  * Notify all connected central nodes
661
546
  * @param {boolean} state The state if the shutter is running