Open rkoshak opened 5 years ago
After looking at the core.util library, these are all JSR223/OH specific. I'm not thinking it belongs in community and that is where I'll submit it as the PR.
What's the policy for tests? Right now I have the tests inline with the function. Should those be submitted too? Moved to some other place? Turned off somehow?
Is your feature request related to a problem? Please describe. Performing hysteresis in rules is a common requirement. For example, controlling the temperature or humidity, one wants a gap between the value when you turn on a heater/fan/humidifier and when you turn it off to avoid flapping.
Describe the solution you'd like I've implemented a generic function that works with all the numerical OH Types as well as Python primitives which is reusable. This can free users from needing to implement this behavior.
Describe alternatives you've considered Adding it as a Community library but Michael recommended submitting it to core.utils.
See https://community.openhab.org/t/jsr223-python-working-with-quantitytypes-how-do-i-get-an-int-float/80801/14 for discussion and an early version of the code. A version with appropriate documentation, docstrings, and compliance with the Python style guide will be submitted in the PR.