Hmm..so, do you suggest me that i have to write a code (in trigger alarm function) with this if that you send me?
No, I’m trying to tell you to look at your if statements and analyse why they are not doing what you want them to do.
Hmm ok i understand. I will search it. Μaybe the link of the functions (Writing functions : node-red) you sent me will help me.
Why don't you add two node.warn() statements just before the first if
statement and display the contents of the values you are testing in the if statements???
It seems to me that would be an easy way to see why they are working or why they are not...
do you mean that?
Well I would display the value of the two variables being used in the if statements. If you go read the documentation about functions, there is an example of how to do that.
So i ran it with that way:
Before if, i have as a result debug 1,2 and 3. But iside if i haven't for some reason.
Maybe i should run it with that way?
node.warn("my var xyz = " + xyz);
(Αs the example says).
you could do that, but since you don't have a variable in your function called 'xyz' I don't think it would show you anything useful. maybe display a variable that you are using in your code...
Yes of course I just meant it that way. In fact the correct is that:
node.warn("debug1 - mmwaterValue=" + mmwaterValue);
since there are two variables in your if statements, that might not be enough to determine what is going on.
So, the problem is iside if. As result doesn't seem the debugs:
with this function "trigger alarm":
Actually, node.warn() seems as result only outside of "if".
so that should tell you that the if statment is never 'true'...I wonder why?
How much experience do you have with programming?
Me too i wonder! Hmm i haven't many experience. So, i found the solution. I had to split the 3 variables and take only the "mmwaterValue" and then to write a very simple code. I did it and it worked. But thank you very much for your advices, honestly!! I appreciate that!! By the way i will show the solution and i will mark it for other people.
FUNCTION:
FLOW:
Why do you have the line
var message = “”;
Since you never reference ‘message’ in the rest of the code?
You've right, maybe not needed.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.