Hi all
I was failing to use the range node in a dynamic way.
After investigation I figured out even in the newes version there is no possibility to use it dynamic.
I even saw no feature request but several questions and answers to exact this topic.
Now I wrote a patch for myself on the actual master version to enable the dynamic option on this node. And fingered out this is quite useful at leas for me.
You maybe include this if it is in your style for coding or implement it in a more clean way.
See patch below.
With this patch you can specify bye side of the payload:
minin
minout
maxin
and maxout.
They overwrite the config only for the call when specified.
(Master version of node-red is 2.1.3)
diff --git a/packages/node_modules/@node-red/nodes/core/function/16-range.js b/packages/node_modules/@node-red/nodes/core/function/16-range.js
index 003c72ed7..a5dede4ea 100644
--- a/packages/node_modules/@node-red/nodes/core/function/16-range.js
+++ b/packages/node_modules/@node-red/nodes/core/function/16-range.js
@@ -28,34 +28,6 @@ module.exports = function(RED) {
var node = this;
this.on('input', function (msg, send, done) {
- var vminin = RED.util.getMessageProperty(msg,"minin");
- if (vminin !== undefined) {
- var nminin = Number(vminin);
- if (!isNaN(nminin)) {
- this.minin=nminin;
- }
- }
- var vmaxin = RED.util.getMessageProperty(msg,"maxin");
- if (vmaxin !== undefined) {
- var nmaxin = Number(vmaxin);
- if (!isNaN(nmaxin)) {
- this.maxin=nmaxin;
- }
- }
- var vminout = RED.util.getMessageProperty(msg,"minout");
- if (vminout !== undefined) {
- var nminout = Number(vminout);
- if (!isNaN(nminout)) {
- this.minout=nminout;
- }
- }
- var vmaxout = RED.util.getMessageProperty(msg,"maxout");
- if (vmaxout !== undefined) {
- var nmaxout = Number(vmaxout);
- if (!isNaN(nmaxout)) {
- this.maxout=nmaxout;
- }
- }
var value = RED.util.getMessageProperty(msg,node.property);
if (value !== undefined) {
var n = Number(value);