I have a noda with a function as below.
I need to register the maximum and minimum temperature that occurs during the day.
The function works up to the first occurrence of a negative temperature, the first "minus" is registered and then already the condition t < TMin is not fulfilled.
What else do I not know? ..I would appreciate your help
.
I need to register the maximum and minimum temperature that occurs during the day.
The function works up to the first occurrence of a negative temperature, the first "minus" is registered and then already the condition t < TMin is not fulfilled.
What else do I not know? ..I would appreciate your help
[syntax=javascript]
var t = (msg.payload*1).toFixed (1);
var Tmax = flow.get("tempMax");
var Tmin = flow.get("tempMin");
node.warn("t="+t);
node.warn("min="+Tmin);
node.warn("max="+Tmax);
if (t > Tmax){
flow.set("tempMax",t);
node.warn("=max");
}
if (t < Tmin){
flow.set("tempMin",t);
node.warn("=min");
}
return msg;
[/syntax]