smart-nodes 0.4.14 → 0.4.15

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 CHANGED
@@ -1,142 +1,146 @@
1
- # Changelog
2
-
3
- ## Version 0.3.28:
4
-
5
- - Added this changlog file.
6
- - Separate values for shutter_complex node for up and down times.
7
- (Open each node and save it, to use the new times. This should be done before the version 0.4.0 is released.)
8
- - For the following nodes you can choose to have one or two outputs (Could be a **breaking change**, please check your nodes).
9
-
10
- - Logic
11
- - Compare
12
- - Hysteresis
13
-
14
- - You can now separately declare the messages that should be sent by the following nodes (Could be a **breaking change**, please check your nodes).
15
-
16
- - Logic
17
- - Compare
18
- - Hysteresis
19
-
20
- - You can choose for the following nodes if they should send the result all the time or only if the result changed.
21
- - Logic
22
- - Compare
23
- - Hysteresis
24
-
25
- ## Version 0.3.29:
26
-
27
- - Fixed that hysteresis sends only on change, when separate outputs are enabled.
28
- - Added a definable short up/down time for the shutter control.
29
- - Fixed calculation of the time from string.
30
-
31
- ## Version 0.3.30:
32
-
33
- - Added counter example.
34
-
35
- ## Version 0.3.31:
36
-
37
- - Fixed logic node - invert output option.
38
-
39
- ## Version 0.3.32:
40
-
41
- - Fixed hysteresis node - always change result.
42
-
43
- ## Version 0.3.33:
44
-
45
- - Fixed hysteresis node - init send.
46
-
47
- ## Version 0.3.34:
48
-
49
- - Fixed hysteresis node - init send.
50
- - Fixed light node - status.
51
-
52
- ## Version 0.3.35:
53
-
54
- - Fixed saving last message object as a clone of the original message, because it could be changed later.
55
-
56
- ## Version 0.3.36:
57
-
58
- - Fixed mixing-valve - call of toFixed function.
59
-
60
- ## Version 0.3.37:
61
-
62
- - Fixed using typedInput with node-red v4.
63
- - Started to add English translations.
64
-
65
- ## Version 0.4.0:
66
-
67
- - Fully added English and German translations.
68
- - Light control: Added Alarm off action
69
- - Shutter complex control: Added Alarm off action
70
- - Restructured the complete code
71
- - Improved status texts
72
- - **breaking change** (soon): Changed some node internal values. Please open and save the following node types:
73
-
74
- - Central node
75
- - Compare node
76
- - Counter node
77
- - Hysteresis node
78
- - Shutter complex node
79
- - Statistic node
80
-
81
- After saving the nodes, the values are automatically converted to the new one.
82
- This conversion will be removed in version 0.5.0.
83
-
84
- ## Version 0.4.1:
85
-
86
- - Show only up to 2 decimal places in node status text.
87
- - Improved warn messages shown in console.
88
-
89
- ## Version 0.4.2:
90
-
91
- - Fixed design of property page of forwarder node.
92
- - Corrected hysteresis to send original message.
93
-
94
- ## Version 0.4.3:
95
-
96
- - Corrected hysteresis (again) to send original message.
97
-
98
- ## Version 0.4.4:
99
-
100
- - Fixed the delay node to not restart the time if "only on change" option is enabled.
101
-
102
- ## Version 0.4.5:
103
-
104
- - Fixed the status of hysteresis node.
105
-
106
- ## Version 0.4.6:
107
-
108
- - Fixed the status of hysteresis node.
109
-
110
- ## Version 0.4.7:
111
-
112
- - Added blink topic to light node.
113
-
114
- ## Version 0.4.8:
115
-
116
- - Fixed reading values in heating-curve node.
117
-
118
- ## Version 0.4.9:
119
-
120
- - Fixed reading config values for offset and slope in heating-curve node.
121
-
122
- ## Version 0.4.10:
123
-
124
- - **breaking change** (soon): Added common and separate outputs to multi press node.
125
- Please open node config and save it to make sure it will work in later versions.
126
- - Added common and separate outputs to long press node.
127
-
128
- ## Version 0.4.11:
129
-
130
- - Fixed long press default outputs.
131
-
132
- ## Version 0.4.12:
133
-
134
- - Fixed text exec node.
135
-
136
- ## Version 0.4.13:
137
-
138
- - Fixed text exec node again.
139
-
140
- ## Version 0.4.14:
141
-
142
- - Removed log outputs.
1
+ # Changelog
2
+
3
+ ## Version 0.3.28:
4
+
5
+ - Added this changlog file.
6
+ - Separate values for shutter_complex node for up and down times.
7
+ (Open each node and save it, to use the new times. This should be done before the version 0.4.0 is released.)
8
+ - For the following nodes you can choose to have one or two outputs (Could be a **breaking change**, please check your nodes).
9
+
10
+ - Logic
11
+ - Compare
12
+ - Hysteresis
13
+
14
+ - You can now separately declare the messages that should be sent by the following nodes (Could be a **breaking change**, please check your nodes).
15
+
16
+ - Logic
17
+ - Compare
18
+ - Hysteresis
19
+
20
+ - You can choose for the following nodes if they should send the result all the time or only if the result changed.
21
+ - Logic
22
+ - Compare
23
+ - Hysteresis
24
+
25
+ ## Version 0.3.29:
26
+
27
+ - Fixed that hysteresis sends only on change, when separate outputs are enabled.
28
+ - Added a definable short up/down time for the shutter control.
29
+ - Fixed calculation of the time from string.
30
+
31
+ ## Version 0.3.30:
32
+
33
+ - Added counter example.
34
+
35
+ ## Version 0.3.31:
36
+
37
+ - Fixed logic node - invert output option.
38
+
39
+ ## Version 0.3.32:
40
+
41
+ - Fixed hysteresis node - always change result.
42
+
43
+ ## Version 0.3.33:
44
+
45
+ - Fixed hysteresis node - init send.
46
+
47
+ ## Version 0.3.34:
48
+
49
+ - Fixed hysteresis node - init send.
50
+ - Fixed light node - status.
51
+
52
+ ## Version 0.3.35:
53
+
54
+ - Fixed saving last message object as a clone of the original message, because it could be changed later.
55
+
56
+ ## Version 0.3.36:
57
+
58
+ - Fixed mixing-valve - call of toFixed function.
59
+
60
+ ## Version 0.3.37:
61
+
62
+ - Fixed using typedInput with node-red v4.
63
+ - Started to add English translations.
64
+
65
+ ## Version 0.4.0:
66
+
67
+ - Fully added English and German translations.
68
+ - Light control: Added Alarm off action
69
+ - Shutter complex control: Added Alarm off action
70
+ - Restructured the complete code
71
+ - Improved status texts
72
+ - **breaking change** (soon): Changed some node internal values. Please open and save the following node types:
73
+
74
+ - Central node
75
+ - Compare node
76
+ - Counter node
77
+ - Hysteresis node
78
+ - Shutter complex node
79
+ - Statistic node
80
+
81
+ After saving the nodes, the values are automatically converted to the new one.
82
+ This conversion will be removed in version 0.5.0.
83
+
84
+ ## Version 0.4.1:
85
+
86
+ - Show only up to 2 decimal places in node status text.
87
+ - Improved warn messages shown in console.
88
+
89
+ ## Version 0.4.2:
90
+
91
+ - Fixed design of property page of forwarder node.
92
+ - Corrected hysteresis to send original message.
93
+
94
+ ## Version 0.4.3:
95
+
96
+ - Corrected hysteresis (again) to send original message.
97
+
98
+ ## Version 0.4.4:
99
+
100
+ - Fixed the delay node to not restart the time if "only on change" option is enabled.
101
+
102
+ ## Version 0.4.5:
103
+
104
+ - Fixed the status of hysteresis node.
105
+
106
+ ## Version 0.4.6:
107
+
108
+ - Fixed the status of hysteresis node.
109
+
110
+ ## Version 0.4.7:
111
+
112
+ - Added blink topic to light node.
113
+
114
+ ## Version 0.4.8:
115
+
116
+ - Fixed reading values in heating-curve node.
117
+
118
+ ## Version 0.4.9:
119
+
120
+ - Fixed reading config values for offset and slope in heating-curve node.
121
+
122
+ ## Version 0.4.10:
123
+
124
+ - **breaking change** (soon): Added common and separate outputs to multi press node.
125
+ Please open node config and save it to make sure it will work in later versions.
126
+ - Added common and separate outputs to long press node.
127
+
128
+ ## Version 0.4.11:
129
+
130
+ - Fixed long press default outputs.
131
+
132
+ ## Version 0.4.12:
133
+
134
+ - Fixed text exec node.
135
+
136
+ ## Version 0.4.13:
137
+
138
+ - Fixed text exec node again.
139
+
140
+ ## Version 0.4.14:
141
+
142
+ - Removed log outputs.
143
+
144
+ ## Version 0.4.15:
145
+
146
+ - Reverted some tests.
package/light/light.html CHANGED
@@ -139,6 +139,7 @@
139
139
  defaults: {
140
140
  name: { value: "" },
141
141
  exec_text_names: { value: "" },
142
+ data_type: { value: "SIMPLE" }, // SIMPLE || HOMEASSISTANT
142
143
  max_time_on: { value: "0" },
143
144
  max_time_on_unit: { value: "s" },
144
145
  alarm_action: { value: 'NOTHING' }, // NOTHING | ON | OFF
@@ -159,6 +160,19 @@
159
160
  onEditPrepare(this, ["smart_central-control"]);
160
161
  initTreeList(node, ["smart_central-control"]);
161
162
 
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
+
162
176
  $("#node-input-max_time_on")
163
177
  .css("max-width", "4rem")
164
178
  .spinner({
@@ -237,6 +251,10 @@
237
251
  <input id="node-input-exec_text_names" type="text" />
238
252
  <div style="max-width: 450px;" data-i18n="light.ui.controlled_by_words"></div>
239
253
  </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>
240
258
  <div class="form-row">
241
259
  <label for="node-input-max_time_on"><i class="fa fa-clock-o"></i> <span data-i18n="light.ui.max_time_on"></span></label>
242
260
  <input id="node-input-max_time_on" value="0" />
package/light/light.js CHANGED
@@ -45,6 +45,7 @@ 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";
48
49
 
49
50
  // ##################
50
51
  // # Runtime values #
@@ -230,7 +231,7 @@ module.exports = function (RED)
230
231
  if (!node_settings.alarm_active)
231
232
  {
232
233
  isBlinking = true;
233
- node.send({ payload: !node_settings.last_value });
234
+ sendState(!node_settings.last_value)
234
235
  setStatus();
235
236
  setTimeout(
236
237
  () =>
@@ -238,7 +239,7 @@ module.exports = function (RED)
238
239
  isBlinking = false;
239
240
  if (!node_settings.alarm_active)
240
241
  {
241
- node.send({ payload: node_settings.last_value });
242
+ sendState(node_settings.last_value)
242
243
  setStatus();
243
244
  }
244
245
  },
@@ -283,7 +284,7 @@ module.exports = function (RED)
283
284
  }
284
285
 
285
286
  if (node_settings.alarm_active || helper.getTopicName(msg.topic) != "status")
286
- node.send({ payload: node_settings.last_value });
287
+ sendState(node_settings.last_value)
287
288
 
288
289
  // Output is on, now
289
290
  if (node_settings.last_value && doRestartTimer)
@@ -326,7 +327,7 @@ module.exports = function (RED)
326
327
  {
327
328
  timeout = null;
328
329
  node_settings.last_value = false;
329
- node.send({ payload: false });
330
+ sendTurnOff();
330
331
  notifyCentral(false);
331
332
 
332
333
  setStatus();
@@ -372,6 +373,67 @@ module.exports = function (RED)
372
373
  }
373
374
  }
374
375
 
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
+
375
437
  /**
376
438
  * Notify all connected central nodes
377
439
  * @param {boolean} state The state if the light is on
@@ -1,24 +1,29 @@
1
- {
2
- "light": {
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
- "max_time_on": "Max Zeit Ein",
8
- "alarm_on": "Alarm Ein",
9
- "alarm_off": "Alarm Aus",
10
- "controlled_by_central": "Dieser Baustein wird von folgenden Zentralbausteinen gesteuert:",
11
-
12
- "milliseconds": "Millisekunden",
13
- "seconds": "Sekunden",
14
- "minutes": "Minuten",
15
- "hours": "Stunden",
16
-
17
- "no_action": "Keine Aktion",
18
- "turn_on": "Einschalten",
19
- "turn_off": "Ausschalten",
20
- "last_state": "Letzen Zustand",
21
- "last_sended_state": "Zuletzt gesendeten Zustand"
22
- }
23
- }
24
- }
1
+ {
2
+ "light": {
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
+
8
+ "data_type": "Datentyp",
9
+ "simple": "Einfaches Format",
10
+ "home_assistant": "HA Action Format",
11
+
12
+ "max_time_on": "Max Zeit Ein",
13
+ "alarm_on": "Alarm Ein",
14
+ "alarm_off": "Alarm Aus",
15
+ "controlled_by_central": "Dieser Baustein wird von folgenden Zentralbausteinen gesteuert:",
16
+
17
+ "milliseconds": "Millisekunden",
18
+ "seconds": "Sekunden",
19
+ "minutes": "Minuten",
20
+ "hours": "Stunden",
21
+
22
+ "no_action": "Keine Aktion",
23
+ "turn_on": "Einschalten",
24
+ "turn_off": "Ausschalten",
25
+ "last_state": "Letzen Zustand",
26
+ "last_sended_state": "Zuletzt gesendeten Zustand"
27
+ }
28
+ }
29
+ }
@@ -1,24 +1,29 @@
1
- {
2
- "light": {
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
- "max_time_on": "Max time on",
8
- "alarm_on": "Alarm on",
9
- "alarm_off": "Alarm off",
10
- "controlled_by_central": "This block is controlled by the following central blocks:",
11
-
12
- "milliseconds": "Milliseconds",
13
- "seconds": "Seconds",
14
- "minutes": "Minutes",
15
- "hours": "Hours",
16
-
17
- "no_action": "No action",
18
- "turn_on": "Turn on",
19
- "turn_off": "Turn off",
20
- "last_state": "Last state",
21
- "last_sended_state": "Last sent state"
22
- }
23
- }
24
- }
1
+ {
2
+ "light": {
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
+
8
+ "data_type": "Data type",
9
+ "simple": "Simple format",
10
+ "home_assistant": "HA Action format",
11
+
12
+ "max_time_on": "Max time on",
13
+ "alarm_on": "Alarm on",
14
+ "alarm_off": "Alarm off",
15
+ "controlled_by_central": "This block is controlled by the following central blocks:",
16
+
17
+ "milliseconds": "Milliseconds",
18
+ "seconds": "Seconds",
19
+ "minutes": "Minutes",
20
+ "hours": "Hours",
21
+
22
+ "no_action": "No action",
23
+ "turn_on": "Turn on",
24
+ "turn_off": "Turn off",
25
+ "last_state": "Last state",
26
+ "last_sended_state": "Last sent state"
27
+ }
28
+ }
29
+ }
@@ -1,12 +1,12 @@
1
- <script type="text/html" data-help-name="smart_logic">
2
- <p>Dieser Knoten bietet verschiedene Logikoperationen, wie AND, OR und XOR an.</p>
3
- <p>Alle Eingänge, sowie der Ausgang lassen sich gezielt invertieren, womit weitere komplexe Logiken abgebildet werden können.</p>
4
- <p>Um beispielsweise eine NOT Logik zu erstellen, wird die Anzahl der Eingänge auf 1 gesetzt, die Logik auf AND oder OR und der Ausgang invertiert.</p>
5
- <p>
6
- <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/>
7
- Diese Node verwendet nur den Teil <code>nummer</code>. <code>name</code> und <code>#</code> sind dabei optional.
8
- </p>
9
- <p>
10
- <strong>Hinweis:</strong> <code>msg.payload</code> wird automatisch auf das Logik-Ergebnis gesetzt, sofern es nicht bereits in der Konfiguration gesetzt wurde.
11
- </p>
1
+ <script type="text/html" data-help-name="smart_logic">
2
+ <p>Dieser Knoten bietet verschiedene Logikoperationen, wie AND, OR und XOR an.</p>
3
+ <p>Alle Eingänge, sowie der Ausgang lassen sich gezielt invertieren, womit weitere komplexe Logiken abgebildet werden können.</p>
4
+ <p>Um beispielsweise eine NOT Logik zu erstellen, wird die Anzahl der Eingänge auf 1 gesetzt, die Logik auf AND oder OR und der Ausgang invertiert.</p>
5
+ <p>
6
+ <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/>
7
+ Diese Node verwendet nur den Teil <code>nummer</code>. <code>name</code> und <code>#</code> sind dabei optional.
8
+ </p>
9
+ <p>
10
+ <strong>Hinweis:</strong> <code>msg.payload</code> wird automatisch auf das Logik-Ergebnis gesetzt, sofern es nicht bereits in der Konfiguration gesetzt wurde.
11
+ </p>
12
12
  </script>
@@ -1,27 +1,27 @@
1
- {
2
- "logic": {
3
- "ui": {
4
- "name": "Name",
5
- "logic": "Logik",
6
- "inputs": "Eingänge",
7
- "invert": "Invertieren",
8
- "output": "Ausgang",
9
- "output_messages": "Ausgangsnachrichten",
10
- "true": "Wahr",
11
- "false": "Falsch",
12
- "send": "Senden",
13
- "outputs": "Ausgänge",
14
- "note": "Hinweis:",
15
- "note_text": "<code>msg.payload</code> wird automatisch auf das Logik-Ergebnis gesetzt,<br/>sofern es nicht bereits hier in der Konfiguration gesetzt wurde.",
16
- "system_start": "Systemstart",
17
- "save_state": "Zustand speichern",
18
- "send_after_start": "Letze Nachricht 10 Sekunden nach dem Start senden",
19
-
20
- "send_nothing": "Nichts senden",
21
- "send_only_change": "Nur bei Änderung",
22
- "always": "Immer",
23
- "common_output": "Gemeinsamer Ausgang",
24
- "separate_output": "Separate Ausgänge"
25
- }
26
- }
27
- }
1
+ {
2
+ "logic": {
3
+ "ui": {
4
+ "name": "Name",
5
+ "logic": "Logik",
6
+ "inputs": "Eingänge",
7
+ "invert": "Invertieren",
8
+ "output": "Ausgang",
9
+ "output_messages": "Ausgangsnachrichten",
10
+ "true": "Wahr",
11
+ "false": "Falsch",
12
+ "send": "Senden",
13
+ "outputs": "Ausgänge",
14
+ "note": "Hinweis:",
15
+ "note_text": "<code>msg.payload</code> wird automatisch auf das Logik-Ergebnis gesetzt,<br/>sofern es nicht bereits hier in der Konfiguration gesetzt wurde.",
16
+ "system_start": "Systemstart",
17
+ "save_state": "Zustand speichern",
18
+ "send_after_start": "Letze Nachricht 10 Sekunden nach dem Start senden",
19
+
20
+ "send_nothing": "Nichts senden",
21
+ "send_only_change": "Nur bei Änderung",
22
+ "always": "Immer",
23
+ "common_output": "Gemeinsamer Ausgang",
24
+ "separate_output": "Separate Ausgänge"
25
+ }
26
+ }
27
+ }
@@ -1,12 +1,12 @@
1
- <script type="text/html" data-help-name="smart_logic">
2
- <p>This node offers various logic operations, such as AND, OR and XOR.</p>
3
- <p>All inputs and the output can be specifically inverted, which can be used to map further complex logic.</p>
4
- <p>For example, to create a NOT logic, the number of inputs is set to 1, the logic to AND or OR and the output is inverted.</p>
5
- <p>
6
- <b>Note:</b> Smart Nodes use topics in the format <code>name#number</code>, so that different Smart Nodes can be controlled with the same topic.<br />
7
- This node only uses the <code>number</code> part. <code>name</code> and <code>#</code> are optional.
8
- </p>
9
- <p>
10
- <strong>Note:</strong> <code>msg.payload</code> is automatically set to the logic result if it has not already been set in the configuration.
11
- </p>
1
+ <script type="text/html" data-help-name="smart_logic">
2
+ <p>This node offers various logic operations, such as AND, OR and XOR.</p>
3
+ <p>All inputs and the output can be specifically inverted, which can be used to map further complex logic.</p>
4
+ <p>For example, to create a NOT logic, the number of inputs is set to 1, the logic to AND or OR and the output is inverted.</p>
5
+ <p>
6
+ <b>Note:</b> Smart Nodes use topics in the format <code>name#number</code>, so that different Smart Nodes can be controlled with the same topic.<br />
7
+ This node only uses the <code>number</code> part. <code>name</code> and <code>#</code> are optional.
8
+ </p>
9
+ <p>
10
+ <strong>Note:</strong> <code>msg.payload</code> is automatically set to the logic result if it has not already been set in the configuration.
11
+ </p>
12
12
  </script>