I use this thread. I testing another way for my problem but i still in the same, the way i´m used is this:
My function is programmed like this:
if (typeof msg.payload === 'number') {
msg.payload = true;
} else {
msg.payload= false;
}
return msg;
When I run the program this gives me the following values of msg.payload:
14/02/2019, 09:45:01[node: test function](http://10.6.4.101:1880/#)ns=2;s=SensorIndutivo : msg.payload : boolean
true
14/02/2019, 09:45:01[node: value received](http://10.6.4.101:1880/#)ns=2;s=SensorIndutivo : msg.payload : number
32.82964323001333
in the dasboard the led when it is true is green but when the sensor stops sending data it does not turn red (value false). The msg.payload of value received when sensor stops not send any value and not turn to red.