paviro/MMM-PIR-Sensor

bug in clearing timeout

Opened this issue · 0 comments

I have added logging and noticed the pir.watch sometimes sends consecutive false values (sometimes three times) before a new true value. Not sure why this happens, but when it does there will be multiple setTimeout called for deactivateMonitor.

So even if there is movement, the next movement detection will only deactivate the last setTimeout, and the others will still turn off the display at some point.

Before calling self.deactivateMonitorTimeout = setTimeout(function(), there should always be a clearTimeout, even in the (value == valueOff) case (line 177 of node_helper.js )

If you want I can do a pull request with this.