node-red-contrib-presence-faker icon indicating copy to clipboard operation
node-red-contrib-presence-faker copied to clipboard

Feature request: define minimal gap between two on periods

Open paede81 opened this issue 4 years ago • 2 comments

Sometimes the window between two on periods is just a few seconds, this did not look like a real human behavior (turn light on and off), therefor I look like a config parameter where I can define a minimal time window between off and on again.

For me a perfect solution would be if I can set something link this:

{ "windowBegin": "00:00", "windowEnd": "23:59:59", "minDuration": 5, "maxDuration": 10, "minCount": 10, "maxCount": 25 "minGap": 3, "maxGap": 5 }

This would generate a sequence which looks like: <ON: 6min> ---OFF: 3min--- <ON: 8min> ---OFF: 5min---<ON: 5min>

instead of currently: <ON: 6min> ---OFF: 2sec--- <ON: 8min> ---OFF: 15min---<ON: 5min>

paede81 avatar Jun 18 '20 06:06 paede81

Thank you for proposing this feature, @paede81!

I guess this could clash with the other constraints that are currently supported (e.g. min/max count): Depending on the values you chose, the node might not be able to fulfill all constraints. One way of dealing with this could be to give certain configurations priority over others. Or eliminate some constraints altogether, e.g. min/max count) and only have min/max gap as a replacement. What would be your preference?

C.

csuermann avatar Jun 25 '20 16:06 csuermann

@csuermann seems Like a great feature, I would personally say have a minGap, potentially no maxGap and minGap takes priority over the maxCount.

So if the windowBegin and windowEnd allows the maxCount only then enforce it.

If however the other constraints are given a higher priority, the ON-to-OFF duration + gap (adhering to minGap & minDuration) should allow for the minCount - if the window is then sufficiently large enough that the array of ON-to-OFF durations + gap’s passes the maxCount, then enforce the maxCount - the remaining window time could then be distributed through the array of ON-to-OFF duration times (not exceeding maxDuration) & gaps at random.

I think there will always be the option of human error in entering the incorrect values - but as long as it’s noted in the instructions how it is designed to work, that’s the most you can really account for I guess?!

Scoobler avatar Sep 26 '20 09:09 Scoobler