Searching something like filter, but time based

Hi,

I am using Node-Red to send data from my Solar collector to KNX, mostly status information. IN order to reduce the amount of data being sent, I have included a filter node to only pass messages where the payload has changed.

But I want also each parameter from the collector to be sent for example at least once per hour (ideally at a scheduled time), because some pumps for example don't change their status for weeks.
How can I do this?

thank you!

HI @andre78 !

As long as your Solar collector regularly sends data, you may use a delay node in rate limit mode put in parallel to your filter node(s).

I guess you could, at your chosen time inject a spurious value eg "dummy" which would pass through the filter node[s]. Use a switch node to then throw this value away. The next real value arriving at each filter would then be passed through.

It would give a neater flow if you could use a single filter node, applying the filter seperately for each msg.topic, or other msg property.

I was looking at this, but was under the impression that when there's no message sent for many hours it wouldn't send the last value on a regular basis.

Correct. That's why I made the constraint ...

:wink:

It should be possible to create function node that stores the latest (incoming) value and forwards it at a given schedule. Have you searched the node database if there's already a contrib node doing such a job?

After the filter insert a Trigger node configured to resend the message each hour that there are no messages.
image

2 Likes

Ooh didnt know it did that!

fantastic, thank you all for your help! I think the trigger node is exactly what I am looking for. Giving it a test now...

The trigger node will not give you a scheduled time, @jbudd solution possible would with some alterations.

I suspect that to re-release the last received messages exactly at a specified time will require some sort of queue node - maybe node-red-contrib-queue-gate.

I'm not sure if that node allows a separate queue per topic though, can't check right now.

There is a semaphore node from @marcus-j-davies too, don't know if that would be applicable.

1 Like

Thanks for the tap @jbudd :pray:

@andre78,
If you need to give messages exclusive access to some part of your flow, whilst holding back other messages waiting to gain access, then I have a node that may help.

it's a pretty advanced semaphore node, allowing great control over access, to different parts of the flow,
whilst at the same time offering fail-safe - i.e if a part of your flow becomes dead-locked for example.

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