Automatic backup, history tracking, and instant restore for your Home Assistant configuration.
Home Assistant Version Control provides complete version history for your setup. It automatically tracks every change to your YAML configuration files using a robust local Git backend. Browse your history, visualize diffs, and restore individual files or your entire configuration to any previous state with a single click.
Home Assistant Tweaks recently added version history to the native automation and script editors. Install it alongside this app and a version control button appears in the editor toolbar: step back through earlier saves of the automation or script you are editing, preview any version in the editor, and restore it with a normal save. The button only appears when this app is installed and reachable, and the rest of the tweaks work on their own.
v1.7 adds API authentication for standalone Docker and cuts idle CPU.
- API Authentication for Docker: The standalone container now asks for a username and password in the app. It is on by default there. The username is
havc, and the password is generated on first start and saved to/data/api-password. SetHAVC_USERNAMEandHAVC_PASSWORDto choose your own, orHAVC_API_AUTH=offbehind an authenticating reverse proxy. The add-on behind Ingress is unchanged. - Lower Idle CPU: The watcher now ignores files HAVC can never commit, so polling no longer stats dependency folders, model caches, and other large directories.
- Faster Startup Recovery: A stale
.git/index.lockis cleared after ten minutes, and startup and watcher retries now share one initialization run instead of racing for the git lock.
- Optional Add-on Auth: Added
api_authandapi_auth_passwordfor add-on users who publish port 54001 directly. - Input Validation: Client-supplied paths and commit hashes are validated before use.
- Exact-Match CORS:
HAVC_ALLOWED_ORIGINStakes an exact origin list instead of the old substring matching.
v1.6 highlights
v1.6 focused on cloud sync and hands-free reloads.
- Mirror Remote for Cloud Sync: Add a second Git remote and every sync pushes to both. Use it for a redundant off-site copy, drift detection, or an audit repository. Mirror pushes are non-fatal, so a failure never blocks your primary backup.
- Auto-reload Changed Components: Optionally reload the Home Assistant domain that changed after each automatic backup. Edit automations, scripts, scenes, inputs, or templates and the matching reload service runs without a Developer Tools trip. Off by default.
- Cleaner Cloud Sync Fields: Token inputs no longer show the browser's password and autofill icons.
- Nested Git Repositories Documented: Folders under
/configwith their own.gitare skipped, so an ESPHome repo or similar no longer shows up as a broken submodule. - Embedded Credentials (from v1.5.2): Custom remotes using
user:pass@ortoken@authenticate reliably during automatic pushes and connection tests. - Masked Logs (from v1.5.1): Tokens in remote URLs are redacted from startup logs and diagnostics.
v1.5 highlights
- Native Mobile & Tablet Interface: Modern responsive design for phone and tablet companion apps featuring a bottom navigation bar, smooth slide-out views, and touch-optimized action buttons.
- Track Addon Configs (
/addon_configs): Full support for tracking and versioning Home Assistant add-on configuration files alongside your main YAML configs. - Manual Mode Protection: Preserves user-managed Git branches and stashes without automatic overwrites, while "Backup Now" stages all modifications and newly created files respecting
.gitignore. - Real-Time Settings Auto-Save: Instant persistence across all settings toggles and preferences.
- Cloud Sync Authentication Stability: Standardized HTTP authorization headers to eliminate token loss on newer Git versions.
- Track Custom Paths: Easily include folders like
/shareand/mediain your version history. Perfect for tracking external configs (like Frigate) using Home Assistant mounts. - More Than Just Lovelace: Explicitly whitelist and version control specific files/patterns in the
.storagedirectory (e.g., core.entity_registry). - Keep Your Own Extensions: Configure any file format to track and backup (.sh, .py, .json, etc.) directly in the config tab.
- Upgraded Confetti Mode: More celebrate.
- Enhanced Security: Securely connect to private repositories using persistent SSH keys and trusted CA certificates.
- Zero-Effort Backups: Every edit is saved automatically.
- Smart Debouncing: Multiple rapid edits are grouped into a single save snapshot (customizable delay).
- Hands-Free Reloads: Optionally reload changed Home Assistant components after each backup, so edits apply without opening Developer Tools.
- Comprehensive Tracking: Monitors
.yaml,.yml, andlovelacedashboard files. - Custom Extensions: Track any file format (e.g.,
.sh,.py,.json,.conf) by adding it to the configuration. - Efficient Storage: Uses Git deduplication to minimize disk usage.
- Remote Storage: Push your configuration to a private GitHub or Gitea repository.
- Sync Modes: Choose between manual sync, daily backups, or automatic sync after every local change.
- Branch Agnostic: Automatically detects and follows your active local branch.
- Chronological Feed: View changes grouped by "Today," "Yesterday," and "Earlier."
- Visual Comparisons: Compare the current version against any backup side-by-side. Additions are highlighted in green, deletions in red.
- History Management: Automatically merges versions older than the specified time period to keep your history clean.
- Editor Integration: With Home Assistant Tweaks, browse and restore versions directly in the native automation and script editors.
Run Home Assistant Tweaks alongside this app and the native automation and script editors gain a version history control.
- Step through versions: Use the arrows next to the date to move back and forward through earlier saves of the automation or script you are editing.
- Preview in place: The editor shows the selected version before you restore it.
- Restore by saving: Save the editor to make the selected version current again.
- Open the full history: Click the date to open the complete version list with search.
- Only when available: The control appears only when this app is installed and reachable. The rest of the Tweaks features work on their own.
- Granular Control: Restore specific files or revert your entire configuration.
- Recover Deleted Items: View and restore files, automations, and scripts that have been deleted from your configuration.
- Smart Reloads: Automatically reloads Home Assistant when restoring automation or script files to apply changes immediately.
- Instant Rollback: Long-press the restore button to revert the entire system to a previous point in time.
- Color Theme: Choose from seven preset color palettes.
- Light Themes: Toggle between Light and Dark modes.
- Comparison View:
- Style: Customize your comparisons with 8 different themes (High Contrast, GitHub Classic, Neon, etc.).
- Layout: Choose between Stacked (Unified) or Side-by-Side views.
- Comparison:
- Current (Default): Compare against your Current File on disk to see how far you've deviated since that backup.
- Changes: Compare against the Previous Version to see exactly what changed in that specific backup.
- Restore Single File: Click the "Restore" button on any file in the timeline.
- Restore All Files: Long-press (2 seconds) the "Restore" button on a timeline entry to revert all tracked files to that exact moment.
- Timeline Context Menu: Right-click on any version in the timeline to access:
- Reset Timeline Here: Remove all versions newer than the selected point (keeps your files unchanged, only cleans up timeline history).
- Restore All Files Here: Revert all tracked files back to their state at the selected version.
Important
- Existing Git Repos: If you already have a
.gitfolder in your/configdirectory, back it up first. The app will use your existing repository but may conflict with your workflow through auto-commits and automatic merging of old history. For best results, delete the existing.gitfolder and let the app create a fresh repository. - Backup Strategy: While this app provides excellent version control, do not rely on it as your sole backup method. Always maintain external backups (e.g., Google Drive, Samba) of your Home Assistant instance.
There are two ways to install Home Assistant Version Control: as a Home Assistant app or as a standalone Docker container.
-
Add Repository: Click the button below to add the repository to your Home Assistant instance:
Or manually add it:
- Navigate to Settings → Apps → App Store
- Click the three dots (⋮) in the top right corner and select Repositories
- Add the repository URL:
https://github.com/saihgupr/ha-addons
-
Install the App: The "Home Assistant Version Control" app will now appear in the store. Click on it and then click "Install".
-
Start: Start the app and click "Open Web UI" to access the interface.
-
Optional (External Access): To access the UI externally at port
54001, enable the port in the app's Configuration tab (disabled by default).
Warning
The standalone container requires API authentication by default. The app asks for a username and password when API auth is enabled. The login form works in the Home Assistant Companion app as well as a normal browser. The /healthz endpoint stays open for the container healthcheck. If you don't set HAVC_PASSWORD, a password is generated on first start, printed in the container logs as [auth] API password: ..., and saved to /data/api-password inside the container. Set HAVC_USERNAME and HAVC_PASSWORD to use your own credentials. Set HAVC_API_AUTH=off only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks.
Click to expand Docker deployment options
For Docker users who aren't using the Home Assistant app, you have three deployment options:
Option A: Docker Compose (recommended):
-
Download the compose.yaml file:
curl -o compose.yaml https://github.com/saihgupr/HomeAssistantVersionControl/raw/develop/compose.yaml
-
Edit the file to set your paths and timezone:
nano compose.yaml # Update the volume path: /path/to/your/ha/config # Update timezone: TZ environment variable (e.g., America/New_York) # Optional: set HAVC_USERNAME and HAVC_PASSWORD for API authentication # Without HAVC_PASSWORD the generated one is in /data/api-password and the container logs
-
Start the service:
docker compose up -d
Access the interface at http://localhost:54001. Log in with your HAVC_USERNAME and HAVC_PASSWORD, or with havc and the generated password from the logs or /data/api-password.
Option B: Docker Run (pre-built image):
docker run -d \
-p 54001:54001 \
-v /path/to/your/config:/config \
-e TZ=America/New_York \
-e HAVC_USERNAME=havc \
-e HAVC_PASSWORD=choose-a-strong-password \
-e SUPERVISOR_TOKEN=your_long_lived_access_token_here \
-e HA_URL=http://homeassistant.local:8123 \
--name home-assistant-version-control \
ghcr.io/saihgupr/home-assistant-version-control:latestReplace /path/to/your/config with the actual path to your Home Assistant configuration directory.
Option C: Build locally:
git clone https://github.com/saihgupr/HomeAssistantVersionControl.git
cd HomeAssistantVersionControl/homeassistant-version-control
docker build --build-arg BUILD_FROM=alpine:latest -t home-assistant-version-control .
docker run -d \
-p 54001:54001 \
-v /path/to/your/config:/config \
-e TZ=America/New_York \
-e HAVC_USERNAME=havc \
-e HAVC_PASSWORD=choose-a-strong-password \
-e SUPERVISOR_TOKEN=your_long_lived_access_token_here \
-e HA_URL=http://homeassistant.local:8123 \
--name home-assistant-version-control \
home-assistant-version-control[!NOTE] The
SUPERVISOR_TOKENandHA_URLare optional. You can omit those lines if you don't need Home Assistant restart/reload features.
[!NOTE] API authentication is on by default. If you don't set
HAVC_PASSWORD, the generated password is printed in the container logs and saved to/data/api-password. Mount/dataso it survives container recreation. SetHAVC_API_AUTH=offonly when an authenticating reverse proxy already protects the container.
Access the interface at http://localhost:54001.
Web UI settings are stored in /data/runtime-settings.json. Mount /data as a volume so they survive container recreation:
volumes:
- /path/to/your/config:/config
- /path/to/havc-data:/dataWithout a persistent /data volume, set the same options with environment variables. The settings file takes precedence over environment variables, and environment variables take precedence over defaults. To edit runtime-settings.json by hand, stop the container first, keep the JSON valid, and restart to apply. See Runtime Settings for the full list.
In Home Assistant app mode, you can track files outside /config by setting additional_paths in the app configuration.
Example:
include_extensions:
- yaml
- yml
- conf
additional_paths:
- /share
- /share/mqttNotes:
- Paths must be absolute and currently support
/share,/media,/ssl, and/configprefixes. - Paths under
/configare skipped because/configis already tracked automatically. - Files are still filtered by
include_extensionsandexclude_files. - For
.conffiles, addconftoinclude_extensions.
By default the app relies on Ingress and Home Assistant authentication for the panel. If you expose port 54001 directly, set api_auth: true to require HTTP Basic auth on /api/*, and set api_auth_password to choose the password. If the password is left empty, HAVC generates one and stores it in /data/api-password.
Set manual_mode: true if /config is already a git repository you manage yourself. The option is read before HAVC touches the repository, so it applies from the very first start, and when set it takes precedence over the toggle in the settings UI:
- No file watcher, no automatic or startup commits. You commit with the "Backup Now" button.
.gitignore, the index and the global git identity are left untouched, including when you save settings.- Cloud sync is disabled; HAVC never changes or pushes to your
originremote.
Example use case:
Click to view guide on versioning remote shares
You can use the additional_paths feature to version control configurations stored on remote shares (like a NAS or another server). This is perfect for tracking Frigate configurations or other Docker-based apps running elsewhere.
Step 1: Set up Network Storage in Home Assistant
- Navigate to Settings → System → Storage.
- Click "Add network storage".
- Give it a name (e.g.,
frigate). - Set Usage to
ShareorMedia. - Enter your server details and mount point.
Step 2: Add to Version Control
Once mounted, the share will be available at /share/frigate (if usage was set to Share) or /media/frigate (if set to Media). Add this path to your additional_paths in the app configuration:
additional_paths:
- /share/frigateBenefits:
- Frigate Configuration Recovery: If a complex config change breaks your detection, you can instantly see the side-by-side diff and roll back your
config.ymlto a known working state, even if Frigate is running on a completely separate machine or VM.
Click to view advanced settings and environment variables
The application can be configured through the web UI Settings page or via environment variables for containerized deployments.
| Setting | Description | Default |
|---|---|---|
| Debounce Time | Time to wait after detecting changes before creating a commit | 5 seconds |
| Auto-reload Home Assistant | Reload changed components after each automatic backup | Disabled |
| History Retention | Automatically merge old commits to keep history clean | Disabled |
| Retention Type | Keep history based on time or number of versions | time |
| Retention Value | How much history to keep (number of days/hours/weeks/months or versions) | 90 |
| Retention Unit | Time unit for retention (hours, days, weeks, months) | days |
| Max Commits to Show | Limit the number of recent versions to display (for performance) | Disabled |
For containerized deployments (especially when not persisting the /data directory), you can configure runtime settings using environment variables. This is particularly useful for:
- Docker/Podman deployments without persistent data volumes
- Infrastructure-as-code configurations
- Automated deployments with predefined settings
Precedence order (per-setting):
- Settings file (
/data/runtime-settings.json) - highest priority - Environment variables - middle priority
- Default values - fallback
| Environment Variable | Setting | Type | Valid Values | Default |
|---|---|---|---|---|
DEBOUNCE_TIME |
Debounce Time | Number | ≥ 0 | 5 |
DEBOUNCE_TIME_UNIT |
Debounce Time Unit | String | seconds, minutes, hours, days |
seconds |
AUTO_RELOAD |
Auto-reload Home Assistant | Boolean | true, false, yes, no, 1, 0 |
false |
HISTORY_RETENTION |
History Retention | Boolean | true, false, yes, no, 1, 0 |
false |
RETENTION_TYPE |
Retention Type | String | time, versions |
time |
RETENTION_VALUE |
Retention Value | Number | ≥ 1 | 90 |
RETENTION_UNIT |
Retention Unit | String | hours, days, weeks, months |
days |
LIMIT_HISTORY |
Limit History | Boolean | true, false, yes, no, 1, 0 |
false |
MAX_COMMITS |
Max Commits | Number | 50 - 10000 | 500 |
Notes:
- Boolean values are case-insensitive and accept:
true/false,yes/no,1/0 - String values (units, types) are case-insensitive:
SECONDSandsecondsare equivalent - Invalid values trigger warnings in logs and fall back to defaults
- Empty values are ignored
Docker Compose with environment variables:
version: '3.8'
services:
havc:
image: ghcr.io/saihgupr/home-assistant-version-control:latest
ports:
- "54001:54001"
volumes:
- /path/to/your/config:/config
environment:
- TZ=America/New_York
- DEBOUNCE_TIME=10
- DEBOUNCE_TIME_UNIT=minutes
- HISTORY_RETENTION=true
- RETENTION_TYPE=time
- RETENTION_VALUE=30
- RETENTION_UNIT=daysDocker Run with environment variables:
docker run -d \
-p 54001:54001 \
-v /path/to/your/config:/config \
-e TZ=America/New_York \
-e DEBOUNCE_TIME=10 \
-e DEBOUNCE_TIME_UNIT=minutes \
-e HISTORY_RETENTION=true \
-e RETENTION_TYPE=time \
-e RETENTION_VALUE=30 \
-e RETENTION_UNIT=days \
--name home-assistant-version-control \
ghcr.io/saihgupr/home-assistant-version-control:latestValidation and Logging:
When the container starts, you'll see detailed logging showing where each setting value came from:
[init] Runtime settings loaded:
[init] debounceTime: 10 (env: DEBOUNCE_TIME)
[init] debounceTimeUnit: 'minutes' (env: DEBOUNCE_TIME_UNIT)
[init] historyRetention: true (env: HISTORY_RETENTION)
[init] retentionType: 'time' (default)
[init] retentionValue: 30 (env: RETENTION_VALUE)
[init] retentionUnit: 'days' (default)
Invalid values will trigger warnings:
[init] Warning: Invalid DEBOUNCE_TIME='abc', Expected integer, got: 'abc'. Using default: 5
Technical details about the monitoring and commit workflow
- File Watcher: The system continuously monitors your
/configfolder for changes to YAML files. - Stabilization: When a change is detected, it waits 2 seconds to ensure Home Assistant has finished writing the file (preventing corruption).
- Debounce: It then waits for your configured Debounce Time (default 5s) to batch related edits into a single commit.
- Snapshot: A Git commit is created with a timestamp.
- Reload: If enabled, changed Home Assistant components are reloaded automatically.
- Cleanup: If enabled, old snapshots are consolidated periodically.
Auto-reload maps standard filenames to their reload service. Automations, scripts, scenes, groups, inputs, timers, counters, template sensors and switches, command_line, HomeKit, and customize.yaml are covered. Files pulled in through custom !include names are not mapped.
The app automatically tracks configuration files while ignoring system files.
| Tracked ✅ | Ignored ❌ |
|---|---|
configuration.yaml |
Database files (.db, .db-shm) |
automations.yaml, scripts.yaml |
Log files (*.log) |
secrets.yaml |
Python cache (__pycache__) |
Lovelace dashboards (.storage/lovelace*) |
Binary files (Images, Videos) |
esphome/*.yaml (unless the folder has its own .git) |
Temporary files |
All other .yaml and .yml files |
Files in .gitignore |
Files in .storage/ |
Temporary files |
Any folder under /config that contains its own .git is excluded from tracking, along with everything inside it. This covers integrations that keep their own history, such as an ESPHome folder that was initialized as a repository, and it stops git from recording them as broken submodules.
If you want those files in your Home Assistant history, remove or rename the nested .git directory and run a sync. The ignore entries are regenerated on the next sync without it. If you would rather keep that repository, back it up separately by giving it its own remote.
The app is branch-agnostic and will automatically detect the active branch of your repository.
- New Installations: Automatically default to
main. - Existing Repositories: If your repository already uses
master(or any other branch), the app will detect it and continue to use it without intervention. - Manual Branch Swapping: If you manually rename your branch (e.g.,
git branch -m master main), the app will automatically update its sync logic to match the new branch name.
[!CAUTION] Secrets Management & Cloud Backup: By default,
secrets.yamlis excluded from version control to protect sensitive information like passwords and API keys. If you use the Cloud Backup feature and choose to includesecrets.yaml, ensure your remote repository is private and understand that secrets will be stored in Git history. Consider using Home Assistant's built-in secrets management or environment variables for sensitive data instead.
[!TIP] Excluding Files: You can prevent specific files from being tracked by adding them to a
.gitignorefile in your/configdirectory. Just list the filenames (one per line) that you want to exclude, and the app will automatically ignore them from version control.
Remote backup and custom Git server setup
You can automatically sync your configuration to a private remote repository. This is highly recommended for off-site backups.
If you are using a custom Git server like Gitea, follow these steps to ensure a smooth sync (note: this is not required for standard GitHub setups):
- Create a Private Repository: Log in to your Git server and manually create a private repository named
VersionControlBackupbefore attempting to sync from the UI. - Authentication URL: Use the following URL format in the Cloud Sync settings, substituting your token, IP/domain, and username:
http://YOUR_API_TOKEN@YOUR_SERVER_IP:PORT/YOUR_USERNAME/VersionControlBackup.git
- Create a Private Repository: Create a new private repository and ensure the default branch is
master. - Create a Project Access Token via Settings > Access tokens, with
- Role:
Maintainer - Scope:
write_repository
- Role:
- Authentication URL: Use the following URL format in the Cloud Sync settings, substituting your token, username and repository name:
https://oauth2:YOUR_PAT@gitlab.com/YOUR_USERNAME/YOUR_REPO_NAME.git
Full API reference for advanced automation
API for advanced users or automation.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/git/add-all-and-commit |
Manual Backup: Forces a commit of all current changes. |
POST |
/api/run-retention |
Run Cleanup: Manually triggers the history retention cleanup process. |
POST |
/api/retention/cleanup |
Advanced Cleanup: Run cleanup with custom time parameters. |
POST |
/api/restore-commit |
Time Travel: Restore ALL files to a specific point in time. |
POST |
/api/restore-file |
Restore File: Restore a single file to a specific commit. |
POST |
/api/git/hard-reset |
Hard Reset: Reset the repository to a specific commit (destructive). |
POST |
/api/ha/restart |
Restart HA: Triggers a Home Assistant restart. |
GET |
/api/git/history |
Get History: Returns the full commit history log. |
GET |
/api/git/file-diff |
File Comparison: Get the diff for a specific file in a commit. |
GET |
/api/git/commit-diff |
Commit Comparison: Get the full diff for a specific commit. |
Reset the repository to a specific commit. WARNING: This is destructive and will discard all changes since that commit.
Parameters:
commitHash(string, required): The full or short hash of the commit to reset to.createBackup(boolean, optional): Iftrue, creates a safety backup commit of the current state before resetting. Default:false.
Example:
{
"commitHash": "a1b2c3d4",
"createBackup": true
}Restore all files to their state at a specific commit. This creates a new commit on top of the current history, preserving history.
Parameters:
commitHash(string, required): The hash of the commit to restore.
Example:
{
"commitHash": "e5f6g7h8"
}Restore a single file to its state at a specific commit.
Parameters:
commitHash(string, required): The hash of the commit containing the version of the file you want.filePath(string, required): The relative path to the file (e.g.,automations.yaml).
Example:
{
"commitHash": "i9j0k1l2",
"filePath": "scripts.yaml"
}Run the history retention cleanup process with custom parameters.
Parameters:
days(number, optional): Keep history for the last N days.hours(number, optional): Keep history for the last N hours.minutes(number, optional): Keep history for the last N minutes.months(number, optional): Keep history for the last N months.
Example:
curl -X POST http://homeassistant.local:54001/api/retention/cleanup \
-H "Content-Type: application/json" \
-d '{"hours": 24}'- HomeAssistantEditor: An intuitive visual editor for Home Assistant that utilizes this repository for advanced version control and history tracking features.
- HomeAssistantTimeMachine: A seamless time-travel interface for Home Assistant that backs up individual automations and scripts as YAML files and lets you restore them to an earlier state.
- HomeAssistantTweaks: Frontend tweaks for Home Assistant, including version history in the native automation and script editors when this app is installed.
Contributions, fixes, and feature ideas are always welcome!
- Pull Requests: Please target the
developbranch. See CONTRIBUTING.md for guidelines. - Latest Features: The
developbranch contains the latest unreleased updates. - Bug Reports: If you find an issue, feel free to open an issue.
If you encounter any issues, bugs, or have feature requests, please open an issue on GitHub.
Home Assistant Version Control is open-source and free. If you find it useful, consider giving it a star on GitHub or making a donation to support development!






