Skip to content

Conversation

@lolodomo
Copy link
Contributor

@lolodomo lolodomo commented Nov 29, 2025

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.

@lolodomo lolodomo requested a review from a team as a code owner November 29, 2025 12:13
@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/yaml-configuration-for-item-with-map-transform-and-no-channel/167340/10

@lolodomo
Copy link
Contributor Author

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]>
@lolodomo lolodomo force-pushed the item_format_but_no_label branch from a6012df to 9e710a0 Compare November 29, 2025 12:22
@wborn wborn requested a review from Copilot November 30, 2025 11:34
Copilot finished reviewing on behalf of wborn November 30, 2025 11:36
Copy link

Copilot AI left a 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 format field 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.

Signed-off-by: Laurent Garnier <[email protected]>
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.

2 participants