smart-nodes 0.4.2 → 0.4.4

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
@@ -90,3 +90,11 @@
90
90
 
91
91
  - Fixed design of property page of forwarder node.
92
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.
package/delay/delay.js CHANGED
@@ -156,16 +156,16 @@ module.exports = function (RED)
156
156
  if (timeout != null)
157
157
  {
158
158
  // current delay runs already for the same payload, so don't start a new one.
159
- if (next_payload == msg.payload)
159
+ if ((next_payload ?? node_settings.last_message?.payload) == msg.payload)
160
160
  return;
161
161
 
162
162
  // payload changed back to last value => stop current delay
163
163
  if (node_settings.last_message?.payload == msg.payload)
164
164
  {
165
+ next_payload = null;
165
166
  node.status({ fill: "yellow", shape: "dot", text: helper.getCurrentTimeForStatus() + ": " + "Stopped delayed message" });
166
167
  clearTimeout(timeout);
167
168
  timeout = null;
168
-
169
169
  return;
170
170
  }
171
171
  }
@@ -187,6 +187,7 @@ module.exports = function (RED)
187
187
  // No delay if 0 or smaller
188
188
  if (delay_ms <= 0)
189
189
  {
190
+ next_payload = null;
190
191
  node.status({ fill: "yellow", shape: "dot", text: helper.getCurrentTimeForStatus() + ": " + "Sended " + getMessageStatusText(msg) });
191
192
  node_settings.last_message = helper.cloneObject(msg);
192
193
 
@@ -196,9 +197,12 @@ module.exports = function (RED)
196
197
 
197
198
  // start new timeout
198
199
  node.status({ fill: "yellow", shape: "ring", text: helper.getCurrentTimeForStatus() + ": " + "Forward " + getMessageStatusText(msg) + " in " + helper.formatMsToStatus(delay_ms, "at") });
200
+ next_payload = msg.payload;
199
201
  timeout = setTimeout(() =>
200
202
  {
201
203
  timeout = null;
204
+ next_payload = null;
205
+
202
206
  node.status({ fill: "yellow", shape: "dot", text: helper.getCurrentTimeForStatus() + ": " + "Sended " + getMessageStatusText(msg) });
203
207
  node_settings.last_message = helper.cloneObject(msg);
204
208
 
@@ -206,6 +210,7 @@ module.exports = function (RED)
206
210
 
207
211
  if (config.save_state)
208
212
  smart_context.set(node.id, node_settings);
213
+
209
214
  }, delay_ms);
210
215
  }
211
216
 
@@ -124,6 +124,18 @@
124
124
  this.out_lower_type = "NOTHING";
125
125
  $("#node-input-out_lower_type").val("NOTHING");
126
126
  }
127
+
128
+ if (this.out_higher_type == "original")
129
+ {
130
+ this.out_higher_type = "ORIGINAL";
131
+ $("#node-input-out_higher_type").val("ORIGINAL");
132
+ }
133
+
134
+ if (this.out_lower_type == "original")
135
+ {
136
+ this.out_lower_type = "ORIGINAL";
137
+ $("#node-input-out_lower_type").val("ORIGINAL");
138
+ }
127
139
  },
128
140
  oneditsave: function ()
129
141
  {
@@ -180,7 +180,7 @@ module.exports = function (RED)
180
180
 
181
181
  let createMessage = (out_msg, out_type, msg, value) =>
182
182
  {
183
- return helper.cloneObject(out_type == "NOTHING" ? msg : out_msg, {
183
+ return helper.cloneObject(out_type == "ORIGINAL" ? msg : out_msg, {
184
184
  smart_info: {
185
185
  last_result: node_settings.last_result,
186
186
  hysteresis: node_settings.hysteresis,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-nodes",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Smart Nodes",
5
5
  "keywords": [
6
6
  "node-red",