Two MQTT IN to SQLITE

That makes sense! Good to know.

Sorry but an issue has just occurred. The code I have inside the function is this:

var sqliteTimeStamp = Math.round(Date.now() / 1000);
var temp = msg.payload["loungeSensor/temp"];   // << or whatever the copy path gives you
var humi = msg.payload["loungeSensor/humi"];   // << or whatever the copy path gives you

msg.topic = `INSERT INTO lounge_sensors (date, temperature, humidity) VALUES ('${sqliteTimeStamp}', '${temp}', '${humi}')`
return msg;

The problem is that when checking the table inside phpLiteAdmin I've noticed the readings are duplicated (see screenshot). I've also tested this putting 4 sensors with the same set up and I get in the table the readings duplicated X4.

Any thoughts?

Screenshot 2021-06-09 at 18.10.23

EDIT:

Zenofmud, I can't make further posts due to reaching max of replies as a new user... so I have edited this reply. Here is the screenshot of my flow:

can you attach your flow to a reply.

1 Like

Hi .. maybe its due to the "and every subsequent message" setting you have checked in your Join node.
by unckecking it, you tell the Join node to wait for both the Temperature and Humidity values to arrive from mqtt and then output a joined msg.

2 Likes

Hi UnbornN, that solved the last little bit. Thank you guys!