# 2 modbus nodes un one function

**URL:** <https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020>\
**Category:** Dashboard\
**Created:** [5 April 2024 05:31 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020 "2024-04-05T05:31:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://discourse.nodered.org/u/Francois)\
**Post date:** [5 April 2024 05:31 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/1 "2024-04-05T05:31:23Z")

</div>

Hi all  
I need your help because i work on a problem for 3 days and nothing shows up ☹  
I have 2 modbus nodes. One to give me parameters from a sdm630 and another from an inverter.  
As soon as i have values from the 2 nodes like power for example i need to write a function to calculate resulting power. But when i execute the function the payload values from the 2 nodes are not valuated at the same time so i got an error like NaN. That is what i suppose because when i log the result to the console, payload shows "undefined" or "number" randomly

---

<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:** [5 April 2024 05:43 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/2 "2024-04-05T05:43:26Z")

</div>

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

Once you have both values in one msg, you can perform your comparisons.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://discourse.nodered.org/u/Francois)\
**Post date:** [5 April 2024 06:08 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/3 "2024-04-05T06:08:03Z")

</div>

It creates single message from separate stream. But i need to wait until messages are valuated

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 April 2024 06:22 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/4 "2024-04-05T06:22:33Z")

</div>

These two settings tell the node how many different input streams to join and whether or not to wait for a each message from each stream.

If you have two input streams count should be 2.  
If both inputs have to be new each time, untick the box.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f90cc36bccdd9817723914416d04922a5ad84ab7.png)

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://discourse.nodered.org/u/Francois)\
**Post date:** [5 April 2024 07:21 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/5 "2024-04-05T07:21:41Z")

</div>

Ok  
I created a simple example in the dashboard and after few tries it works with simple input. I will inject this node in my project and tell you.  
Thanks

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://discourse.nodered.org/u/Francois)\
**Post date:** [6 April 2024 18:20 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/6 "2024-04-06T18:20:58Z")

</div>

Hello  
Everything works fine now.  
Thank you for your help !

---

<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:** [20 April 2024 18:21 UTC](https://discourse.nodered.org/t/2-modbus-nodes-un-one-function/87020/7 "2024-04-20T18:21:44Z")

</div>

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