Backup & Security
Protect your optimized system.
A slow Home Assistant is frustrating. Dashboards that take forever to load, automations with delay, and a UI that stutters. Fortunately, most problems can be solved with the right configuration.
| Problem | Symptoms | Cause |
|---|---|---|
| Slow UI | Dashboard loads slowly | Large database, many entities |
| Sluggish history | Graphs take long time | SQLite bottleneck |
| High CPU | Constant 80%+ load | Too many integrations polling |
| SD card wear | Corrupt database, crashes | Too many database writes |
| Slow startup | 5+ minutes to boot | Large database, many add-ons |
Recorder is Home Assistant’s history engine. It writes everything by default - that’s often too much.
# configuration.yamlrecorder: purge_keep_days: 7 # Keep only 7 days of history commit_interval: 1 # Write to database every second auto_purge: true # Automatic cleanup at 04:12# configuration.yamlrecorder: purge_keep_days: 7 exclude: # Domains that generate A LOT of data domains: - automation # Automations don't need history - updater # Update status - camera # Camera states (images aren't stored)
# Specific entity patterns entity_globs: - sensor.sun_* # Sun sensors (update constantly) - sensor.*_battery # Battery (changes slowly) - binary_sensor.updater
# Individual entities entities: - sensor.date_time - sensor.time - sensor.uptimeAlternative approach - only save what you actually use:
# configuration.yamlrecorder: purge_keep_days: 14 include: domains: - sensor # Sensors - climate # Thermostats - light # Lights (for energy tracking) entities: - person.brian # Presence - binary_sensor.motion_living_room exclude: # Except these from included domains entity_globs: - sensor.*_battery - sensor.*_linkquality| Entity Type | Why |
|---|---|
sensor.*_battery | Changes slowly |
sensor.*_linkquality | Zigbee signal - rarely needed |
sensor.date_time | Updates every second |
binary_sensor.updater | Unnecessary |
automation.* | Trigger history is rarely useful |
script.* | Same as automation |
*_last_seen | Zigbee last seen timestamps |
For larger installations, MariaDB is recommended over SQLite.
| Situation | Recommendation |
|---|---|
| < 50 entities | SQLite is fine |
| 50-200 entities | SQLite with optimization |
| 200+ entities | Consider MariaDB |
| Raspberry Pi + SD card | MariaDB on external SSD |
| Slow graphs | MariaDB helps |
Go to Settings → Add-ons → Add-on Store
Search “MariaDB” and install
Configure add-on:
databases: - homeassistantlogins: - username: homeassistant password: "your-strong-password"rights: - username: homeassistant database: homeassistantStart add-on
Update configuration.yaml:
recorder: db_url: mysql://homeassistant:your-strong-password@core-mariadb/homeassistant?charset=utf8mb4 purge_keep_days: 14Restart Home Assistant
For better performance, add options in add-on config:
{ "databases": ["homeassistant"], "logins": [ { "username": "homeassistant", "password": "your-password" } ], "rights": [ { "username": "homeassistant", "database": "homeassistant" } ], "options": { "innodb_buffer_pool_size": "256M", "max_connections": 200 }}| Parameter | Value | Description |
|---|---|---|
innodb_buffer_pool_size | 256M-512M | RAM for database cache |
max_connections | 200 | Concurrent connections |
# configuration.yamllogbook: exclude: domains: - automation - script - group entity_globs: - sensor.*_battery - sensor.*_linkquality# configuration.yamlhistory: exclude: domains: - automation - script - updater entity_globs: - sensor.*_batteryMany integrations poll too often:
# configuration.yaml# Example: Reduce polling for template sensorssensor: - platform: template sensors: daily_consumption: friendly_name: "Daily Consumption" value_template: "{{ states('sensor.energy') }}" # Update only every 5 minutes scan_interval: 300Go to Settings → Devices & Services
Review all integrations
Remove/disable those you don’t use
Especially: Cloud-based integrations that poll
Reduce log level to save resources:
# configuration.yamllogger: default: warning # Only warnings and errors logs: homeassistant.core: warning homeassistant.components.mqtt: warning homeassistant.components.zha: warning # Debug only for troubleshooting: # homeassistant.components.automation: debug# configuration.yaml# Only if you don't use them:discovery: # Auto discoveryzeroconf: # mDNSssdp: # UPnP discovery| Recommendation | Why |
|---|---|
| Use SSD | 10x faster than SD card |
| USB 3.0 adapter | Avoid USB 2.0 bottleneck |
| Active cooling | Pi throttles at 80°C |
| Overclocking (careful) | Can give 20%+ boost |
# Automation to track database sizesensor: - platform: sql db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8mb4 queries: - name: Database Size query: "SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) as size FROM information_schema.TABLES WHERE table_schema = 'homeassistant'" column: "size" unit_of_measurement: "MB"# configuration.yamlsensor: - platform: systemmonitor resources: - type: processor_use - type: memory_use_percent - type: disk_use_percent arg: / - type: load_1m - type: load_5mIf the database has grown too large:
# Developer Tools → Servicesservice: recorder.purgedata: keep_days: 3 repack: truepurge_keep_days to 7automation, script domains*_battery, *_linkquality entitieswarningBackup & Security
Protect your optimized system.
Dashboard Design
Build fast, lightweight dashboards.
Last updated: December 2025