Hi,
Sorry for the basic question, new to node-red and all that.
I'm trying to add an element in a JSON object with a function node and the name is conditional to CSV data input ID column.
The setting is that I have some RF tags transmitting ID and temperature and I'd like to assign name depending on who is wearing the tag. Sorry again for this probably simple problem.
Input to function node:
{"ID":"TAG+1 010","temp":27.1}
Function node:
var name = null;
if (msg.ID == "TAG+1 010"){
name = "Alfred";
} else if (msg.ID == "TAG+1 073"){
name = "Cathrine";
}
msg.payload["Person"] = name
return msg;
From that I just get:
{"ID":"TAG+1 010","temp":27.1,"Person":null}
Thanks for any help with this problem!