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

Unify handling of last updated channels through metadata elements #2902

Open
splatch opened this issue Apr 7, 2022 · 4 comments
Open

Unify handling of last updated channels through metadata elements #2902

splatch opened this issue Apr 7, 2022 · 4 comments

Comments

@splatch
Copy link
Contributor

splatch commented Apr 7, 2022

Many bindings have built virtual channels with some hairy logic to keep the "last update time". There is also dedicated profile which allows to track that items which do not have dedicated channels. While both are fair ways I believe there might be a support coming from framework core (read as openhab core) to retain this information in a volatile way without major complications to user setup.

This way could involve dedicated metadata provider which could track state changes and/or updates and make sure timestamps are retained and later provided to the UI and other elements.

Few reasons for metadata provider:

  1. Using metadata does not require creation of additional items.
  2. It exists and is associated with item already.
  3. Can be consumed in limited way by UI (by using oh-repeater).

What is currently missing is disclosing metadata values further through SSE, so eventual update of metadata will not be reflected in all places in a same way. I am also not sure how metadata could be consumed in rules, yet this is so far proposal to provide an unified way to track update time across all bindings.

@J-N-K
Copy link
Member

J-N-K commented Jun 23, 2022

With regard to the discussion in #3000: wouldn't a State that contains the time information be sufficient?

@splatch
Copy link
Contributor Author

splatch commented Jun 24, 2022

Now when I think of it, making it part of the item would make more sense. Update time could be streamed via SSE and utilized just like state and displayState. Not sure of how much impact it would have on openhab cloud, but adding an attribute to SSE stream is not a problem. Having it as part of state is fine on backend side too, but then encoding of state might be affected. I don't have a clear idea how we could pass a state from now and now -1 so TypeParser can deal with it.

@J-N-K
Copy link
Member

J-N-K commented Jun 24, 2022

I think the TypeParser should set the timestamp to null and whoever calls the type parser could add that information via a setTimestamp method. Another way would be to extend the parseCommand/parseState methods with an additional parameter for the timestamp.

@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/openhab-4-0-wishlist/142388/449

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

No branches or pull requests

3 participants