Copy DSL & YAML Definition not working for me

With me defining everything in textual configuration files, one thing I was excited about to try out, was to be able to copy DSL definitions, particularly of auto-discovered MQTT Things - to be able to shorten the textual creation of new devices.

When testing it out on my otherwise nicely running 5.0 system, I always get

Screenshot 2025-07-31 at 20.14.29

for Things DSL or YAML, and the same for Items DLS or YAML.

@jimtng Any idea what might be wrong for me or what I might be missing?

Nothing major, as I’ve created textual files for the last decade, but this sounds like a great helper which I would be interested in using in the future :slight_smile:

Are you trying to get all your Things at once? There’s an issue for that open right now. Apparently if there are too many Thing exported at the same time it crashes.

But if you have a mix of file based and managed Things, you probably don’t want them all anyway.

I’m not sure what the limit in how many you can export at a time before hitting that bug, but you should be able to select a few Things from the Settings → Things page and then export the selected ones.

That should avoid the known bug.

Use the “Copy” icon at the bottom when you have what you want to export selected. You’ll be given a choice between DSL or the new YAML format. And then the result will be copied to the clipboard for pasting into your file.

Thanks for the reply @rikoshak, but all fine now. It’s just that it always comes up with this error in Safari (latest 18.6) on macOS (latest 15.6) - even when just selecting one single Thing/Item.

Working fine however in Firefox and Zen. Not sure yet if it’s my strict privacy settings in Safari or a general Safari engine problem.

This is an important detail. I can reproduce this issue.

1 Like

Thanks for the report. Apparently Safari doesn’t allow any asynchronous operations to occur prior to the clipboard copy operation. Since this async operation is needed to fetch the data, it failed.

I know how to solve this but it involves redesigning the UI a little bit. I’ll post an update here once a PR to fix this is created.

PR Created

https://github.com/openhab/openhab-webui/pull/3309

This is just a quick solution without having to redesign the UI. The alternative I had in mind was to present a screen / popup that displays the file definition text so user can see it before copying it to clipboard, but that would require a bit more work. Perhaps in the future.

In any case, we’ll also be able to see the DSL / YAML in the code tab for individual objects once the relevant PRs are merged.

2 Likes

Thanks for looking into this and addressing it, @jimtng !

I’ll be looking forward to using this functionality in Safari in the future.