Skip to content

Instantly share code, notes, and snippets.

@maxtacu
Last active October 3, 2023 03:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtacu/eeec5284a68da396520a8955ec529d0d to your computer and use it in GitHub Desktop.
Save maxtacu/eeec5284a68da396520a8955ec529d0d to your computer and use it in GitHub Desktop.
Download latest Hubitat backup using API
#!/bin/bash
# Your hubitat IP
HUBITAT=1.2.3.4
# Backup output path parameter. Default: "." current path where you execute the script.
BACKUP_PATH="${1:-.}"
# Get the name of the latest backup file
REMOTE_BACKUP=`curl -s "http://$HUBITAT:8081/api/backups" | jq -r '.backups[0].name'`
# Download backup
curl -s "http://$HUBITAT:8081/api/downloadBackup/$REMOTE_BACKUP" -o $BACKUP_PATH/backup.lzf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment