Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expire] Add an optional flag to have Expire reschedule on change as opposed to update #2542

Closed
rkoshak opened this issue Oct 27, 2021 · 7 comments · Fixed by #2739
Closed

Comments

@rkoshak
Copy link

rkoshak commented Oct 27, 2021

NOTE: this might be a duplicate of #1994 and I can close it if that's the case.

The problem is that lots of bindings will update Items periodically, sometimes as often as once a minute, even when the Item's state has not changed. Unfortunately, if one sets an Expire timeout greater than how often the binding updates the Item that means that the Expire will never happen.

If we had a flag to tell Expire that we only care about changes, not updates, we can support use cases like commanding the bathroom fan to OFF after five minutes of it being ON even when the binding keeps updating the Item every minute.

Looking at ExpireManager I think it would just be a matter:

  • Adding the optional flag to ExpireConfig class
  • In processEvent, if the change flag is set ignore events of type ItemStateUpdate
@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/using-expire-as-a-timer/127771/8

@J-N-K
Copy link
Member

J-N-K commented Feb 6, 2022

From the technical standpoint (regarding the implementation) this is easy, the question is how to configure that (backward compatible) in the metadata.

My best idea would be to add ,ignoreStateUpdates at the end. The only drawback is that if someone wants to use ,ignoreStateUpdates as last part of a string value for the second parameter this will fail. IMO this is tolerable, since it sounds like a rather uncommon use-case. WDYT?

@rkoshak
Copy link
Author

rkoshak commented Feb 7, 2022

I'm not sure how the Expire function works but since it's metadata we could add a configuration option along the lines of expire='5m,command='OFF' [ignoreStateUpdates='true'] which should avoid the exceedingly rare possibility that someone would want to have "ignoreStateUpdates" as part of the string value. But that raises all sorts of questions (e.g. why is command='OFF' not a configuration option too?

I don't have a strong opinion either way. I think your proposal would be more internally consistent with how the Expire metadata already works.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/expiration-timer-via-item-metadata-seems-to-fail-erratically/135022/3

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/turn-off-light-when-its-on-for-x-hours/153336/5

@michel53
Copy link

The ignoreStateUpdates parameter is not yet documented here
https://next.openhab.org/docs/configuration/items.html
right?

@rkoshak
Copy link
Author

rkoshak commented Jan 25, 2024

It does not appear so. Updating the docs would be done on the openhab-docs repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants