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

Semantic Tags: developer information/rules #2466

Merged
merged 15 commits into from
Mar 20, 2025

Conversation

andrewfg
Copy link
Contributor

@andrewfg andrewfg commented Feb 22, 2025

This PR improves the documentation for Semantic Tags in two respects:

  1. Rules governing how developers/reviewers shall use the set of OH Core semantic tags in addon development.
  2. Rules governing how developers/reviewers shall extend (or prune) the set of OH Core semantic tags.

The purpose is to have a clear set of rules for Semantic Tags as the fundamental basis for judging a number of current open PRs that aim to refine/improve/extend the current Semantic Tags functionality.

Follows on from the the discussion in openhab/openhab-core#4619

Signed-off-by: Andrew Fiddian-Green [email protected]

Signed-off-by: Andrew Fiddian-Green <[email protected]>
@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/openhab-5-semantic-model-proposal/162526/84

Signed-off-by: Andrew Fiddian-Green <[email protected]>
Copy link

netlify bot commented Feb 22, 2025

Thanks for your pull request to the openHAB documentation! The result can be previewed at the URL below (this comment and the preview will be updated if you add more commits).

Built without sensitive environment variables

Name Link
🔨 Latest commit 2f067b1
🔍 Latest deploy log https://app.netlify.com/sites/openhab-docs-preview/deploys/67b9c1c9584c290008d30a01
😎 Deploy Preview https://deploy-preview-2466--openhab-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 22, 2025

Thanks for your pull request to the openHAB documentation! The result can be previewed at the URL below (this comment and the preview will be updated if you add more commits).

Built without sensitive environment variables

Name Link
🔨 Latest commit c12de0a
🔍 Latest deploy log https://app.netlify.com/sites/openhab-docs-preview/deploys/67d53d4e70204600081a583f
😎 Deploy Preview https://deploy-preview-2466--openhab-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Andrew Fiddian-Green <[email protected]>
@jimtng
Copy link
Contributor

jimtng commented Feb 22, 2025

I wonder if these rules should also be included in the documentation:
openhab/openhab-addons#12262

@andrewfg
Copy link
Contributor Author

andrewfg commented Feb 23, 2025

^
Yes. I will add them.

EDIT: but obviously such complex rules cannot be checked via the XSD schema validation in my other PR. ..

@andrewfg
Copy link
Contributor Author

Also not expected to set "Status" tag on all read-only channel types.

@lolodomo can you please explain the above rule in more detail?

Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg
Copy link
Contributor Author

I added the rules from openhab/openhab-addons#12262 .. however I am not sure if I fully understand them all (in particular the last one) => @lolodomo can you please check them?

@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/openhab-5-semantic-model-proposal/162526/96

@andrewfg andrewfg changed the title Improve developer information concerning tags Improve developer information concerning semantic tags Feb 23, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg marked this pull request as draft March 1, 2025 16:24
@andrewfg andrewfg changed the title Improve developer information concerning semantic tags Improve developer information on semantic tags Mar 1, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg marked this pull request as ready for review March 10, 2025 12:46
@andrewfg andrewfg requested a review from jimtng March 10, 2025 12:46
@andrewfg
Copy link
Contributor Author

Reviewers please IGNORE the lint error concerning numbered lists. Because in this case the numbering MUST flow on from one section to the next -- rather than re-starting from 1. in each section.

Copy link
Contributor

@rkoshak rkoshak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, I think there's some formatting and word choice things to address and it's good to go.

We may need to get buy in from core maintainers since they will be responsible for applying the rules in practice. Do the add-on maintainers need to buy in too?

@andrewfg
Copy link
Contributor Author

andrewfg commented Mar 12, 2025

@rkoshak many thanks for the feedback. I will upload a revised version soon. However for the time being let me address your question about where semantic tags can be applied:

Currently tags can be applied to the following objects with a chain of inheritance as follows:

  • Channel-Type: Point/Property tags applied at design time via the channel type xml
  • Channel: Point/Property tags inherited from Channel-Type above, and/or applied at run time in the binding
  • Item: Point/Property tags inherited from Channel above, and/or all types of tags applied at run time by users

And yes, I am indeed working on a PR to extend the application of tags with a chain of inheritance as follows:

  • Thing-Type: Equipment tag (single) applied at design time in the thing type xml
  • Things: Equipment tag inherited from Thing-Type above, and/or applied at run time in the binding
  • Semantic Model: Equipment tree structure ("create equipment from thing") inherited from Thing above, and/or by users

Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg
Copy link
Contributor Author

@rkoshak I just pushed a new commit; hopefully it addresses your feedback; but please feel free to comment further..

Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@rkoshak
Copy link
Contributor

rkoshak commented Mar 12, 2025

I'm happy with all the changes.

Also not expected to set "Status" tag on all read-only channel types.

I can't speak for @lolodomo but my understanding is this rule is to avoid the case where everyone just defaults to "Status". There Point tag should be the one closes to what the Item does. A temperature sensor should be a Measurement. However, a high temperature alert might be an Alarm. In both cases these represent a Status so Status is not incorrect. But there are better choices.

I think the rule is to use the more appropriate tags rather than defaulting to a generic tag.

@andrewfg
Copy link
Contributor Author

I just pushed another commit with some more improvements.

  • @rkoshak for the avoidance of doubt I removed the point where developers MAY add location tags; we can always add it back later if there is demand..
  • @lolodomo can you please give feedback a) to the question above, and b) to the document in general?

@andrewfg
Copy link
Contributor Author

@rkoshak whilst thinking about examples of possible POINT + PROPERTY combos, it occurred to me that POINT=LowBattery is probably a violation of our (just defined) rules ..

I think it should be POINT=Alarm + PROPERTY=Energy

(or POINT=Alarm + PROPERTY=Voltage).

@andrewfg andrewfg requested a review from rkoshak March 13, 2025 15:25
@andrewfg andrewfg changed the title Improve developer information on semantic tags Semantic Tags: improve developer information / rules Mar 13, 2025
@andrewfg andrewfg changed the title Semantic Tags: improve developer information / rules Semantic Tags: improve developer information/rules Mar 13, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg changed the title Semantic Tags: improve developer information/rules Semantic Tags: developer information/rules Mar 16, 2025
@andrewfg
Copy link
Contributor Author

@stefan-hoehn this PR is ready to merge.

Copy link
Contributor

@stefan-hoehn stefan-hoehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Andrew

@stefan-hoehn stefan-hoehn added this to the 5.0 milestone Mar 20, 2025
@stefan-hoehn stefan-hoehn merged commit 93b8256 into openhab:main Mar 20, 2025
5 checks passed
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 this pull request may close these issues.

5 participants