It's fantastic that Hubitat does automatic backups, but to me the point of the backup is to have an offsite version if something happens locally. e.g. Hubitat hardware dies. So I've been making it a habit to download the backup as often as I can remember, but not as often as I should.
This may also break the local-only philosophy but it would also be nice if we could set a path for these downloads to a cloud-based service, e.g. send uploads to my Google Drive account on a daily or weekly basis. May pose security concerns though.
You might find some answers on how to accomplish this in the following thread. I personally use a Scheduled Task on my Windows PC to download a backup of my hub every morning at 6am.
I do the same, but using a cron job, wget and the OneDrive CLI Client for Linux (my work provides me with a 1TB OneDrive share for personal use, so I use it lol).
I wrote the following dirt-simple VB6 program to do nightly backups of all three of my hubs:
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Sub Main()
Dim ret As Long
ret = URLDownloadToFile(0, "http://192.168.1.10/hub/backupDB?fileName=latest", "\\server\backups\Hubitat 0.lzf", 0, 0)
ret = URLDownloadToFile(0, "http://192.168.1.11/hub/backupDB?fileName=latest", "\\server\backups\Hubitat 1.lzf", 0, 0)
ret = URLDownloadToFile(0, "http://192.168.1.12/hub/backupDB?fileName=latest", "\\server\backups\Hubitat 2.lzf", 0, 0)
End Sub
This program gets triggered at 3:30 AM every day; some other code on my server moves the files out of "backups" to individual directories.
I do not have a computer at home that is on all the time I only have a laptop that I use for work so having a nightly script run is not going to work for me. I am thinking that I am going to create a Google Function that will do the HTTP get request from the cloud and then store it in a Google Storage Bucket. I will have to punch a hole in the firewall to do this. I wish Hubitat had a push command so that you could push the file to a URL at night so that I did not have to open my firewall. This needs to be automated and automated from the Hubitat device and offsite or else it's not a back up to be honest and even after owning my device for only 2 weeks I would not want to start from scratch!!
Have you considered getting an SBC like a RPi. They don't consume much power, and there's plenty of cron & curl based backup script examples that you can find here.
An added bonus is the ability to use Hubitat integrations that use NodeJs servers (or anything else that runs on Linux).
Yeah that is actually a great idea to play middle man to the backup. I am going to test creating a cloud function to see if that works first as it required no hardware and I love using cloud storage for backups!
So, I'm not clear on how I can use this, being that I have a Mac Mini and a Synology NAS to work with. Or do I have to have an always-on windows machine?
There are curl scripts in the community that you can use on a Mac or NAS. The NAS is probably the better choice since it is a storage device and likely doesn't get powered down.
The backup generated with your script seems to be a lot smaller than the native Hubitat backup. I feel like something is going wrong somewhere. Do you have any suggestions on why your scripts backup is much smaller?