Manual repack

Good morning guys,

I am new to Home Assistant and little by little I am getting started. I find myself in a problem, and that is that my database does not stop growing. A few days ago I made the following modification to the Configuration.yaml file:

auto_purge: true
purge_keep_days: 30
auto_repack: true
commit_interval: 5

With this I have managed to stabilize the database and it is no longer growing much, but I have no way to clean the data that exists from the last 30 days that the purge was done. I think it’s with the “repackage” statement, but I think setting “true” does it every two weeks. My question is if someone can tell me how to run the “repack” voluntarily. The goal is to be able to delete history more than 30 days. Could someone help me? Thank you.

Sorry, data base MariaDB

I have the following automation, use it as a template.

- id: '1569740295036'
  alias: Purge recorder
  trigger:
  - at: '23:55'
    platform: time
  condition: []
  action:
  - data:
      keep_days: '3'
      repack: 'true'
    service: recorder.purge

Thank you Francisp for the quick response. So that I understand it better.

This automation performs the “repack” at 23:55 every 3 days, did I understand correctly? Another thing, the “id”, what “id” is it? Thanks.

No, the automation runs every day, keeping 3 days of History.
id is just an unique_id, something so HA can keep track of the automation (without id it is not visible in the automation editor)

Thanks, I’m going to try to do an automation by adding a device as an example, so that this one is included and the others are not. So this afternoon I’ll share it with you to see what you think, when you can. Thank you.

I am sorry, I can’t get it. I have tried a thousand ways. I have been able to obtain for a test that it only include one entity. So far so good, but the repack doesn’t do it for me and I still have a huge database. I have it in the following way:

# MariaDB - Recorder
recorder:
  db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8mb4
  auto_purge: true
  purge_keep_days: 3
  auto_repack: true
  commit_interval: 5
  include:
    entities:
      - sensor.air_quality_sensor_air_temperature_4 # temperatura despacho

In the documentation it indicates the following:

auto_repack boolean (optional, default: true)
Automatically repack the database every second sunday after the auto purge. Without a repack, the database may not decrease in size even after purging, which takes up disk space and can make Home Assistant slow. If you disable auto_repack it is recommended that you create an automation to call the recorder.purge periodically. This flag has no effect if auto_purge is disabled.

But I don’t want the repack the second Sunday, I would like to do it manually, at will, maybe it is not possible. Don’t know.

If you can help me, I appreciate it.

Thank you for your patience.

Just click on ‘call service’

Good afternoon Francisp,

Thanks for the support. I have done it and something is changing, it is reducing my database. Although it’s going slowly. Thanks for everything.