Boolean logic or glied

Hallo,
ich habe mehrer Variablen angelegt und bekomme es einfach nicht hin.
Warum geht das OR nicht auf true sondern bleibt auf "unkown"?

Wenn ich das erste Und Glied so lasse und das zweite UND Glied weg nehme und nur eine Variable auf das OR Glied gebe, funktioniert alles. Mit zwei und Gliedern nicht.

Hi and welcome to the Node-RED community. Unfortunately, while there are some German speaking users here, most of us speak English and would only have to rely on Google Translate.

Hi there,
I have created several variables and just can't get it to work.
Why doesn't the OR go true but stays on "unkown"?
If I leave the first AND gate so and take the second AND gate away and only put one variable on the OR gate, everything works. Not with two and limbs.

It helps if you explain what nodes you are using and what you are trying to achieve.

Ok then in english This is just a test setup. The variables are logical with true and false and the picture shows the test setup.

Node-RED is generally asynchronous though so msg's arrive at your logic nodes (I assume that's what they are?) in any order which isn't predictable. That is why Node-RED doesn't allow multiple input channels. It is impossible to predict in what order things will arrive.

Since it is only a test setup, I created the variables without sensors behind them. I turn them true or false manually.
But the order shouldn't matter for an OR.
In my setup, both AND are true, and yet the OR behind them says unkown. I do not understand.

this test setup, on the other hand, works

You need to look into context or flow saves. The nodes do not work how you think they work. One message at a time comes in and there is no "memory" to the inputs.

Or possibly an array, or a message with multiple payloads or topics, or possibly other options someone comes up with.

Are you using node-red-contrib-boolean-logic? If so then the node should remember the states of other inputs (as identified by the topics). If you think this isn't working then export the non-working flow and post it here, along with instructions on how to trigger the fault, so we can try it. See this post on how to post a flow here.

Yes i´m using node-red-contrib-boolean-logic, here the code.

[
    {
        "id": "bdbfa51f.147648",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "129dad01.a3bc43",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable01",
        "topic": "EigeneObjekte.0.Temp.Variable01",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 350,
        "y": 320,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "34e00197.64e7ee",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable02",
        "topic": "EigeneObjekte.0.Temp.Variable02",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 400,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "d46e59e4.535e28",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable03",
        "topic": "EigeneObjekte.0.Temp.Variable03",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 500,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "b414a6a9.8108a8",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable04",
        "topic": "EigeneObjekte.0.Temp.Variable04",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 600,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "44b9731e.41efdc",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "AND",
        "inputCount": "4",
        "topic": "result",
        "x": 660,
        "y": 460,
        "wires": [
            [
                "5e8df873.b870c8",
                "22ee294a.2e7496"
            ]
        ]
    },
    {
        "id": "79883861.7584e8",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable05",
        "topic": "EigeneObjekte.0.Temp.Variable05",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 740,
        "wires": [
            [
                "5fe2467e.5a7138"
            ]
        ]
    },
    {
        "id": "76014310.a246ec",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable06",
        "topic": "EigeneObjekte.0.Temp.Variable06",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 840,
        "wires": [
            [
                "5fe2467e.5a7138"
            ]
        ]
    },
    {
        "id": "5fe2467e.5a7138",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "AND",
        "inputCount": 2,
        "topic": "result",
        "x": 610,
        "y": 720,
        "wires": [
            [
                "5e8df873.b870c8",
                "22ee294a.2e7496"
            ]
        ]
    },
    {
        "id": "5e8df873.b870c8",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "OR",
        "inputCount": "2",
        "topic": "result",
        "x": 1050,
        "y": 560,
        "wires": [
            [
                "92ac7be3.9145c8"
            ]
        ]
    },
    {
        "id": "92ac7be3.9145c8",
        "type": "ioBroker out",
        "z": "bdbfa51f.147648",
        "name": "Variable07",
        "topic": "EigeneObjekte.0.Temp.Variable07",
        "ack": "false",
        "autoCreate": "false",
        "x": 1270,
        "y": 560,
        "wires": []
    },
    {
        "id": "7be22405.0cdc3c",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable08",
        "topic": "EigeneObjekte.0.Temp.Variable08",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 260,
        "y": 980,
        "wires": [
            [
                "1ceb6dc6.541152"
            ]
        ]
    },
    {
        "id": "eeeb82bd.5fe0b",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable09",
        "topic": "EigeneObjekte.0.Temp.Variable09",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 240,
        "y": 1060,
        "wires": [
            [
                "1ceb6dc6.541152"
            ]
        ]
    },
    {
        "id": "fb91e4dd.347fc8",
        "type": "ioBroker out",
        "z": "bdbfa51f.147648",
        "name": "Variable10",
        "topic": "EigeneObjekte.0.Temp.Variable10",
        "ack": "false",
        "autoCreate": "false",
        "x": 1410,
        "y": 960,
        "wires": []
    },
    {
        "id": "1ceb6dc6.541152",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "test1",
        "operation": "AND",
        "inputCount": "3",
        "topic": "result",
        "x": 700,
        "y": 1000,
        "wires": [
            [
                "dc5c8b60.9ad798"
            ]
        ]
    },
    {
        "id": "dc5c8b60.9ad798",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "test 3",
        "operation": "OR",
        "inputCount": "2",
        "topic": "result",
        "x": 1080,
        "y": 1060,
        "wires": [
            [
                "fb91e4dd.347fc8"
            ]
        ]
    },
    {
        "id": "c35a8dd2.adcc7",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable11",
        "topic": "EigeneObjekte.0.Temp.Variable11",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 240,
        "y": 1240,
        "wires": [
            [
                "7d7ae1cf.dde28"
            ]
        ]
    },
    {
        "id": "22ee294a.2e7496",
        "type": "debug",
        "z": "bdbfa51f.147648",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1020,
        "y": 740,
        "wires": []
    },
    {
        "id": "f187fc6b.ccf18",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable12",
        "topic": "EigeneObjekte.0.Temp.Variable12",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 260,
        "y": 1160,
        "wires": [
            [
                "1ceb6dc6.541152",
                "7d7ae1cf.dde28"
            ]
        ]
    },
    {
        "id": "7d7ae1cf.dde28",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "test2",
        "operation": "AND",
        "inputCount": 2,
        "topic": "result",
        "x": 740,
        "y": 1160,
        "wires": [
            [
                "dc5c8b60.9ad798"
            ]
        ]
    }
]

Is it really necessary to have that many nodes to illustrate a problem with the node? I would have thought a couple of injects, maybe a couple of Change nodes and the bool node and debug should be enough.

ok then the simplified version. I actually wanted to show that it doesn't work with several variants.

[
    {
        "id": "bdbfa51f.147648",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "129dad01.a3bc43",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable01",
        "topic": "EigeneObjekte.0.Temp.Variable01",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 350,
        "y": 320,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "34e00197.64e7ee",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable02",
        "topic": "EigeneObjekte.0.Temp.Variable02",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 340,
        "y": 400,
        "wires": [
            [
                "44b9731e.41efdc"
            ]
        ]
    },
    {
        "id": "44b9731e.41efdc",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "AND",
        "inputCount": "2",
        "topic": "result",
        "x": 680,
        "y": 360,
        "wires": [
            [
                "5e8df873.b870c8",
                "374ca3f8.d5db7c"
            ]
        ]
    },
    {
        "id": "79883861.7584e8",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable05",
        "topic": "EigeneObjekte.0.Temp.Variable05",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 320,
        "y": 540,
        "wires": [
            [
                "5fe2467e.5a7138"
            ]
        ]
    },
    {
        "id": "76014310.a246ec",
        "type": "ioBroker in",
        "z": "bdbfa51f.147648",
        "name": "Variable06",
        "topic": "EigeneObjekte.0.Temp.Variable06",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 300,
        "y": 620,
        "wires": [
            [
                "5fe2467e.5a7138"
            ]
        ]
    },
    {
        "id": "5fe2467e.5a7138",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "AND",
        "inputCount": 2,
        "topic": "result",
        "x": 680,
        "y": 600,
        "wires": [
            [
                "5e8df873.b870c8",
                "c13b2789.ea8268"
            ]
        ]
    },
    {
        "id": "5e8df873.b870c8",
        "type": "BooleanLogic",
        "z": "bdbfa51f.147648",
        "name": "",
        "operation": "OR",
        "inputCount": "2",
        "topic": "result",
        "x": 1050,
        "y": 560,
        "wires": [
            [
                "92ac7be3.9145c8",
                "1fb78fd4.6129c"
            ]
        ]
    },
    {
        "id": "92ac7be3.9145c8",
        "type": "ioBroker out",
        "z": "bdbfa51f.147648",
        "name": "Variable07",
        "topic": "EigeneObjekte.0.Temp.Variable07",
        "ack": "false",
        "autoCreate": "false",
        "x": 1270,
        "y": 560,
        "wires": []
    },
    {
        "id": "374ca3f8.d5db7c",
        "type": "BDebug",
        "z": "bdbfa51f.147648",
        "name": "Debug",
        "x": 880,
        "y": 320,
        "wires": []
    },
    {
        "id": "c13b2789.ea8268",
        "type": "BDebug",
        "z": "bdbfa51f.147648",
        "name": "Debug",
        "x": 860,
        "y": 660,
        "wires": []
    },
    {
        "id": "1fb78fd4.6129c",
        "type": "BDebug",
        "z": "bdbfa51f.147648",
        "name": "Debug",
        "x": 1200,
        "y": 480,
        "wires": []
    }
]

You still have much too many nodes, including iobroker nodes that I have no idea what they are. The most you should need is something like
image

Along with a description of what to press to see the problem.

When pasting in a flow please also select Compact so that it appears on one line in the post, that makes it easier to mark and copy. Thanks.

ok here a simple project:
the and is correct, but the or is unkown.

[
    {
        "id": "231647b3.588ae8",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "e83fe1fa.11b5f",
        "type": "ioBroker in",
        "z": "231647b3.588ae8",
        "name": "Variable01",
        "topic": "EigeneObjekte.0.Temp.Variable01",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 290,
        "y": 380,
        "wires": [
            [
                "18ddea32.c3b5a6"
            ]
        ]
    },
    {
        "id": "ec0f1d16.eafd3",
        "type": "ioBroker in",
        "z": "231647b3.588ae8",
        "name": "Variable02",
        "topic": "EigeneObjekte.0.Temp.Variable02",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 300,
        "y": 460,
        "wires": [
            [
                "18ddea32.c3b5a6"
            ]
        ]
    },
    {
        "id": "18ddea32.c3b5a6",
        "type": "BooleanLogic",
        "z": "231647b3.588ae8",
        "name": "",
        "operation": "AND",
        "inputCount": 2,
        "topic": "result",
        "x": 600,
        "y": 420,
        "wires": [
            [
                "9d4c15b6.321d48"
            ]
        ]
    },
    {
        "id": "42ab3e1.79b72c",
        "type": "ioBroker in",
        "z": "231647b3.588ae8",
        "name": "Variable03",
        "topic": "EigeneObjekte.0.Temp.Variable03",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 300,
        "y": 560,
        "wires": [
            [
                "6af7afda.6b425"
            ]
        ]
    },
    {
        "id": "44d25559.1db15c",
        "type": "ioBroker in",
        "z": "231647b3.588ae8",
        "name": "Variable04",
        "topic": "EigeneObjekte.0.Temp.Variable04",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 300,
        "y": 620,
        "wires": [
            [
                "6af7afda.6b425"
            ]
        ]
    },
    {
        "id": "6af7afda.6b425",
        "type": "BooleanLogic",
        "z": "231647b3.588ae8",
        "name": "",
        "operation": "AND",
        "inputCount": "2",
        "topic": "result",
        "x": 600,
        "y": 600,
        "wires": [
            [
                "9d4c15b6.321d48"
            ]
        ]
    },
    {
        "id": "9d4c15b6.321d48",
        "type": "BooleanLogic",
        "z": "231647b3.588ae8",
        "name": "",
        "operation": "OR",
        "inputCount": "2",
        "topic": "result",
        "x": 850,
        "y": 500,
        "wires": [
            []
        ]
    }
]

Nobody an idea? I think node red is not the right for me

Have you tried putting a debug node (set to display the 'Complete msg object') on the output of the three logic nodes to see what you have?

Give the debug nodes different names so you can follow the debug output more easily.
Also, as I said earlier, just test one node at a time, starting with And gates, when they are working ok move on to the Or node

And make sure you read the INFO tab and understand how the nodes work (hini hint)

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