smart-nodes 0.6.5 → 0.6.6
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 +5 -0
- package/counter/counter.html +4 -0
- package/counter/counter.js +12 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -242,3 +242,8 @@
|
|
|
242
242
|
## Version 0.6.5:
|
|
243
243
|
|
|
244
244
|
- Fixed light alarm mode, when status changed to an invalid.
|
|
245
|
+
|
|
246
|
+
## Version 0.6.6:
|
|
247
|
+
|
|
248
|
+
- Counter can be configured in 0.1 steps. For smaller steps, use msg.payload value.
|
|
249
|
+
- Counter has a new topic refresh, to resend the last saved value.
|
package/counter/counter.html
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
$("#node-input-start")
|
|
30
30
|
.css("max-width", "4rem")
|
|
31
31
|
.spinner({
|
|
32
|
+
step: 0.1,
|
|
32
33
|
change: function (event, ui)
|
|
33
34
|
{
|
|
34
35
|
var value = parseFloat(this.value);
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
$("#node-input-step")
|
|
41
42
|
.css("max-width", "4rem")
|
|
42
43
|
.spinner({
|
|
44
|
+
step: 0.1,
|
|
43
45
|
change: function (event, ui)
|
|
44
46
|
{
|
|
45
47
|
var value = parseFloat(this.value);
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
$("#node-input-min")
|
|
52
54
|
.css("max-width", "4rem")
|
|
53
55
|
.spinner({
|
|
56
|
+
step: 0.1,
|
|
54
57
|
change: function (event, ui)
|
|
55
58
|
{
|
|
56
59
|
var value = parseFloat(this.value);
|
|
@@ -62,6 +65,7 @@
|
|
|
62
65
|
$("#node-input-max")
|
|
63
66
|
.css("max-width", "4rem")
|
|
64
67
|
.spinner({
|
|
68
|
+
step: 0.1,
|
|
65
69
|
change: function (event, ui)
|
|
66
70
|
{
|
|
67
71
|
var value = parseFloat(this.value);
|
package/counter/counter.js
CHANGED
|
@@ -37,10 +37,10 @@ module.exports = function (RED)
|
|
|
37
37
|
// ##################
|
|
38
38
|
// # Dynamic config #
|
|
39
39
|
// ##################
|
|
40
|
-
let start =
|
|
41
|
-
let step =
|
|
42
|
-
let min =
|
|
43
|
-
let max =
|
|
40
|
+
let start = parseFloat(config.start);
|
|
41
|
+
let step = parseFloat(config.step);
|
|
42
|
+
let min = parseFloat(config.min);
|
|
43
|
+
let max = parseFloat(config.max);
|
|
44
44
|
let out_message = helper.evaluateNodeProperty(RED, config.out_message, config.out_message_type);
|
|
45
45
|
|
|
46
46
|
|
|
@@ -53,9 +53,8 @@ module.exports = function (RED)
|
|
|
53
53
|
{
|
|
54
54
|
handleTopic(msg);
|
|
55
55
|
|
|
56
|
-
sendResult();
|
|
57
|
-
|
|
58
56
|
setStatus();
|
|
57
|
+
|
|
59
58
|
smart_context.set(node.id, node_settings);
|
|
60
59
|
});
|
|
61
60
|
|
|
@@ -121,7 +120,11 @@ module.exports = function (RED)
|
|
|
121
120
|
|
|
122
121
|
node_settings.value = temp_value;
|
|
123
122
|
break;
|
|
124
|
-
|
|
123
|
+
|
|
124
|
+
case "refresh":
|
|
125
|
+
// Nothing to do, just resend the last message if value is set
|
|
126
|
+
break;
|
|
127
|
+
|
|
125
128
|
default:
|
|
126
129
|
node.error("Invalid topic: " + real_topic);
|
|
127
130
|
return;
|
|
@@ -129,15 +132,9 @@ module.exports = function (RED)
|
|
|
129
132
|
|
|
130
133
|
// Check value is in range
|
|
131
134
|
node_settings.value = Math.min(max, Math.max(min, node_settings.value));
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Send the result to the output
|
|
136
|
-
*/
|
|
137
|
-
let sendResult = () =>
|
|
138
|
-
{
|
|
135
|
+
|
|
139
136
|
// Nothing changed, nothing to do
|
|
140
|
-
if (node_settings.value == node_settings.last_message?.payload)
|
|
137
|
+
if (real_topic != "refresh" && node_settings.value == node_settings.last_message?.payload)
|
|
141
138
|
return;
|
|
142
139
|
|
|
143
140
|
// if out_message is set, use this instead of the default message
|