csuermann / node-red-contrib-presence-faker

Node-RED node that fakes presence in a smart home by switching devices (e.g. lights) on and off at random times.
MIT License
24 stars 2 forks source link

Presence-faker shouldn't "reset" if already running and input payload == true #1

Closed RomRider closed 4 years ago

RomRider commented 5 years ago

Hey,

I'm using your node and it's really great! One thing however I'd do differently is if the node is already active, sending an input payload with true shouldn't reset the node's "random" time.

Also, there should still be a method to reset the random timers every day. Currently, once the node is enabled, everyday the random times are the same.

Here it's should test if it's already active, and if it is, do nothing: https://github.com/csuermann/presence-faker/blob/master/presence-faker.js#L156-L163

What do you think?

Cheers

csuermann commented 4 years ago

Hi @RomRider,

Please accept my apologies for coming back to you so damn late! 🙏

The rescheduling upon each TRUE message is actually a feature. 😹 If you need to circumvent that, you could, for example, use an rbe (report by exception) node in front of the presence-faker node.

image

Regarding your second point, I could not reproduce your problem of schedules not being re-created randomly the next day. In fact, a new random schedule should get created whenever a defined window begins.