Write Data to database in interval

Hello,
I have the following problem:

I get data sent every second via MQTT.
However, I only want to write this data to the database every 30 seconds, otherwise it will become too large.
Currently, the data comes in via MQTT, I write the SQL statement and then write this to the database.
How can I ensure that it is only triggered every 30 seconds? Unfortunately, I can't change anything about the MQTT push.

Thank you very much for your help.

Hi @Janaros :grinning:

You can use a filter node set to rate limit: 1 msg per 30 sec (or is it 2msg per minute?), discard intermediate messages.

Did you mean a Delay node?

I probably do, thanks.

I'm not in front of a computer just now so I said the first thing that entered my head!

Lucky it wasn't my shopping list or something...

@Janaros, if you use a Delay node as suggested, and set it to Rate Limit for Each Message topic, and make sure all messages have the same topic, which I guess they will as they are coming from MQTT, then it will release the messages on the minute and half minute, which may be desirable for nice timestamps in the database. If you leave at the default of All Messages then they will not (generally) be on the minute/half minute.

Thank you.
The Delay node worked fine!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.