"Function tried to send a message of type number"

I'm sure this is some type of newb thing. I'm trying to return a value from my array with:

return msg.payload[0].V

(Yes, I want the first value in the array. )
But I keep getting this error:

"Function tried to send a message of type number"

Does the return need to be converted to a string or some other format?

2 Likes

Object must be returned. msg is object. Object can have properties. Mostly we use payload for transport the valuable info. This payload property can be any type.
return msg.payload[0].V sends out number as V is probably number in your case.
You should use that V as msg.payload
msg.payload = (manage the value of V here).
then return msg

3 Likes

thank you your comment fixed it.

msg.payload = msg.payload[0].V
return msg

2 Likes