Help with dropping messages within a timeframe


I've a few temperature sensors around the place. Each has a topic for room name and spits out the temperature value as the payload.

I am trying to store a value in context every 10 minutes, but the every 10 minutes part is proving tricky. I've tried the limit node set to each msg.topic, but the time is not applied to each topic, just to each outgoing message (the second topic can take 20 minutes, the third 30 minutes). Would be perfect if it applied to each topic individually.

I guess I could put a limit for each sensor, but doesn't seem the most elegant solution if the sensor count goes up.

The purpose of this if for an icon to show if the temp is going up, down or around the same. I compare the current temp with the stored value. Is there a better way to do this?

Make up a flow which is nearly the same as the real one.

But instead of getting the value from the sensor, set an inject node to do that.
(Actually, have a couple with different values to even better explain the problem)

And instead of what ever stuff you do down the track, put a debug node on the part where you want to see things happen.

Then: post the code (use the </> button when pasting.) and maybe people can help.

Thanks for the reply. Yes I have the simplified code. The limit node is set 'Send each topic in turn' queues them up, can take a long time if many topics. 'Send all topics' works better, but it seems to be on a timer, so it may be updated anywhere from 1 second up to the time set. I've learnt a lot about limit anyways! :smiley:


SO what is the use of the limit node?

That won't store the values in context. You say you want to store the values "in context for 10 minutes" then your code has a limit node.

I'm missing something.
And sorry, it is 22:31 local time. Bed time.

You may need to explain better what you are wanting to do.

In your flow you have a Delay node which looks to be configured correctly except that you probably want Send All Topics, and you have selected 1 message every 10 seconds, whereas you say you want 10 minutes. So change those and every 10 minutes it should send the most recent message for each topic.

Hey Colin. The 10 seconds were just for testing. Send all is better, but almost none of the values will be 10 minutes. The limit node seems to run on a timer, not from when the messages come in. The message could be in the queue for 1 second to 10 minutes.

Yes, that is how it works, but that is what you said you wanted (to store values every 10 minutes).

If you want to individually rate limit the topics so that a new message is sent immediately if at least 10 minutes has elapsed since the last message for that topic then I think you will have to split out the individual messages based on topic and feed each one through its own Delay node configured for All Messages. Or do this earlier in the flow before they are channelled into one wire, if there is such a point in the flow.

Sorry to be late to the party... I think you just need the "Send all topics" option set - so it will then send the last message to arrive on every topic it has seen in the time period set... so every x mins it will send the latest value for each topic...

My understanding is that @philosoma does not want to have to wait for the next ten minute tick if, for example, a sample for a particular topic arrives 11 minutes after the previous one. I am not entirely certain that is what is required though.

Following a post in another thread I realise that a Trigger node configured as below may do what @philosoma is looking for

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