hamsando / node-red-contrib-stoptimer-varidelay

Apache License 2.0
7 stars 2 forks source link

Delay messages by message topic #7

Closed evryschu closed 3 years ago

evryschu commented 3 years ago

Great node - thanks for the good work!

It would be great if the node could separate messages by msg.topic. Being able to do so one can route various messages through this one node, and reset/delay is based on each message topic.

Currently ALL messages are reset when a new msg arrives.

Thanks in advance!

Evry

hamsando commented 3 years ago

I've given it a lot of thought over the last few days. I can see where you are going with the request, but I think it adds too much complexity and overhead into the node (and I think nodes should be pretty simple and do basically one thing). There are a lot of open questions that would result too: What would the timer status indicate when it was operating as multiple different timers at the same time? How many different topics should it keep track of? How would you route the output messages, would you add a switch after the node? Or would the timer node dynamically have 3 separate outputs for each topic? (I'm sure there are other questions as well).

What you are looking for is easily achievable today (and is probably more efficient) with a single switch node routing topics to individual timer nodes. The flow would be easier to follow and there is no confusion as to the status of each timer.

I'll ponder it some more, but to be honest I'm not likely to implement this. Even if I end up not doing it, if you want to implement it, do feel free to fork the project.

hamsando commented 3 years ago

After a thinking about this on and off for the past while, I've come to the conclusion that my previous comment stands - this is already easily achievable today (and is probably more efficient) with a single switch node routing topics to individual timer nodes. The flow would be easier to follow and there is no confusion as to the status of each timer.