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

100% CPU usage when windowBegin > windowEnd #7

Closed frabnet closed 4 years ago

frabnet commented 4 years ago

Hi and thanks for you work. I tried faking presence for all night by setting windowBegin > windowEnd (22:00 to 05:00) but I found my server with 100% cpu utilization and the only way to fix was a restart of Node-RED. Tested with windowBegin < windowEnd (example 22:00 to 23:59) and everything works good. Of course this can be solved by setting 2 presence faker nodes, one from 22:00 to 23:59 and the other from 00:00 to 05:00, but it's not elegant. I think that fixing code to work like that would be difficult. An easier option would be: ask the user for trigger time and duration time (timeBegin 22:00 durationTime 07:00 hours), this would fix the problem. What do you think?

csuermann commented 4 years ago

Hi @frabnet ,

Thank you for making me aware. I fixed the code to allow windowBegin > windowEnd in v.1.5.6.

Best regards C.