Is it possible to delay payload, accept payload update, forward on a certain time interval/time?

my MQTT source can produce packets at a random intervals.
I have no need for fast logging.
Is it possible to make node-red provide this logic?
at 10:10 , 10:20, 10:30 a certain payload object arrives, but only at 00minutes (once a hour) the last packet is forwarded to next step. so that at 11:00 - the payload from 10:30 is processed. (payload from 10:10 is overwritten by 10:20 , 10:20 payload os overwritten by 10:30 payload, which is let thru at 11:00)

You can use a change node to store the value in flow or global context and then use an inject node to (at the desired time), grab the value from context & and use it as desired.

My attempt:

Screenshot from 2022-12-26 10-00-35
-the "deep copy value" was just an desperate attempt :slight_smile:

limited to two pictures, so here is the rest:

But the output is not as expected: I the debug shows me:
Screenshot from 2022-12-26 10-01-04

I expected the msg.payload to look something like this { "battery": 57, "humidity": 52.37, "humidity": 52.31, "linkquality": 45, "power_outage_count": 9, "pressure": 997.3, "temperature": 4.08, "pressure": 997.4, "temperature": 4.14, "voltage": 2935 }

What am I doing wrong?

The issue is you set global.last but then restore global.payload!

Use the context viewer on the right hand side bar to see what is stored where.

Ouch - that was embarrassing.
Thank you. -also for teaching me about the context viewer.

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