Notification from node red

So the debug of COM5 is following:

So that’s the third different message coming out of the coms node. Are there any more types?

No there aren't , always the same types. Actually only msgid change every time but i don't know if it's important.

In your "function email" function just before the line:
msg.payload="time" + d + message + msg.payload;
insert the following
node.warn(msg.payload)
and run the flow - (note you can make it easier to debug by disconnecting the serial in node and adding an inject that puts '55,22,0` in the msg.payload.)

Then run the flow and tell me what you see

So, i did the change and i have gollowing result:

Unfortunately the message is still "water level normal" altough the mmwaterValue is 9mm.

Please make a copy of your "Trigger Alarm" function node so you have a back up. Then edit the one in the flow and use this (I've just added a couple node.warn() statements)

Attach an inject node to the "Function LoRa" function node with a payload of "54,22,0" and deploy and press the inject node's button.

Examine the debug output and tell me what you see happening and why.

i did that but maybe i shoud change the code of function because i ave the following error:

Lora function has this code:

lora function

Why did you create three inject nodes each with one of the values???

for some reason it's wrong to put 1 inject with 3 numbers:

55,22,0
inject 55

You see the quotes around the three numbers?? That tells you it is a string not a number so you should use the a/z option not the 1/9 option

O yes you're right. So i did that and i have no any result:

By the way i didn't change anything in the code of Lora function.

I apologize, I neglected to give you the "Trigger Alarm" node with the changes

[{"id":"eb603aed.51e128","type":"function","z":"41cc7a8d.3919e4","name":"Trigger Alarm","func":"var mmwaterValue=msg.payload;\nvar alarm_flag=context.get(\"alarm_flag\");\n\nif (typeof alarm_flag==\"undefined\")\nalarm_flag=false;\nnode.warn(\"debug1\");\n\nif (mmwaterValue>3 && !alarm_flag)\n{\n    node.warn(\"debug2\");\n    alarm_flag=true;\n    msg.alarm=1;\n    context.set(\"alarm_flag\",alarm_flag);\n    return msg;\n}\nif (mmwaterValue<=3 && alarm_flag)\n{\n    node.warn(\"debug3\");\n    alarm_flag=false;\n    msg.alarm=0;\n    context.set(\"alarm_flag\",alarm_flag);\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":320,"wires":[["372cfca1.f56a74","3d0a15e4.331e6a"]]}]

It's ok don't worry. So, now my result is this:

Is almost the same with the previous ( i put the trigger alarm with your changes).

So have you looked at the debug statements and looked where they came from in your code?
Can you tell me why some of the node.warn() statements worked and some didn’t?

Look at your code!

Yes i can see that. Debug 2 and debug 3 are not worked but i don't know why. Actually when i put my water sensor 1 mm ,then had to have debug 3 as a resault but i don't. Unfortunately i don't know why happen this. It's very strange.

It's not strange at all. The program is working exactly the way you 'told' it to work, just not the way you 'want' it to work, But now you have an inside as to what is gong on.

What needs to happen to get eithor 'debug 2' or 'debug 3' to show up?
Maybe you want to use a node.warn() to display a variable or maybe two node.warn() to display a second variable.

If you read the documentation about functions (Writing Functions : Node-RED) it will show you how to do it.

Hmm ok i understand! I will read whore documentation about functios and maybe i will send you again. By the way thank you very much!

Do you know how to draw a truth table? If so, draw one for your two IF statements and look at the results.

Unfortunately no because i am new in Node-red. But i can search this, it's seems good idea!!

a truth table i a table you write out, If you have two switces that can be off and on it would be

SW1 | SW2
off | off
off | on
on  | off
on  | on

using that you can test conditions in an IF statement so if you had an if statement with an or condition:
if ( (sw1 == "on") || (sw2 = "on") )
then evaluating using the truth table would look like this

SW1 | SW2 | LIGHT
off | off | OFF
off | on  | ON
on  | off | ON
on  | on  | ON

With an IF statement with an and condition
if ( (sw1 == "on") && (sw2 = "on") )
then evaluating using the truth table would look like this

SW1 | SW2 | LIGHT
off | off | OFF
off | on  | OFF
on  | off | OFF
on  | on  | ON

It is a another way to look at your code when trying to see what is going on.