IMO the GenericThingProvider should be rewritten as pure Java class. It should
generate a collection of UIDs for all things that are in the cache for this model
parse the model and generate all things in a new collection
for all things in the collections from step 2 check if the UID is already in the collection of step 1
– if present: check if things are equal, if not, replace the thing in cache, remove UID from the collection of step 1 and notify listeners about updated thing, otherwise do nothing (prevent unnecessary updates)
– if not present: add thing to cache, notify listeners about added thing
for all UIDs still present in the collection from step 1: remove from cache, notify listeners about removed thing
IMO we should also enable strict validation: in case of any error, remove and ignore the model in total. Since in that case probably a lot of things are missing, it is more obvious to those that don’t look at logs.
Looks like even deleting the .things file doesn’t always remove things from the system, so I will need to keep stopping OH, clearing cache, starting OH whenever I make changes to things. If there just be some log telling me why it is not working…
Thanks. I’m reading your description and it seems like there is an issue in how OH handles things. Has this handling changed from OH3 to OH4 (even slightly), as this issue started after upgrading to OH4?
Regarding validation, people in this thread who believe there is another file, or a validation error in my things file is making incorrect assumptions as there are no other things files, and there are no validation errors (unless there are hidden errors OH isn’t logging), and that exact same things file worked fine on OH3, and also works on OH4 - just the things are not getting updated/removed in OH4.
I’ve provided all the details I can think of, so is there something more I could provide or try to do, or shall we consider this one as too difficult issue to investigate and fix?
Attached is a video of how it behaves, there is something triggering the issue as after a certain point, it fails to refresh items. I couldn’t repro it just with the HTTP binding, but as soon as I threw in some other thing definition, issue started.
The exact things I used for testing so you can test if it repros for you. I recommend following my steps exactly as you might not see the issue if you just throw in the definitions and comment them out/in.
I recently upgraded to 4.0.2. When I saved an item or rule file in OH3 the frontail logviewer would say it was reloading and say there were errors if there were any. I no longer see anything in frontail. I’m trying to remove/add things to my sitemap. The File saves, but the sitemap doesn’t change.
Seems to be working better on 4.1 milestone. Some strange issues when saving files, though, getting intermittent permission denied messages on the text editor. Not sure if it is due to milestone issues…