openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[RFC] Change loading mechanism for *.things and *.items files

Open spacemanspiff2007 opened this issue 2 years ago • 3 comments

Currently when a file is edited all items from the file get removed and then the items from the file get re-added again. This results in a log of items/things loosing the current state and runtime data.

A better solution would be in case of a file change to build a diff between the already existing items/things from the file. Objects that were removed get deleted, objects that were change get changed and objects that were added can be added normally.

spacemanspiff2007 avatar Dec 17 '22 07:12 spacemanspiff2007

AFAIK, this is no longer the case in 4.x? i.e. it now leaves the unchanged items alone and their states remain unchanged?

jimtng avatar Jan 31 '24 02:01 jimtng

I think there was some work on the items loader so at least for *.items files this should work now. I'm unsure about the *.things files - I think it's still an issue there.

spacemanspiff2007 avatar Jan 31 '24 05:01 spacemanspiff2007

I'm unsure about the *.things files - I think it's still an issue there.

~~Can you try and post steps to reproduce the issue? I just did some quick tests, it seems that changes are picked up.~~ I can confirm this. I tried with two things in one .things file, changing one's settings also caused the other one to be "updated".

I posted a PR to fix detecting changes in .items channel configuration (e.g. for profiles), hopefully that'll get merged in the next few days.

jimtng avatar Feb 01 '24 01:02 jimtng