Remove unused Items?

I have now run Openhab since 1.4 and are now using the latest OH2.
The problem is that I during the time has experimented alot with different automation systems and so on and the items in the .items file getting bigger and bigger.
I think I now have around 800-900 items in the files and proberbly just using around 200-300 of them.

So is there a simple way to find unused items? I.e lets say items not changed for a week, month or so?

Do you have persistence setup?
If so, I would query your db and filter (WHERE) based on last update

As Lucky indicates, if you have persistence you can find those that haven’t been updated in a long time.

Beyond that, I know of no simple method to achieve this because:

  • some Items may be there to hold constants meaning they wouldn’t change anyway
  • some Items are not necessarily linked to any channels or bound to a binding so you can’t rely on that

Your best bet will probably to run grep -R <item name> from your conf folder and if the Item appears in any file in addition to the .items file you know it is being used.