openhab-scripters / openhab-helper-libraries

Scripts and modules for use with openHAB
Eclipse Public License 1.0
88 stars 69 forks source link

adds a debouncing decorator function #313

Closed Dan1001 closed 4 years ago

Dan1001 commented 4 years ago

This is a simple way of preventing a rule from firing multiple times when its trigger fires multiple times in quick succession. Neater and simpler than adding a lock or timer into each function manually.

I am, however, a python novice, and have no doubt this can be improved upon!

Dan1001 commented 4 years ago

Thank you!

This is all a bit beyond me - so if you can submit that would be great. I don't want to use my name, but will send you a PM with my details.

Also, I'm not sure how to amend the code now, but if you see the forum thread, I've amended the function to prevent the unintended feature of blocking a rule running again if it ever fails with an error.