smart-nodes 0.7.2 → 0.7.3

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
@@ -266,3 +266,7 @@
266
266
 
267
267
  - Shutter complex node is adding a 5 seconds longer time for actions up and down, to really get to the end.
268
268
  - Text exec node now understands blink and toggle for light nodes.
269
+
270
+ ## Version 0.7.3:
271
+
272
+ - Added blink to scene node.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-nodes",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Controls light, shutters and more. Includes common used logic and statistic nodes to control your home.",
5
5
  "keywords": [
6
6
  "node-red",
@@ -67,6 +67,13 @@
67
67
  Sollten bereits alle Ausgänge ausgeschaltet sein, werden alle eingeschalten.
68
68
  </td>
69
69
  </tr>
70
+ <tr>
71
+ <td><code>blink</code></td>
72
+ <td>
73
+ Schaltet die Ausgänge kurz um, ohne die laufende Zeitmessung zu unterbrechen. Dies kann genutzt werden, um visuelles Feedback zu geben.<br/>
74
+ Die Standardzeit beträgt 0,5 Sekunden und kann mit <code>msg.time_on</code> überschrieben werden.
75
+ </td>
76
+ </tr>
70
77
  </tbody>
71
78
  </table>
72
79
  </p>
@@ -69,6 +69,13 @@
69
69
  If all outputs are already switched off, all are switched on.
70
70
  </td>
71
71
  </tr>
72
+ <tr>
73
+ <td><code>blink</code></td>
74
+ <td>
75
+ Toggles the outputs briefly without interrupting the ongoing time measurement. This can be used to provide visual feedback for a specific action.<br/>
76
+ The default time is 0.5 seconds, but can be overridden using <code>msg.time_on</code>.
77
+ </td>
78
+ </tr>
72
79
  </tbody>
73
80
  </table>
74
81
  </p>
package/scene/scene.js CHANGED
@@ -55,6 +55,8 @@ module.exports = function (RED)
55
55
  // Also if the motion sensor turns off, no timeout is started.
56
56
  let isPermanent = false;
57
57
 
58
+ // If this is on, ignore all state changes while blinking
59
+ let isBlinking = false;
58
60
 
59
61
  // Here the date is stored, when the light should go off.
60
62
  // This is used to calculate the node status.
@@ -122,6 +124,10 @@ module.exports = function (RED)
122
124
  break;
123
125
 
124
126
  case "status":
127
+ // Ignore if it is in blinking mode
128
+ if (isBlinking)
129
+ return;
130
+
125
131
  // Make sure it is bool
126
132
  msg.payload = helper.toBool(msg.payload);
127
133
  node_settings.last_values[number] = msg.payload;
@@ -209,6 +215,28 @@ module.exports = function (RED)
209
215
 
210
216
  node_settings.last_values = new Array(config.outputs).fill(currentScene == 0);
211
217
  break;
218
+
219
+ case "blink":
220
+ // If already blinking, ignore
221
+ if (isBlinking)
222
+ return;
223
+
224
+ isBlinking = true;
225
+
226
+ // Send inverted values briefly
227
+ const inverted = node_settings.last_values.map(v => !v);
228
+ node.send(inverted.map(val => { return { payload: val }; }));
229
+ setStatus();
230
+
231
+ setTimeout(() =>
232
+ {
233
+ isBlinking = false;
234
+ // Restore original values
235
+ node.send(node_settings.last_values.map(val => { return { payload: val }; }));
236
+ setStatus();
237
+ }, helper.getTimeInMsFromString(msg.time_on, 500));
238
+
239
+ return;
212
240
  }
213
241
 
214
242
  stopAutoOff();