I'm new in Node-RED, I made flow to storing 2 pcs MQTT msg to MySQL, it is working fine. But in sql rows sometimes 0, sometimes not 0. I think my function can't sending 2 pcs data in one time. I want to know how can I storing 2 pcs msg in one time.
So you are either sending a line with office temperature [MQTT - Office Temperature] - [Data To SQL] - [Mysql DB]
or a line with humidity [MQTT- Office Humidity] - [Data To SQL] - [Mysql DB]
If you want to end up with one line you will have to look at combining the data. One way you can do this is by using the join node, before your function node(s)
If the final outcome is too Graph the results you may want to look at InfluxDB instead with Grafana as the graphing tool. InfluxDB is a time based DB, so is a little more efficient on this type of data.
What software are you using on the device that is sending the MQTT msg's? Since the sensor is a DHT22, it reads both the temperature and humidity at the same time. Why not change that software to send both in one MQTT msg?
The inteval is detemined by what you set for the device. Since you already have the device set up to send data at an interval, that is what it will use. The one thing is to uncheck the `Send to Controller' so you won't get three mqtt msgs when the interval happens
Just be careful not to read from a DHT22 too rapidly as it takes some appreciable time to read. Doing it too often will result in errors. Personally, I wouldn't read it less than 5-10 sec apart but I can't remember the actual limitation as I stopped using these sensors a long time ago. My own sensor platforms produce readings about every 30-60 seconds, anything less is rarely really useful, especially with old sensors like the DHT's.
@Meriam Welcome to the forum. You might have to wait a while since the original poster hasn't been active since the last post on this thread two years ago.
It would be best if you open a new thread showing what you have already tried and explaining what your issue is.