How to send multiple values in node-red

Hi, I am a noob in this. I am working with wireless Vibration and temperature sensor. I want to send an email alert of vibration and temperature.

I have created a function node to send a single value.

it's working.

but I want to send multiple values in a single function node.
error2

Any leads will be a great help.
Thanx in advance

The docs describe how to send multiple messages from a function node: https://nodered.org/docs/user-guide/writing-functions#multiple-messages

I have created this but, it is sending only one value.
error3

Try setting your debug to display all the message rather than just msg.payload

Now this is the output
error4

Go and look at the link on sending messages again. You have written it to send each message to a different output (but have only allowed one). You want to send all the messages to one output.

I have connected debug node to this function node only
error5

Is that comment a reply to my point about the fact that have coded it to send one output to multiple outputs instead of multiple messages to one output? If so then I don't understand the relevance of it.

I want to send multiple values in a single function.otherwise I have to create multiple function nodes to send multiple values.

So you want to send multiple values in one message?
i.e just as they arrived in your function node?

Or do you want to send different values in different messages along one wire to the next node

Or do you want to send different values in different messages to different nodes?

Do you want to send multiple messages each containing one value, or one message containing multiple values? We have assumed here that you are trying to send multiple messages as that is what you seemed to be asking and what you coded into your function node. Your data coming in is already multiple values in one message so it is not at all clear what you are trying to do.

I want to create email alerts for a particular value of vibration and temperature.
But Vibration comes in different values like rms_x,rms_y,rms_z etc
error2

I have created a function for sending temperature value

like this i want to create alerts for different vibration values.
But the problem is i have to create multiple functions for each value.

So i want to create a single function for multiple values ,like above example

Hi @adamf

If you want each of those messages to be sent, one after the other, from the single output of the Function node, then all you need to do is change:

return [ RMS_X, ..., Temperature] ;

to

return  [ [ RMS_X, ..., Temperature ] ] ;

Alternatively, if you want to conditionally send some messages you could do:

if (msg.payload.temperature > 25) {
   node.send({
      topic: "Subject: System .... ",
      payload: "Temperature:" + msg.payload.temperature;
   });
}

if (msg.payload.otherProperty > 10) {
   node.send({
      topic: "Subject: Something something .... ",
      payload: "Something:" + msg.payload.otherProperty;
   });
};

return;

By the way - please try to avoid sharing screenshots of code. It makes it impossible for us to suggest changes without retyping your code. As longs as they are relatively short, paste in your code here with ``` on a new line before and after.

In that case you were nearly right in the function posted, except you have told it to send them to multiple outputs. As I said look again at the link posted. You need to send an array containing an array, so change the last line to something like

return [[ RMS_X, RMS_Y, ... ]]

Also please don't use the word values when you mean messages (each containing a value).

Thanx for the help, I'll try this.

This is good solution,but if 6 or 7 values are true at same time,then it shows error

SMTP Error: 454 4.7.0 Too many login attempts, please try again later

or

"Error: Invalid login: 454 4.7.0 Too many login attempts, please try again later. d6sm2996397pgf.55 - gsmtp"

but it is sending emails also
now the problem is,it is sending different mail to different value like rms_x,rms_y,min_x etc.

How can i send only mail containing all the values which are true

I also tried this code

if (msg.payload.rms_x >500 || msg.payload.rms_y >800 || msg.payload.rms_z >500 || msg.payload.max_x >50 || msg.payload.max_y >50 || msg.payload.max_z >500 || msg.payload.min_x <0 || msg.payload.min_y <50 || msg.payload.min_z <50 )
 {
     msg.topic = "Subject Vibration has been exceeded";
     msg.payload = "Vibration:" + String(msg.payload.rms_x,msg.payload.rms_y,msg.payload.rms_z,msg.payload.max_x,msg.payload.max_y,msg.payload.max_z,msg.payload.min_x,msg.payload.min_y,msg.payload.min_z);
 
     return msg;
 }

Output

object
topic: "Subject Vibration has been exceeded"
data: object
nodeId: 0
firmware: 1
battery: 3.2940600000000004
counter: 84
sensor_type: 8
sensor_data: object
sensor_name: "Vibration"
type: "sensor_data"
addr: "00:13:a2:00:41:91:25:d4"
received: 1567671204814
original: object
payload: "Vibration:134.47"
_msgid: "3a2270bc.fa72d"

only sending first value.
please help me with this

Thanx

Try changing your logical operators for or to and

https://www.w3schools.com/js/js_comparisons.asp

Yes Sir,I know that,I have used that one also,but it requires all the values to be true.

then only it will send mails

can we do with this solution to send all the values in one mail