As always, please CONSTANTLY read and UNDERSTAND what you copy and run on the Internet. Stay safe!
- mkdir a
.ssh
dir to the root of the config folder (should be/root/homeassistant
) ssh-keygen
to that directory. I've usedssh-keygen -t rsa -b 4096 -C "[email protected]"
. I will not cover the usage of a passphrase here.- Copy
/root/homeassistant/.ssh/id_rsa.pub
content to yourSettings
➜Deploy keys
page of your Github repo - Because the shell command won't (obviously) have access to all of the HA instance,
cd
to your ha configuration directory and run that command to target the newly generatedid_rsa
file:
git config core.sshCommand "ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' -F /dev/null"
- Copy
backup.sh
to the HA configuration folder - Create a
.gitignore
file into the HA configuration folder and add the needed exceptions (I've provided mine) - Copy the automation content (
automation.yaml
), create a new automation and paste the content. You can also go to theautomations.yaml
and write it here if you're more comfortable. I've set the automation to automatically run at 2:00 am everday. Feel free to change it as you like. Also I like to be notified on the app, using the nativenotify
service.
@vasilvestre You didn't, I did miss something!
You need to add the shell_command integration into your
configuration.yaml
, like such:I've updated the gist, thanks!