Hello, i have a flow that 16 different sensor values recieve from mqtt.
node as id
msg.topic : "SENS/12532/ID"
msg.payload : 12532
node as temp
msg.topic : "SENS/12532/TEMP"
msg.payload : 24
node as humidity
msg.topic : "SENS/12532/HUM"
msg.payload : 86
node as light
msg.topic : "SENS/12532/LIGHT"
msg.payload : 2356
i get 16 different measurments for one sensor. and there is lots of sensor. "SENS/" and "/TEMP, /HUM, /LIGHT etc." are fixed values but 12532 is change for each sensor.
According to the scenario, i how to call msg.payload data at FUNCTION node for all measurements at each sensor. I want to make node to send measurements to MYSQL by using function.
Without knowing the schema of your table, it is hard to guess at what you need.
If all those readings need to be in one row of the database, you will need to join the together (use a join node) into one msg.
You can also use the mysql node to issue the insert command,
Are you sure that the sensor does not have a mode where it will send all the values in one message? What sensor is it?
Otherwise, if you are stuck with that data format then I think I might have a table for each measurement (temp, hum etc), with timestamp, value, and sensor id in each.