-
-
Notifications
You must be signed in to change notification settings - Fork 457
[DSL/YAML generator] Consider item pattern formatter even without label #5154
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
base: main
Are you sure you want to change the base?
Conversation
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
|
A backport to branch 5.0.x would be appreciated. |
Items without label but with a formatter are now properly considered when generating DSL and YAML syntax. Example: Number SceneItem "[MAP(scene.map):%s]" Bug was reported on the community forum. Signed-off-by: Laurent Garnier <[email protected]>
a6012df to
9e710a0
Compare
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 fixes a bug where items with a formatter (pattern) but without a label were not properly handled when generating DSL and YAML syntax. The fix ensures that formatters are now considered independently of whether a label exists.
Key Changes:
- In YAML converter: Moved formatter handling outside the label condition so
formatfield is always set when a non-default formatter exists - In DSL converter: Restructured logic to generate a label containing just the pattern when no label exists but a formatter is present
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| bundles/org.openhab.core.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java | Moved formatter calculation and assignment outside label condition to handle formatters independently |
| bundles/org.openhab.core.model.item/src/org/openhab/core/model/item/internal/fileconverter/DslItemFileConverter.java | Restructured pattern injection logic to generate label with pattern even when original label is absent |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ain/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java
Outdated
Show resolved
Hide resolved
...ain/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java
Outdated
Show resolved
Hide resolved
...ain/java/org/openhab/core/model/yaml/internal/items/fileconverter/YamlItemFileConverter.java
Outdated
Show resolved
Hide resolved
....model.item/src/org/openhab/core/model/item/internal/fileconverter/DslItemFileConverter.java
Outdated
Show resolved
Hide resolved
....model.item/src/org/openhab/core/model/item/internal/fileconverter/DslItemFileConverter.java
Outdated
Show resolved
Hide resolved
....model.item/src/org/openhab/core/model/item/internal/fileconverter/DslItemFileConverter.java
Outdated
Show resolved
Hide resolved
....model.item/src/org/openhab/core/model/item/internal/fileconverter/DslItemFileConverter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Laurent Garnier <[email protected]>
Items without label but with a formatter are now properly considered when generating DSL and YAML syntax.
Example: Number SceneItem "[MAP(scene.map):%s]"
Bug was reported on the community forum.