Persistence Maintenance

When you have persistence configured you come to a point that you want to know how much data you have in your openHAB2 data base or you want to delete old item states like discussed for example here:

I created two python scripts which could be helpful also for others, so decided to make them public. You can use them for

  1. Creation of a CSV file with an overview over your data in the database
  2. Deleting of item data older than a configured number of days

You can find them on gitHub: openHABdbTools

A detailed description how to use them you find here:

http://albold-home.de/openhab2-database-maintenance/
http://albold-home.de/openhab2-database-overview-sheet-creation/

They are tested with my mariaDB installation on openhabianpi but should work also with other SQL data bases.

Would be nice to hear your opinion!

2 Likes

I prefer value deletion individual by age per item as in those mentioned thread automatically with sql-procedure.

But what I’m still searching for is a tool, checking all items from persostence table items against actual active items from openhab2, so i can decide / mark items in sql to delete and drop the tables not needed anymore.

Any idea?

But I

Hi @JensH,

Please have a look in the link in my post:

http://albold-home.de/openhab2-database-overview-sheet-creation/

This script goes over all data base tables and link them with the actual items in openhab. If you filter for “-.-” in the sheet for example in column label. you see all tables in the db which don’t have an item in openHAB anymore.

Is it that what you are searching for?

I searched for a more automatic way. But I nearly got my solution. A rule increasing in items table how many cycles the item is inactive allready working.

I ll write a sql procedure now deleting items older x month next.

UPDATE: Script with Tutorial ready and checked. Automatically deleting old unused tables of actual inactive / earlier Items.

I yesterday did it with a mix of mysql Procedure and an openhab-rule!

Published here: