I've appreciated this code here from @Colin.
How would I go about comparing objects, for it seems that objects pass through the RBE + rate limit node without reference to the rate limit.
Here is the code:
const minInterval = 5000 // min interval between outputs, msec
const previous = context.get("previous") || {timestamp: 0}
const now = new Date().getTime()
if ( msg.payload == previous.value && (now - previous.timestamp) < minInterval )
{
// same value as last one and too soon to send again, so send nothing
msg = null
} else {
previous.timestamp = now
previous.value = msg.payload
context.set("previous", previous)
}
return msg;