The Home Assistant Management Tool is something I built for my personal use, but can easily be modified to suite different setups. Adjust the variables to your settings and setup shared SSH keys (if desired). Probably a million other more efficient ways to do this, but it has worked out so far for me. I had a previous version that I was using before converting to a Docker based installation. That one works with a more traditional installation. You can check out that version here
Overview:
- Bash Shell script, should work anywhere you can use Bash
- All HA configs are stored on my local workstation within Dropbox (doesn’t have to be but I like the versioning and access to it from any machine).
- Edit locally with Text Editor. Currently using Visual Studio Code and VIM
Options:
- Deploy Home Assistant Configs
- Creates tar file of current configs
- Backs up tar file to local workstation (I use a Dropbox Folder)
- rsyncs config directory from local workstation (Dropbox Folder)
- Restart Home Assistant
- Restarts the Home Assistant Docker container, thus restarting Home Assistant
- Stop Home Assistant
- Stops the Home Assistant Docker Container
- Start Home Assistant
- Starts the Home Assistant Docker Container
- Upgrade Home Assistant
- Does a docker pull for the latest version of Home Assistant
- Stops the Home Assistant Docker Container
- Deletes the Home Assistant Docker Container
- Creates a new Home Assistant Docker Container
- Check Database Size
- Check the size of the MySQL Database
- Validate Home Assistant Config
- Runs a config check using a Docker Container
- Backup Home Assistant
- Creates tar file of current configs
- Backs up tar file to local workstation (Dropbox Folder)
- Copy Configs to GitHub
- Copy’s current config to local workstation Github, scrubs any data that is listed in redacted.txt using ha-github-scrub.sh.
- Renew SSL Certificate
- Runs a certbot (Let's Encrypt) Docker container that generates a new SSL certificate
x) Exit – I shouldn’t need to explain that one
Variables:
hauser=“USER_ACCOUNT” <-- Home Assistant User Account
habin="/usr/local/bin/hass" <-- Home Assistant Binary
haconfigdir="/home/USER/.homeassistant" <-- Home Assistant Config Directory
hahost=“HOSTNAME/IP” <-- Home Assistant Hostname or IP address
localuser=“USER_ACCOUNT” <-- Local Computer Username, account from where this shell script will run
localhost=“HOSTNAME/IP” <-- Local Computer Hostname or IP address
localpath=“PATH_TO_LOCAL_HA_CONFIGS” <-- Where I store my local HA configs and backups
docker="/PATH/TO/DOCKER/bin " <-- Docker Binary
Within the local folder, variable localpath="PATH_TO_LOCAL_HA_CONFIGS", I have two folders:
Config: All of the .yaml files for Home Assistant
Backup: Place for backup tar file