I’ve migrated to Openhab 3 and now see a lot of invalid links in the Items dashboard.
I want to delete all those invalid links.
If I click on a unitary invalid link, I can do it. But it would take hours to click every link on every item.
Is there a command to clean all the invalid links programatically ?
The REST API is designed to permit doing things programmatically.
Thank you Bruce ! As nearly everything in computer science
But to go beyond, I was just wondering if something more directly accessible was existing, like a documentation entry pointing out a button “cleanup” or an automatic cleaning algorithm as a service ?
There is no automatic cleanup service in OH. You’ll have to “manually” remove the erroneous links. Given the REST API that would be scriptable. Or you can open the JSONDB file and manually remove them.
There are times where one may have temporarily removed the Item or temporarily removed the Thing but you do not want to remove the Link. If the Link were removed automatically, for example, you’d have to recreate all of your Links every time you reload a .items file if the links are defined through the UI. So OH takes a bit of a hands off when it comes to cleaning up the links because ultimately, it doesn’t have enough information to tell the difference between a temporarily invalid Link and one that needs to be removed.
Uninstalling the zwave binding to manually install a snapshot version is another time you would not want links to disappear.
Yep, I agree ! Thank you for your insights.
I am very surprised by the quantity of invalid links (that I do not want to keep) accumulated from my first installation of openhab2 two years ago. I will go and delete them manually
You probably had Simple Mode turned on. I’m so glad simple mode is gone.
Would the following console command work? It “purges all orphaned - one missing element (either item or channel) - links”
openhab:links orphan purge
It did remove the links, but not the items associated with the links.