# Nicedevil's Starting Questions

**URL:** <https://discourse.nodered.org/t/nicedevils-starting-questions/14454>\
**Category:** General\
**Created:** [18 August 2019 15:39 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454 "2019-08-18T15:39:49Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [18 August 2019 17:56 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/21 "2019-08-18T17:56:02Z")

</div>

You are testing to see if it matches a string and is 0  
Your debug shows that it is a number not a string

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 17:05 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/22 "2019-08-19T17:05:13Z")

</div>

Dunno if that was my aim 😃  
Looks a bit more complicated now... is there a better way for doing this right?  
2 Topics for each Device, so I have to use 8 outputs on the switch.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8556e1fb7d409ff52ea1ef836b25a550f409559f.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 August 2019 17:45 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/23 "2019-08-19T17:45:06Z")

</div>

> [@nicedevil](#):
>
> is there a better way for doing this right?

If it works, you understand and in two months you will be able to change it then who's to say it is wrong 😊

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 17:49 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/24 "2019-08-19T17:49:11Z")

</div>

it works great.  
wasn't able to post again yesterday, because 1st day for registration only 8 replys or something like that was allowed.

now I'm looking forward for get a sum of the 4 gauge outputs for one summed one.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 August 2019 19:10 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/25 "2019-08-19T19:10:43Z")

</div>

Personally I prefer to use individual MQTT In nodes rather than fetch them all in one go. It is purely a personal preference to go for the conceptually simpler solution though. There is nothing wrong with the switched solution.

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 19:58 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/26 "2019-08-19T19:58:18Z")

</div>

is it possibile that any of you give me a little tip how to get multiple msg.payloads into one function from 4 topics 😃

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:03 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/27 "2019-08-19T20:03:50Z")

</div>

oh... i thought i can only add one output to one "point" of the node function... but i can multiple 😃

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 August 2019 20:08 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/28 "2019-08-19T20:08:08Z")

</div>

If you mean you want to use data from four separate messages in one function then you can use a Join node. See this recipe in the cookbook.  
[https://cookbook.nodered.org/basic/join-streams](https://cookbook.nodered.org/basic/join-streams)

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:10 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/29 "2019-08-19T20:10:05Z")

</div>

mhhh but all of them got the same msg.payload object, so join node won't help if I understand your link right? that is only for different objects?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 August 2019 20:11 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/30 "2019-08-19T20:11:24Z")

</div>

remember that four msg's entering the function node will all run seperately. If you need the data from all four to do something, you will need to jion the msgs before they get to the function node or store things in context variables. i.e. msg 1 comes in and stores date in a flow variable and exits, then msg 2 comes in and stores some data, then msg 3 then msg 4 which see everything is ready and what ever processing gets done woth all the values from the msgs.

BUT what if you get msg1, msg3, msg2 then anotehr msg1 then msg4?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 August 2019 20:13 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/31 "2019-08-19T20:13:04Z")

</div>

Can you explain exactly what the four messages you are trying to access are? Possibly some example data. At the moment I have little idea what you are trying to do.

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:16 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/32 "2019-08-19T20:16:35Z")

</div>

yes I can 🙂

My aim is to sum up my actual power consumption of my 4 identical mqtt devices.  
Those devices sends their measured consumption everytime they detect a difference to the last measurement but not more often than once every second. If there is no difference they will send their data only once every 30 seconds.

the output of all 4 is like this:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/fb64a988004ba29729d5dc5db30202fa12ff1937.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 August 2019 20:18 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/33 "2019-08-19T20:18:42Z")

</div>

Are you trying to add them up individually or add up the grand total of them all?  
For each of them is that a running total or the consumption since the last message?

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:21 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/34 "2019-08-19T20:21:16Z")

</div>

it looks like this for now but thats totally crap 😃

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8d731c42d12ca8cf7870bf957e464e5f586a20b1.png)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [19 August 2019 20:21 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/35 "2019-08-19T20:21:16Z")

</div>

...Following on from Colin's comment, are they sending power readings, or energy readings?

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:21 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/36 "2019-08-19T20:21:55Z")

</div>

mhhhh what is the difference in english 😃

they measure watt? is that right in english? not Amp

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 August 2019 20:26 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/37 "2019-08-19T20:26:06Z")

</div>

So the value 440.69 means that it is currently consuming 440.69 watts.  
If you want the total used then you can't just add those up, you need to multiply by the time too.

However, to go back to the Join node, in the flow image you posted, if you have configured the node correctly then you will get messages out with the payload containing the values from all four inputs. If it is not giving you that then you have not configured it properly. Double check the recipe flow and if it still doesn't work then show us how you have configured it.

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:44 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/38 "2019-08-19T20:44:49Z")

</div>

ok getting a bit deeper now with your suggestions. did that with the join node and manual setting.  
now i get a long string for the topic of each device with each ones payload.

looks like this:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8bdcc0c1ee72303240d3d02f0e256cecace20960.png)

my function needs a bit more work i know 😃  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1e0dc42fbe9fae4eb83e41ba52022fa6e7f68e26.png)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [19 August 2019 20:45 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/39 "2019-08-19T20:45:25Z")

</div>

> [@nicedevil](#):
>
> they measure watt? is that right in english? not Amp

Watt is a unit of power (Leistung) which is how many watts is being consumed by the device at a snapshot in time.  
kW/h is a unit of energy, and is the accumulation of power over a period of time.

So as an example, a 3kW kettle will use 3kW's of power at any moment in time.  
Whilst... energy consumption depends upon the power used and the time it is being used.  
So to boil a 3kW kettle for 30 minutes would equate to;  
3000(watts) x 0.5(half hour) = 1.5kW/h

From your last post, I assume you are measuring power.

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [19 August 2019 20:48 UTC](https://discourse.nodered.org/t/nicedevils-starting-questions/14454/40 "2019-08-19T20:48:50Z")

</div>

I know that in german 😉 but I didn't know which one is meant in english 🙂

[Previous page](https://discourse.nodered.org/t/nicedevils-starting-questions/14454.md?page=1)

[Next page](https://discourse.nodered.org/t/nicedevils-starting-questions/14454.md?page=3)
