Hello NodeRED Community,
i have a quite bad issue which i can not solve out of the box:
Currently i have a function node which has this function that is not working:
var valueSensorMode = msg.payload.valueSensorMode
var valueHardUpperLimit = msg.payload.valueHardUpperLimit
var valueLimitValue = msg.payload.valueLimitValue
var valueHardLowerLimit = msg.payload.valueHardLowerLimit
var currentValue = msg.payload.valueInteger
if(valueSensorMode!== "standby" && currentValue > valueHardUpperLimit){
msg.payload.valueResult = "out of upper limit"
return msg
}
if(valueSensorMode!== "standby" && currentValue < valueHardLowerLimit){
msg.payload.valueResult= "out of lower limit"
return msg
}
if(valueSensorMode!== "standby" && currentValue > valueHardLowerLimit && currentValue < valueHardUpperLimit){
msg.payload.valueResult = "value ok"
return msg
}
if(valueSensorMode=== "standby"){
msg.payload.valueResult == "evaluation not available"
return msg
}
I have the following message / msg.payload as an input format:
{
"sensorTime":1673284939618,
"valueInteger":114.9,
"valueMachineMode":"standby",
"valueHardUpperLimit":2,
"valueLimitValue":0,
"valueHardLowerLimit":-2
}
And I am expecting an output message / msg.payload (according to the dedicated intput) that has an additional field which is the "valueResult":
{
"sensorTime":1673284939618,
"valueInteger":114.9,
"valueMachineMode":"standby",
"valueHardUpperLimit":2,
"valueLimitValue":0,
"valueHardLowerLimit":-2,
"valueResult": "evaluation not available"
}
Can anybody help?