# Trying to add two inputs, but not sure how

**URL:** https://discourse.nodered.org/t/trying-to-add-two-inputs-but-not-sure-how/81144
**Category:** General
**Created:** [8 September 2023 13:58 UTC](https://discourse.nodered.org/t/trying-to-add-two-inputs-but-not-sure-how/81144 "2023-09-08T13:58:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [8 September 2023 13:58 UTC](https://discourse.nodered.org/t/trying-to-add-two-inputs-but-not-sure-how/81144/1 "2023-09-08T13:58:06Z")

</div>

Here is what I have pieced together, but not sure what I'm doing here, not getting any output to the debug?

```auto
[
    {
        "id": "6d7c3b91d83d126b",
        "type": "function",
        "z": "f672d0ac69fd5b97",
        "name": "function 4",
        "func": "var temp = (msg.payload.solar1[2]) + (msg.payload.solar2[2])\nmsg.payload = temp;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 800,
        "wires": [
            [
                "eb237cb28b7f1809"
            ]
        ]
    },
    {
        "id": "7f4787605eed55ed",
        "type": "change",
        "z": "f672d0ac69fd5b97",
        "name": "solar 2",
        "rules": [
            {
                "t": "set",
                "p": "payload.solar2",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 820,
        "wires": [
            [
                "6d7c3b91d83d126b",
                "0a5716f2b228d0a8"
            ]
        ]
    },
    {
        "id": "1bf92e4a2cae2cc4",
        "type": "change",
        "z": "f672d0ac69fd5b97",
        "name": "solar 1",
        "rules": [
            {
                "t": "set",
                "p": "payload.solar1",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 780,
        "wires": [
            [
                "6d7c3b91d83d126b",
                "a30c261616a90884"
            ]
        ]
    },
    {
        "id": "eb237cb28b7f1809",
        "type": "debug",
        "z": "f672d0ac69fd5b97",
        "name": "debug 21",
        "active": true,
        "tosidebar": false,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 920,
        "y": 800,
        "wires": []
    },
    {
        "id": "0a5716f2b228d0a8",
        "type": "debug",
        "z": "f672d0ac69fd5b97",
        "name": "debug 22",
        "active": true,
        "tosidebar": false,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 720,
        "y": 840,
        "wires": []
    },
    {
        "id": "a30c261616a90884",
        "type": "debug",
        "z": "f672d0ac69fd5b97",
        "name": "debug 23",
        "active": true,
        "tosidebar": false,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 720,
        "y": 760,
        "wires": []
    }
]

```

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [8 September 2023 14:15 UTC](https://discourse.nodered.org/t/trying-to-add-two-inputs-but-not-sure-how/81144/2 "2023-09-08T14:15:26Z")

</div>

A fundamental point to be aware of in Node-RED is that messages NEVER arrive from two separate wires into a node at the same time.

With that in mind, you need some way to `join` the two incoming messages into 1 `msg` so that you can access both properties at the same time. Luckily, there is a `join` node for this very purpose

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1cd01f0c15a4adcc8bb2f1e11b1c2f0d2316bf8.png)

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [22 September 2023 14:16 UTC](https://discourse.nodered.org/t/trying-to-add-two-inputs-but-not-sure-how/81144/3 "2023-09-22T14:16:06Z")

</div>

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