How to create automatic backups of hub database

That's a good alternative too. Either of those would work for me. And that might be easier for the hub to do. Good idea!

I tried it and it turns out AUTH doesn't get invoked... yet. I vaguely remember someone pointed this out and Hubitat staff responding. The response was one of the three: Next; Soon; Low priority; but I don't remember which :smiley:

Or which combination of them? :wink: While this would be a great feature, there are MUCH bigger fish to fry, so any of those would be justified in my mind. But hey, if you don't ask for it, you'll never get it, right? :slight_smile:

If you turn on user administration, /hub/backupDB?fileName=latest will redirect to login.

You will need to authorize a user to use this url

1 Like

Just so I'm not missing anything here, the processes you all are talking about is the same as clicking the Download button here right?:

Yes.

Thank you Sir! That's what I was hoping. Click Download, have google backup and sync handle the rest.

1 Like

If you remember to download the backup from your hub, yes, you can let google back it up to your Drive account. But that's only if you remember to download it from the hub. That's the part that I'm looking to automate (if I can figure it out).

Oh I figured that part about automating, I just wanted to make sure that using the builtin as I have been was capturing the same information as the way you're backing it up from the backend.

1 Like

Thanks @patrick

I got a result before turning on User Authentication and I got a result after. I didn't check the size. You're completely correct, with User Auth on, a redirect occurs AND it's not basic authentication, so "--user myusername --password mypassword" does not work.

My mistake for not fully reviewing the result.

But....this still doesn’t backup the USB stick device info. Not complaining, just re-focusing on the intent of disaster record planning.

Well, I would say that having a backup of the hub data is important to a disaster recovery plan. There is no way to back up the stick because the devices are tied to the stick. You'll have to re-join those devices to your new stick because it's a new stick and not your old stick. That's not HE's doing...that's just how the protocol works AFAIK.

Radio Stick has a DB of all the devices that have joined (paired). Using Third Party Tools, copying the DB to another stick is quite doable. I have two "extra" sticks and I update them within a week of adding a device.

However, it's not a duplicate. The extra sticks are secondary controllers in ZSpeak. That stick cannot be swapped into the hub. That's because there can be one and only one primary controller. The same Third Party Tools can be used to Transfer Primary, but that's still only half the battle. :frowning:

Although it's not mandatory, the final step is to get the new stick into Node 1. All of the Lifeline Associations point to #1. This involves (again) Third Party Tools to perform a "replace" on the Radio Stick you're replacing.

It’s not anyone’s fault, but I can’t help but think there might be a way to backup/clone the stick. If it’s truly not possible, or not on the roadmap, so be it. I don’t want to redesign the system, I just want to use it. If indeed HE is meant for the average mainstream consumer, telling them to rejoin/re-pair a good number of devices is not going to play well in that scenario. I moved all my stuff from ST basically in a day so I’m not sweating it. Having the backups is a HUGE reason I switched from ST and I’m glad they have the capability on HE.

I have to believe this set of Tool equivalences are planned but given the number of times we (combined) have to do that, I'm expecting it to be far down the priority list, although high on the FUN list. :smiley:

Because there are Third Party Tools to do it, yes, if this happens to you, you CAN get there from here... although I suspect that at the end.. you'll have wished you had just started over :slight_smile:

2 Likes

For any Windows O/S peeps out there, you can run a powershell script to back the hub up. This is a basic version of the script, and it does overwrite the backup each time. That is fixable. I'm pretty sure you can pass creds in it as well if you are using multiple accounts. Replace the bracketized details with yours. Add it to a scheduled task in Windows and you're good.
The Script(copy it into a file with extension .PS1):
Invoke-WebRequest -Uri "http://192.168.XXX.XXX/hub/backupDB?fileName=latest" -OutFile "<driveLetter>:\<folderName>\<fileName>"

The Arguments for the Task in Scheduler(These are based on my setup so change for yours):
-ExecutionPolicy Bypass -WindowStyle Hidden C:\Users\Daddio\Documents\hubitatBackup.ps1 -RunType $true

1 Like

I know how to make an exact copy of my z-wave db, but do you know how to make a copy of zigbee db? I have 3 combo sticks.

Have you tried any of the commercial cloning utilities?

I would love to know which one. I used a 3rd party app for z-wave but for zigbee I have no idea.

If you want unique file names for each backup you can do something like this:

$url = "http://192.168.XXX.XXX/hub/backupDB?fileName=latest"
$output = "C:\temp\hubitat backup $(get-date -f yyyy-MM-dd-HHmmss).lzf"

Invoke-WebRequest -Uri $url -OutFile $output
3 Likes