Retention Cleaner – safely remove old files (snapshots, exports, media) in Home Assistant

Hi everyone,

over time Home Assistant installations tend to accumulate a lot of files: camera snapshots, temporary exports, backups, media files, logs, etc.
On systems with limited storage (e.g. Raspberry Pi, SSDs, NAS mounts), this can quietly become a real problem.

I built Retention Cleaner to solve exactly this use case in a safe and transparent way.

What it does
Retention Cleaner automatically identifies files older than a configured retention period and can remove them on demand.

Typical use cases:
Camera snapshots older than X days
Temporary exports or generated files under /media
Regular cleanup tasks without shell scripts or cron jobs

Safety first (very important)
File deletion is risky, so the integration is intentionally conservative:
:heavy_check_mark: Dry-run mode by default – nothing is deleted until you explicitly allow it
:heavy_check_mark: Hard path restrictions (only allowed directories, no wildcards)
:heavy_check_mark: Delete limits per run to avoid accidents
:heavy_check_mark: Sensors show what would be deleted before anything happens
You always see what will be deleted before it actually is.

How it integrates into Home Assistant

The integration exposes:
Sensors (files found, files eligible for deletion, last run, etc.)
Buttons for scan and cleanup
A device that can be used in dashboards and automations

This makes it easy to:
Monitor cleanup status
Trigger cleanups manually
Combine it with notifications or automations
Availability

:rocket: HACS default repository PR is already submitted
:art: Home Assistant brands PR is merged (icon + branding ready)
Until the HACS PR is merged, the integration can be installed as a custom repository.
GitHub repository:

:point_right: GitHub - thomasgriebner/retention_cleaner: Home Assistant custom integration to automatically clean up files in configured folders based on a retention period. Each device represents one folder rule and provides sensors, a manual run button, and safe defaults for reliable long-term file housekeeping.