-
-
Notifications
You must be signed in to change notification settings - Fork 443
YAML configuration: add support for items/metadata/channel links #4776
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
Conversation
This PR is based on and depends on PR #4753. The PR will be rebased when this other PR is merged. |
The PR is almost finished, let's say at 97%. I would like to finish unit tests for YAMLItemDTO class and I would like to add a small enhancement to avoid updating an unchanged metadata or unchanged channel link when updating an item. |
Here is an example of file generated:
|
Since #4724 is merged I think it would be easy to provide a dedicated field for expire. DemoDimmer:
type: Dimmer
autoupdate: false
groups:
- DemoSwitchGroup
metadata:
expire:
value: 30m would be DemoDimmer:
type: Dimmer
autoupdate: false
groups:
- DemoSwitchGroup
expire:
duration: 30m That way all core functionalities would be available directly on the item. You also opted to pull down |
|
That's highly subjective.
I for example have never used it so it's for sure not going to be used by everybody. 😉 I've already searched in in the docs and you seem to refer to the state representation and it seems to be a MainUI feature. Providing convenience for core functionalities is a simple rule which also makes a lot of sense since the configuration and object creation is done by the core. |
You apparently lost one major feature of OH, customising how the item state is rendered. This can be set with Main UI but also with the items file. With DSL, it was either in metadata (stateDescription) or in the label itself. In YAML, it is either in metadata (stateDescription) or in this statePattern field. It is better to separate it from the label, it avoids manipulating the label to extract what is inside [] and it is more intuitive for the user. |
So the Of course I'm aware how to change the shown value by putting the formatting brackets in the label. |
Yes, this is replaced by the statePattern field. It avoids putting several data in the label with a particular syntax. |
I was not aware that the brackets in the label will no longer work and that's a big breaking change. I'm not happy with the name. |
No breaking change as we are building something new. |
9520c8c
to
b619de1
Compare
Done |
This PR adds the support of items in the YAML configuration file. It also includes the support of items metadata and items channel links. Related to openhab#3666 Signed-off-by: Laurent Garnier <[email protected]>
PR is now rebased and is now ready for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances YAML configuration support by adding item support along with metadata and channel link handling. Key changes include updates to the core item factory to register as an ItemFactory, extensive test coverage for YAML DTOs (items and groups), and new file converters and providers for YAML‐based items, metadata, and channel links.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
bundles/org.openhab.core/src/main/java/org/openhab/core/library/CoreItemFactory.java | Expanded OSGi service registration to include ItemFactory. |
bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/internal/items/YamlItemDTOTest.java | Added tests validating item type, dimension, groups, icon, channel formats, etc. |
bundles/org.openhab.core.model.yaml/src/test/java/org/openhab/core/model/yaml/internal/items/YamlGroupDTOTest.java | Added tests for group DTO behavior including base type and function validation. |
bundles/org.openhab.core.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/util/YamlElementUtils.java | Refactored utility methods with condensed ternary handling for config maps and lists. |
bundles/org.openhab.core.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java | Introduced YAML item file conversion and integration with metadata and channel links. |
bundles/org.openhab.core.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/items/YamlItemProvider.java | Integrated YAML item provisioning with channel link and metadata processing. |
... and other YAML-related DTO/provider files | Supporting additions and updates to metadata, channel links, and overall YAML model handling. |
...re.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/items/YamlItemProvider.java
Outdated
Show resolved
Hide resolved
...ain/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java
Show resolved
Hide resolved
Signed-off-by: Laurent Garnier <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thank you Kai. |
Required after the merge of PR openhab#4807 and PR openhab#4776 Signed-off-by: Laurent Garnier <[email protected]>
Required after the merge of PR #4807 and PR #4776 Signed-off-by: Laurent Garnier <[email protected]>
This PR adds the support of items in the YAML configuration file.
It also includes the support of items metadata and items channel links.
Related to #3666