Nicedevil's Starting Questions

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

Dunno if that was my aim :smiley:
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.

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

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.

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.

1 Like

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

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

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

1 Like

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?

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?

1 Like

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.

1 Like

yes I can :slight_smile:

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

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?

it looks like this for now but thats totally crap :smiley:

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

mhhhh what is the difference in english :smiley:

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

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.

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:

my function needs a bit more work i know :smiley:
grafik

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.

I know that in german :wink: but I didn't know which one is meant in english :slight_smile:

1 Like