Help with the function node

Hello.I'm new and I need some advice-help with my node function. I can't write the code to make it work properly, it always sends the value from pvpower.it should work as follows: I have three input nodes, namely soc, pvpower, temperature. These nodes enter the function node where I try to create these oversights:the value from pvpower will be sent only if the following conditions are met:if the soc>80 and the temperature<80 will send a value from PVPOWER. If it is soc>80 and the temperature is >80, it will only send the value off.If the SOC>80 and temperature is <80, it will send a value from PVPOWER

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Each msg entering a function node has no idea of the other msgs sent to it.

Take a look at the join node if all three msgs need to be combined.

(If I’m wrong about what you are trying, I apologize- I have a head cold.)

let pvpower = msg.payload;

if (msg.payload.temperature > 80 && msg.payload.soc < 80) {
msg.payload = "vypnut";
} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {
msg.payload = "vypnutSoc";
} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {
msg.payload = "pvpower";
}

return msg; I apologize for any mistakes, but I'm writing here through the translator :slight_smile: I'm going to try to write it again.If the SOC values are >80 and the temperature is >80, it will send a message ,turn off,.If the SOC values are<80 and temperature >80 will send the message ,turn off,.If the SOC>80 and the temperature is <80, it will only send a message/value from PVPOWER.I can't achieve this, I still have all the values at the exit from the node and not the specific ones according to the conditions.

A key concept of node-red is that every message will be handled separately.

When you want to check for both msg.payload.soc and msg.payload.temperature - these properties need to exist in msg.payload.<prop> - as it is not aware of other messages.

So if you have 3 values coming from 3 different nodes, you will need to combine them first.

Hello and welcome to the Node-RED forum.

Could you post the flow you have created so far - so people can explain how to "join" the messages, you have arriving from various sources, together?

This is a classic situation faced by a lot of people who are new to Node-RED.

[
    {
        "id": "117b79b80e9dee47",
        "type": "victron-input-battery",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.battery/277",
        "path": "/Soc",
        "serviceObj": {
            "service": "com.victronenergy.battery/277",
            "name": "Baterka"
        },
        "pathObj": {
            "path": "/Soc",
            "type": "float",
            "name": "State of charge (%)"
        },
        "name": "soc",
        "onlyChanges": false,
        "roundValues": "1",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "1eacab5dd3e2d5e2"
            ]
        ]
    },
    {
        "id": "6ca94153591f21e8",
        "type": "victron-input-temperature",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.temperature/24",
        "path": "/Temperature",
        "serviceObj": {
            "service": "com.victronenergy.temperature/24",
            "name": "Akumulacka vrch"
        },
        "pathObj": {
            "path": "/Temperature",
            "type": "float",
            "name": "Temperature (°C)"
        },
        "name": "temperature",
        "onlyChanges": false,
        "roundValues": "1",
        "x": 430,
        "y": 360,
        "wires": [
            [
                "1eacab5dd3e2d5e2"
            ]
        ]
    },
    {
        "id": "1eacab5dd3e2d5e2",
        "type": "function",
        "z": "7bb4b982f37a1f91",
        "name": "function 13",
        "func": "let pvpower = msg.payload;\n\nif (msg.payload.temperature > 80 && msg.payload.soc < 80) {\n    msg.payload = \"vypnut\";\n} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {\n    msg.payload = \"vypnutSoc\";\n} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {\n    msg.payload = \"pvpower\";\n}\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [ ],
        "x": 630,
        "y": 300,
        "wires": [
            [
                "0aadc31f18dd37ed"
            ]
        ]
    },
    {
        "id": "e6f7416282436479",
        "type": "victron-input-solarcharger",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.solarcharger/278",
        "path": "/Yield/Power",
        "serviceObj": {
            "service": "com.victronenergy.solarcharger/278",
            "name": "Epever 8415AN"
        },
        "pathObj": {
            "path": "/Yield/Power",
            "type": "float",
            "name": "PV Power (W)"
        },
        "name": "pvpower",
        "onlyChanges": false,
        "roundValues": "0",
        "x": 420,
        "y": 300,
        "wires": [
            [
                "1eacab5dd3e2d5e2"
            ]
        ]
    },
    {
        "id": "0aadc31f18dd37ed",
        "type": "debug",
        "z": "7bb4b982f37a1f91",
        "name": "debug 32",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 240,
        "wires": [ ]
    }
]

There is complet flow

Your flow is corrupted as you have not posted the code in the correct manner for forum to parse correctly

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Two forum members have noted that you need to join the messages as they are coming from different node, so the messages do not arrive in your function at the same time.

See this article in the cookbook for an example of how to join messages into one object.

Here is your function with comments:

// The below line isn't needed, does nothing
let pvpower = msg.payload;

// The below lines set `msg.payload` to equal the string of characters "vypnut", "vypnutSoc", or "pvpower"
if (msg.payload.temperature > 80 && msg.payload.soc < 80) {
    msg.payload = "vypnut";

} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {
    msg.payload = "vypnutSoc";

} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {
    msg.payload = "pvpower";
    
}

// this sends the msg to the next node
return msg;

If that is not the intended behavior, please try to state what you intend it to do?

Because it sounds like you intend to set msg.payload or the entire msg object to other values/properties not those strings.

// The below lines set `msg.payload` to equal the incoming values in `msg.payload.vypnut`, `msg.payload.vypnutSoc`, or `msg.payload.pvpower`
if (msg.payload.temperature > 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnut;

} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnutSoc;

} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {
    msg.payload = msg.payload.pvpower;
    
}

// this sends the msg to the next node
return msg;

Also your debug node is set to only show the msg.payload, I find it useful when debugging functions to set the debug node to output complete msg object to better analyze what is happening.

From this function node, it will go further to the switch node, where there are already other conditions based on the performance from PVPOWER. That's why I only need to get the pvpower value there, but only if the conditions I wrote are met. If the conditions were not met and the function node would only send a message to turn off or offSOC, then it would also be further processed

Then it sounds like the second function I wrote is what you need, it will only send the value of msg.payload.pvpower as the msg.payload that leaves the function node if the temperature is less than 80 and the soc is greater than 80.

To add a condition for no conditions are met you can just use an else statement at the end of the if function like:

// The below lines set `msg.payload` to equal the incoming values in `msg.payload.vypnut`, `msg.payload.vypnutSoc`, or `msg.payload.pvpower`
if (msg.payload.temperature > 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnut;

} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnutSoc;

} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {
    msg.payload = msg.payload.pvpower;
    
} else {
    // This only triggers if no conditions are met
    // The below line might need a different value depending on your use case
    msg.payload = "turn off";
}

// this sends the msg to the next node
return msg;

However, no conditions are met only if both values are greater than 80
EDIT: or if any of those properties is undefined

With this code of yours, it still sends a Turn Off for all 3 entry topics.
but I wrote the conditions as they are, and that if the temperature is more than 80 then it will not send any other messages but only turn off.If the soc is less than 80 it will not send any message only the message turn off the soc. If the temperature is less than 80 and the soc is greater than 80, it will only send messages/values from the controller because this value changes and in the next switch node the outputs are adjusted based on this value as it changes.

If you are sending 3 separate msg objects then they are NOT aware of each other and need to be joined.

It sounds like you are sending messages that are formatted like this:

msg = {
    "payload": {
        "vypnut": "value"
    }
}

msg = {
    "payload": {
        "vypnutSoc": "value"
    }
}

msg = {
    "payload": {
        "pvpower": "value"
    }
}

They need to be combined into one message object like this so the function can perform correctly:

msg = {
    "payload": {
        "vypnut": "value",
        "vypnutSoc": "value",
        "pvpower": "value"
    }
}

You can combine the messages with a join node from the core Node-RED nodes placed before your function node. The join node will likely need to be set to the following settings.
Mode: manual
Combine each: msg.payload
to create: a merged object
uncheck the boxes
send the message after 3 parts

thank you very much, I will try tomorrow, I turned off my computer a while ago and I don't want to turn it on and read.
but I still ask..: if I create it according to what you wrote to me that at the beginning there will be three nodes soc, temperature and pvpower, then those nodes will send msg.values ​​to the join node, which I will set up as you wrote and from the join node it will go there is already a function in node where I have to write all the msg.payload together in the code you sent above?..I will try tomorrow and write it here.
I thought that this function would change the incoming values ​​according to those conditions and send only one specific value to the output that corresponds to the given fulfilled condition.

After the join node is the function node with the following code:

// The below lines set `msg.payload` to equal the incoming values in `msg.payload.vypnut`, `msg.payload.vypnutSoc`, or `msg.payload.pvpower`
if (msg.payload.temperature > 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnut;

} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {
    msg.payload = msg.payload.vypnutSoc;

} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {
    msg.payload = msg.payload.pvpower;
    
} else {
    // This only triggers if no conditions are met
    // The below line might need a different value depending on your use case
    msg.payload = "turn off";
}

// this sends the msg to the next node
return msg;

That code is designed to work with the combined msg from the join node.

Here's a simple example to "join" the values from three inputs that arrive at different times.
The contents of the resultant object can then be used in your function node.
friday_join_A

friday_join_B

Here's the Node-RED flow you can import and try out.

[{"id":"7b8698059fd2bbef","type":"tab","label":"Join_Example","disabled":false,"info":"","env":[]},{"id":"684ac4402a1bd08b","type":"inject","z":"7b8698059fd2bbef","name":"","props":[{"p":"payload.temperature","v":"21","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temperature","x":230,"y":220,"wires":[["15bef60d2e5de063"]]},{"id":"5ed32446c518aa4e","type":"inject","z":"7b8698059fd2bbef","name":"","props":[{"p":"payload.soc","v":"6","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"soc","x":210,"y":260,"wires":[["15bef60d2e5de063"]]},{"id":"084672b6c8770d95","type":"inject","z":"7b8698059fd2bbef","name":"","props":[{"p":"payload.pvpower","v":"3","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pvpower","x":220,"y":300,"wires":[["15bef60d2e5de063"]]},{"id":"15bef60d2e5de063","type":"join","z":"7b8698059fd2bbef","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":390,"y":260,"wires":[["3ead3536dc67e2d8"]]},{"id":"3ead3536dc67e2d8","type":"debug","z":"7b8698059fd2bbef","name":"combined_object","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":260,"wires":[]},{"id":"27ed164bb6f81c44","type":"comment","z":"7b8698059fd2bbef","name":"Simulate three inputs","info":"","x":240,"y":180,"wires":[]}]

There is a lot of confusion about exactly what is happening in your system. The problem is that we do not know exactly what is being fed to your function. Please attach a Debug node showing what is going into your function and copy/paste here what you see., Then we will know exactly what you need to do.

[
    {
        "id": "117b79b80e9dee47",
        "type": "victron-input-battery",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.battery/277",
        "path": "/Soc",
        "serviceObj": {
            "service": "com.victronenergy.battery/277",
            "name": "Baterka"
        },
        "pathObj": {
            "path": "/Soc",
            "type": "float",
            "name": "State of charge (%)"
        },
        "name": "soc",
        "onlyChanges": false,
        "roundValues": "1",
        "x": 70,
        "y": 360,
        "wires": [
            [
                "4855f3e6df26aa74"
            ]
        ]
    },
    {
        "id": "6ca94153591f21e8",
        "type": "victron-input-temperature",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.temperature/24",
        "path": "/Temperature",
        "serviceObj": {
            "service": "com.victronenergy.temperature/24",
            "name": "Akumulacka vrch"
        },
        "pathObj": {
            "path": "/Temperature",
            "type": "float",
            "name": "Temperature (°C)"
        },
        "name": "temperature",
        "onlyChanges": false,
        "roundValues": "1",
        "x": 90,
        "y": 420,
        "wires": [
            [
                "4855f3e6df26aa74"
            ]
        ]
    },
    {
        "id": "e6f7416282436479",
        "type": "victron-input-solarcharger",
        "z": "7bb4b982f37a1f91",
        "service": "com.victronenergy.solarcharger/278",
        "path": "/Yield/Power",
        "serviceObj": {
            "service": "com.victronenergy.solarcharger/278",
            "name": "Epever 8415AN"
        },
        "pathObj": {
            "path": "/Yield/Power",
            "type": "float",
            "name": "PV Power (W)"
        },
        "name": "pvpower",
        "onlyChanges": false,
        "roundValues": "0",
        "x": 80,
        "y": 480,
        "wires": [
            [
                "4855f3e6df26aa74"
            ]
        ]
    },
    {
        "id": "20435912dccc97e2",
        "type": "debug",
        "z": "7bb4b982f37a1f91",
        "name": "debug 34",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 540,
        "wires": []
    },
    {
        "id": "c06643a5c5e1446c",
        "type": "inject",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "temperature",
        "payload": "81",
        "payloadType": "num",
        "x": 120,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "316e028858f147aa",
        "type": "inject",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "soc",
        "payload": "78",
        "payloadType": "num",
        "x": 90,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "100dbf9b8f2e9d37",
        "type": "function",
        "z": "7bb4b982f37a1f91",
        "name": "function 26",
        "func": "// The below lines set `msg.payload` to equal the incoming values in `msg.payload.vypnut`, `msg.payload.vypnutSoc`, or `msg.payload.pvpower`\nif (msg.payload.temperature > 80 && msg.payload.soc < 80) {\n    msg.payload = msg.payload.vypnut;\n\n} else if (msg.payload.temperature < 80 && msg.payload.soc < 80) {\n    msg.payload = msg.payload.vypnutSoc;\n\n} else if (msg.payload.temperature < 80 && msg.payload.soc > 80) {\n    msg.payload = msg.payload.pvpower;\n    \n}\n\n// this sends the msg to the next node\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 460,
        "wires": [
            [
                "20435912dccc97e2"
            ]
        ]
    },
    {
        "id": "4855f3e6df26aa74",
        "type": "join",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 290,
        "y": 440,
        "wires": [
            [
                "100dbf9b8f2e9d37"
            ]
        ]
    }
]

I'm hoping that the flow has already been well copied... I need to receive messages from pvpower at the output from the function but if either the temperature is more than 80 or soc less than 80, it won't send anything, just turn it off- so that it doesn't send the value from the controller further to the switch.I hope you understand what I mean...

[
    {
        "id": "36716a5223beff25",
        "type": "debug",
        "z": "7bb4b982f37a1f91",
        "name": "Spirala1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1580,
        "y": 260,
        "wires": []
    },
    {
        "id": "1511e1b371de1637",
        "type": "switch",
        "z": "7bb4b982f37a1f91",
        "name": "AN hore",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "1400",
                "vt": "num"
            },
            {
                "t": "gte",
                "v": "2700",
                "vt": "num"
            },
            {
                "t": "gte",
                "v": "3600",
                "vt": "num"
            },
            {
                "t": "lt",
                "v": "1250",
                "vt": "num"
            },
            {
                "t": "lt",
                "v": "2300",
                "vt": "num"
            },
            {
                "t": "lt",
                "v": "3500",
                "vt": "num"
            },
            {
                "t": "cont",
                "v": "vypnut",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 7,
        "x": 900,
        "y": 360,
        "wires": [
            [
                "e9f4977478ac912a"
            ],
            [
                "75a39dd2fc6ef851"
            ],
            [
                "182040fcdab23e38"
            ],
            [
                "d3f7bfc0673ff796"
            ],
            [
                "8614a7dae0045d5f"
            ],
            [
                "3be2887da9e71f59"
            ],
            [
                "d3f7bfc0673ff796"
            ]
        ]
    },
    {
        "id": "e9f4977478ac912a",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "zapni spiralu 1",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 220,
        "wires": [
            [
                "24fcf09cfc3b4451"
            ]
        ]
    },
    {
        "id": "75a39dd2fc6ef851",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "zapni spiralu 2",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 280,
        "wires": [
            [
                "f26ddf7274948a65"
            ]
        ]
    },
    {
        "id": "182040fcdab23e38",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "zapni spiralu 3",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 340,
        "wires": [
            [
                "4b41ab92ae16e9ca"
            ]
        ]
    },
    {
        "id": "25593a8b0d34c2f5",
        "type": "debug",
        "z": "7bb4b982f37a1f91",
        "name": "Spirala2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1580,
        "y": 380,
        "wires": []
    },
    {
        "id": "b628eef3ff1a26ba",
        "type": "debug",
        "z": "7bb4b982f37a1f91",
        "name": "Spirala3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1580,
        "y": 500,
        "wires": []
    },
    {
        "id": "d3f7bfc0673ff796",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "vypni vsetko",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1130,
        "y": 420,
        "wires": [
            [
                "24fcf09cfc3b4451",
                "f26ddf7274948a65",
                "4b41ab92ae16e9ca"
            ]
        ]
    },
    {
        "id": "3be2887da9e71f59",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "vypni 3",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 540,
        "wires": [
            [
                "4b41ab92ae16e9ca"
            ]
        ]
    },
    {
        "id": "8614a7dae0045d5f",
        "type": "change",
        "z": "7bb4b982f37a1f91",
        "name": "vypni 2",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 480,
        "wires": [
            [
                "f26ddf7274948a65"
            ]
        ]
    },
    {
        "id": "24fcf09cfc3b4451",
        "type": "rbe",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1410,
        "y": 260,
        "wires": [
            [
                "36716a5223beff25"
            ]
        ]
    },
    {
        "id": "f26ddf7274948a65",
        "type": "rbe",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1410,
        "y": 380,
        "wires": [
            [
                "25593a8b0d34c2f5"
            ]
        ]
    },
    {
        "id": "4b41ab92ae16e9ca",
        "type": "rbe",
        "z": "7bb4b982f37a1f91",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1410,
        "y": 500,
        "wires": [
            [
                "b628eef3ff1a26ba"
            ]
        ]
    }
] 

and this is the flow where the output with the function node will go (but here I'm not sure if I have the filters set up well, as I've been struggling with the function node for two weeks) :slight_smile:

And I wanted more of those conditions at first :wink: and I'm still struggling with only three :slight_smile:

Try this version... it should implement your stated requirement...
I need to receive messages from pvpower at the output from the function but if either the temperature is more than 80 or soc less than 80, it won't send anything

[{"id":"7b8698059fd2bbef","type":"tab","label":"Join_Example","disabled":false,"info":"","env":[]},{"id":"684ac4402a1bd08b","type":"inject","z":"7b8698059fd2bbef","name":"temperature = 80","props":[{"p":"payload.temperature","v":"80","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temperature","x":220,"y":140,"wires":[["15bef60d2e5de063"]]},{"id":"5ed32446c518aa4e","type":"inject","z":"7b8698059fd2bbef","name":"soc = 80","props":[{"p":"payload.soc","v":"81","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"soc","x":200,"y":260,"wires":[["15bef60d2e5de063"]]},{"id":"084672b6c8770d95","type":"inject","z":"7b8698059fd2bbef","name":"pvpower = 3","props":[{"p":"payload.pvpower","v":"3","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pvpower","x":210,"y":380,"wires":[["15bef60d2e5de063"]]},{"id":"15bef60d2e5de063","type":"join","z":"7b8698059fd2bbef","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":390,"y":260,"wires":[["c18b8624139b5775","efa07285342ca10a"]]},{"id":"3ead3536dc67e2d8","type":"debug","z":"7b8698059fd2bbef","name":"combined_object","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":260,"wires":[]},{"id":"27ed164bb6f81c44","type":"comment","z":"7b8698059fd2bbef","name":"Simulate three inputs","info":"","x":240,"y":60,"wires":[]},{"id":"c18b8624139b5775","type":"function","z":"7b8698059fd2bbef","name":"OR function","func":"if ((msg.payload.temperature.temperature > 80) || (msg.payload.soc.soc < 80)) {\n    return null;\n}\n\nelse {\n    msg.payload = msg.payload.pvpower.pvpower;\n    return msg;\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":260,"wires":[["3ead3536dc67e2d8"]]},{"id":"f491dbeb5e49bb28","type":"inject","z":"7b8698059fd2bbef","name":"temperature = 81","props":[{"p":"payload.temperature","v":"81","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temperature","x":220,"y":180,"wires":[["15bef60d2e5de063"]]},{"id":"c3be77599c673b66","type":"inject","z":"7b8698059fd2bbef","name":"soc = 79","props":[{"p":"payload.soc","v":"79","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"soc","x":200,"y":300,"wires":[["15bef60d2e5de063"]]},{"id":"efa07285342ca10a","type":"debug","z":"7b8698059fd2bbef","name":"debug 3430","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":430,"y":320,"wires":[]}]