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
Thing migration: channels order is lost #3584
Comments
This can't be solved because we don't have access to the channel ordering of the XML. It's also not an issue because it works fine the way it is now. |
It is an issue because it introduces something unexpected. Issue #3442 was created the last time it happened, that means it is something important for a part of users/developers. |
There's an easy fix: delete the thing and re-create it. |
I am not 100% sure about your statement. With #3448 we (once more) have the channels in the order in which they were created via the XML. So before migrating the thing, one could cache the prior channel order, and when the channel is recreated, instead of adding at the end of the list, it can be re-injected into the new channel list at the correct position. |
That was different, we just used a collection that preserves order. Again: there is no reason why order is important. |
IMHO there IS a reason: it is more user friendly in Main UI because the channels are shown in a logical order defined by the developer (probably more important channels appearing on top, and grouping similar channels together (e.g. battery-level and battery-low..) |
Then let's revert the thing updates. If we force users to delete and re-add things, the very important order is ensured. |
We are not going to revert but if the issue can't be fixed, this "limit" should be at least documented/explained. In practice, the channels order is important mainly when a thing has many channels. |
In general, since most changes still require user-interaction (e.g. change of linked item, link an item, remove a broken link), changes to existing thing-types, especially updating, not so much adding channels) should still be made with some thought if the change is really worth it. |
^ |
Here you go..
|
I don't understand what the benefit of that is. Usually if a thing is changed, channels are removed (doesn't affect channel order) or added (will be added at the end). Updating the channel-type should be avoided id possible, they are in nearly all cases breaking (because except in cases where bindig-specific channel-types are replaced by system-channel-types they usually require changes to the linked thing). Also it doesn't work that way because the channel list is internal to the |
This is indeed correct. If you read my message more carefully, I said that I would provide demo code for how I would implement it in a specific binding. |
Looking at the content of DB file org.openhab.core.thing.link.ItemChannelLink.json and considering the results of my test with the meteoalerte binding, it looks like when a channel type is updated for one channel but the channel UID is unchanged, the link to the item is still valid after the upgrade. The channel type UID is not stored in the DB file, only the channel UID. |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/come-back-and-learn-how-to-use-file-based-configuration/147067/15 |
When migrating a thing for example by changing a channel type, the updated channel is added at the bottom of channels.
The initial order of channels (thought by the developer) is then lost.
The text was updated successfully, but these errors were encountered: