Compare 2 different inputs

Hi all

I need some help, I like to setup a flow with 2 input nodes. node1 is a node with a value range between 0-100 and the other input node2 has a range between 0-5000. I like to configure the flow like: If the input from node 1 is > 80 the output is 0 no matter whats the input of node 2. If node 1<80 the output is equale to the value of node 2. I guess this is no rocket science but I'm quite new in node red and still have to learn a lot. I searched for a similar flow on the forum and the rest of the www but no succes . Can someone please help me with these? thanks in advance!

[
    {
        "id": "0d3e51034b19940d",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "81",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "80",
        "payloadType": "num",
        "x": 190,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "159da3226d0e3b41",
        "type": "debug",
        "z": "525279bd0e36f44d",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 160,
        "wires": []
    },
    {
        "id": "47335ab22f672b33",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1500",
        "payloadType": "num",
        "x": 190,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "42e349d0f425b1d4",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "70",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "70",
        "payloadType": "num",
        "x": 190,
        "y": 140,
        "wires": [
            []
        ]
    }
]

Umm did you perhaps not export the whole flow, or is this as far as you've got?

Here is a possible layout. have a go , if you have trouble ask specific questions

Darn it, too slow off the mark!
ps this flow has a "deliberate" error due to not reading the spec :smiling_face:

[{"id":"a49f67fa0c96285a","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"0d3e51034b19940d","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input1","payload":"81","payloadType":"num","x":120,"y":140,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"159da3226d0e3b41","type":"debug","z":"a49f67fa0c96285a","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":140,"wires":[]},{"id":"47335ab22f672b33","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input2","payload":"1500","payloadType":"num","x":130,"y":260,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"42e349d0f425b1d4","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input1","payload":"70","payloadType":"num","x":120,"y":80,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"8847575d365acff5","type":"comment","z":"a49f67fa0c96285a","name":"input 1 0 - 100","info":"","x":130,"y":40,"wires":[]},{"id":"2ecd34ec98d45f56","type":"comment","z":"a49f67fa0c96285a","name":"input 2 0 - 5000","info":"","x":140,"y":300,"wires":[]},{"id":"c6a8ec4cb037c0e2","type":"comment","z":"a49f67fa0c96285a","name":"input 1 > 80, output 0","info":"","x":520,"y":80,"wires":[]},{"id":"18328ac9d74873d0","type":"comment","z":"a49f67fa0c96285a","name":"input 1 < 80, output input 2","info":"","x":530,"y":200,"wires":[]},{"id":"7f0aa9e8c6c809b7","type":"join","z":"a49f67fa0c96285a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":310,"y":140,"wires":[["75407c983cb834f5"]]},{"id":"75407c983cb834f5","type":"switch","z":"a49f67fa0c96285a","name":"","property":"payload.input1","propertyType":"msg","rules":[{"t":"gt","v":"80","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":140,"wires":[["dc6f6bb5fafde2db"],["c0a8fbdfe6fcca6a"]]},{"id":"dc6f6bb5fafde2db","type":"change","z":"a49f67fa0c96285a","name":"","rules":[{"t":"move","p":"payload.input1","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":120,"wires":[["159da3226d0e3b41"]]},{"id":"c0a8fbdfe6fcca6a","type":"change","z":"a49f67fa0c96285a","name":"","rules":[{"t":"move","p":"payload.input2","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":160,"wires":[["159da3226d0e3b41"]]}]

Hi guys, thank you verry much, based your flows I made something that works :smiley: I learnd a lot with this about the join and switch node. Thanks!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.