openhab-scripters / openhab-helper-libraries

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

Drop in replacement for Expire Binding #259

Closed rkoshak closed 3 years ago

rkoshak commented 4 years ago

This is a script that acts as a drop in replacement for the Expire1 binding. Because the binding config gets stored as metadata one does not even need to change their Items.

I don't intend this to be a permanent replacement but to be a bridge to whatever comes along to replace it or if the Expire1 binding is no longer supported without a suitable replacement in place. It can also be used by those right now who want to eliminate their 1.x version bindings and retain the functionality.

I mainly wrote it as a challenge to see if I can do it and I'm making an effort of move off of all the 1.x version bindings, even those that don't yet have a 2.x version replacement. Perhaps others will find this useful.

Based on the tests I've done so far it is feature complete and exhibits the same behaviors as the Expire binding except for the fact that the script needs to be reloaded when adding or removing Items to the expire so the triggers can be regenerated. Without a way to trigger a Rule when Item metadata changes I'm not sure if I can ever overcome this limitation.

Signed-off-by: Rich Koshak rlkoshak@gmail.com

rkoshak commented 4 years ago

Once this PR is accepted, I'd like to extract the duration parsing into it's own library, perhaps in core.util. I've found other places where it's useful.

bwosborne2 commented 4 years ago

This 1.x dependency needs to be remove, I believe.

from org.openhab.core.library.items import StringItem

OH cannot find org.openhab.core.library.items

rkoshak commented 4 years ago

This PR is ready for review

CrazyIvan359 commented 4 years ago

Sorry gents, I'm gonna have to disturb the dust on this one. Just a minor change though. @rkoshak I'll be making a PR against your branch in a few minutes.

Stumbled on a bug in removing the old rule, using rules silently fails. Bringing in the ruleRegistry and using that works fine.

rkoshak commented 4 years ago

I'll wait for Scott to give the go ahead before I merge the PR in case he has already started.

jimtng commented 4 years ago

what's the hold up?

rkoshak commented 4 years ago

Still awaiting review. I suspect reviewing community library submissions has been and continues to be a lower priority. Or the maintainers have decided to go a different direction. Any further development on these PRs is halted until they get reviewed. You can find CrazyIvan359's updates at https://github.com/rkoshak/openhab-helper-libraries/pulls

rkoshak commented 3 years ago

I've basically completely rewritten this so am closing this PR. When reviewing submissions to the helper library becomes a priority I'll resubmit. In the mean time I'll keep in in my own repo where I can continue development.