Assistance needed with recorder

Hi all.

I’ve been using home assistant for a while and have been expanding it. I now have quite a few devices and entities which are filling up my database.

I have hassio installed on a Raspi 3, the SD card filled with the database after a few months so I moved the DB to my Synology nas with mariaDB. This is now getting constantly written to with Hughes amounts of data.

Below is my recorder section in my config, I’ve tried to exclude loads of items and set a delay for writing but the NAS is constantly writing to disk.

I would like to exclude everything then include items to be recorded later as I see fit.

recorder:
  purge_interval: 1
  purge_keep_days: 3
  commit_interval: 20
  db_url: !secret database
  include:
    domains:
      - switch
  exclude:
    event_types:
      - component_loaded
      - platform_discovered
      - service_registered
      - service_removed
      - service_executed
      - platform_discovered
      - homeassistant_start
      - feedreader
      - service_registered
      - call_service
      - component_loaded
      - logbook_entry
      - system_log_event
    domains:
      - media_player
      - weblink
      - group
      - history_graph
      - weather
      - sun
      - device_tracker
      - updater
      - camera
      - scene
      - script
      - calendar
      - remote
      - sensor
    entities:
      - sensor.time
      - sensor.date
      - sensor.internet_time
      - sensor.load_1m
      - sensor.time_utc

Cheers

If I remember it correctly, as soon as you start to use ‘include’ everything else will be excluded by default.

Thanks, I tried this but my DB is still getting a constant stream of data.

recorder:
  purge_keep_days: 7
  db_url: !secret database
  include:
    domains:
      - switch

My DB is up to 7.3 GB and isn’t purging either, I’m trying to manually purge it too.

Are you using this approach to purge your database?

You might also have to delete the database as it might not clear it our completely without doing that.

Edit:
Not sure how this works with MariaDB, I was successful in cleaning up my internal SQLite DB that way.

Yes I tried calling the recorder.purge service (without the repack option) but it didn’t work.

My config now looks like this:

recorder:
  purge_interval: 1
  purge_keep_days: 7
#  commit_interval: 20
  db_url: !secret database
  include:
    domains:
      - switch
    entities:  
      - climate.living_room
      - climate.kitchen
      - climate.master

I deleted the events part of my DB manually, it was over 1.3 million lines, HA may have been struggling with this. The constant writing to DB has stopped, I’ll need to keep an eye on it though and see if the purge works.