Migrating OH2 groups (text files) into OH3 GUI

Hi,
I succefully migrated my OH2 environment from 2.x to 3.x.
Now I want to transfer the still existing items text files into OH3 GUI via the “Add items via…” tool.
I successfully migrated the first items via copy/paste out of the items file.
These items had a group assignements. The groups are visible, but not editable in OH3, as they are still defined by the old items text file.
I now tried to transfer these groups, but that is denied, as they are already visible in OH3.
I then tied to delete the group in the text file and add it in OH3 from the scratch.
But this also fails (server error). Maybe as items/subgroups still refer to the now non existing group?
Is there any reliable way to transfer existing groups out of the items text files?

You’ll have to remove the Group from the .items file first and then add it through the UI. So you are down the right path. But there can be a good deal of kruft left around when doing this sort of thing.

I recommend removing the .items files entirely, temporarily. Then restart OH. Finally add the Groups through the UI.

If you have anything remaining in your .items files (e.g. Groups not yet transferred) transfer the .items files back to the items folder, but make sure you’ve deleted any Item or Group you’ve added through the UI first.

You never want the same Item defined in both places.

Hi @rlkoshak,
thanks for your answer.
When you say “remove the groups from the .items file”, do you also mean the links to these groups in the items?
I deleted some groups from items, I already transferred before.
I’m afraid, that messed up something, as the links to an non-exiting group still existed in the GUI.
Do you think, there’s another solution than deleting all items and afterwards importing them again without groups and without any link to groups?

Thanks Joerg

No, I mean that before you try to create a Group in the UI, that Group must not already exist. To do that, it must not exist in a .items file.

Once the Group is recreated, the members should sort themselves out on their own. OH generally ignores it when you make an Item a member of a Group that doesn’t exist.

Well, if it would be that easy.
I deleted a group item in the .items file and tried to recreate the group item in the GUI.
I get a “Bad Request” in the GUI and a warning in the log:

2022-01-08 11:49:25.851 [WARN ] [rest.core.internal.item.ItemResource] - Received HTTP PUT request at 'items/gDG' with an invalid item name 'gDG'.

Did you do the whole process I outlined? As I said, don’t cruft might be left behind so you need to start OH with that item never having existed.

That’s why I wrote that long reply above my

Hi @rlkoshak,
I now solved the issue by stoping OH, deleting cache and tmp folders and restarting OH.
If I now delete a groups in the .items file, I have to be patient, until they are also not visible anymore in the GUI. (If I try to add them right away, I get the problems (cache?) again).

Thanks for your support
Joerg

BTW: I have the

There are still SSE events the queue which may not be delivered (closing now)

in the logs (OH 3.3.0-SNAPSHOT). Thought, this issue was solved. Will open another thread for this issue.