New Home Assistant Add-on: LFTP Mirror

Home Assistant Add-on: LFTP Mirror

Mirrors local directories with remote servers using FTP, FTPS, HTTP, HTTPS, HFTP, FISH, or SFTP.

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

About

This add-on uses LFTP to maintain mirrors between local directories and remote servers.

For more information, read the documentation.

Installation

First, add the repository that contains LFTP Mirror:
Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.
or:

  1. Navigate in your Home Assistant frontend to SupervisorAdd-on Store.
  2. Click the drop-down menu on the right and click “Repositories”.
  3. Add the following URL to the list of repositories:
    https://github.com/mrmichaelrb/hassio-addons
  4. Close the list of repositories.

Follow these steps to get the add-on installed on your system:

  1. Navigate in your Home Assistant frontend to SupervisorAdd-on Store.
  2. Find the “LFTP Mirror” add-on and click it.
  3. Click on the “INSTALL” button.

This is a little Add-on that I created to do provide offsite backup and file management for my Home Assistant. It mirrors my snapshots in /backup and media files in /media to my own personal FTP server.

The only files in my HA’s /media directory are videos and pictures taken by my security camera cameras, and they are removed from both HA and my FTP server after 30 days using the local_expiration_days and delete options. I set the scan_interval on my /media directory to 5 seconds so that anything recorded by my security cameras is very quickly copied offsite.

Additionally, my FTP server is also my web server, so I can review the uploaded videos and pictures at high bandwidth from anywhere in the world, even if my HA has gone down.

Dear Michael,

Got flw error during installation:

21-08-06 15:17:33 INFO (SyncWorker_4) [supervisor.docker.addon] Starting build for 423ea876/armv7-addon-lftp_mirror:1.0.1
21-08-06 15:17:37 ERROR (SyncWorker_4) [supervisor.docker.addon] Can’t build 423ea876/armv7-addon-lftp_mirror:1.0.1: The command ‘/bin/ash -o pipefail -c apk add --no-cache lftp’ returned a non-zero code: 1
21-08-06 15:17:37 ERROR (SyncWorker_4) [supervisor.docker.addon] Build log:
Step 1/12 : ARG BUILD_FROM
Step 2/12 : FROM $BUILD_FROM
—> 564b1f71f9e5
Step 3/12 : ENV LANG C.UTF-8
—> Using cache
—> 4c26f680be93
Step 4/12 : RUN apk add --no-cache lftp
—> Running in 5822466deba9
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: temporary error (try again later)

fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: temporary error (try again later)

ERROR: unable to select packages:

lftp (no such package):
required by: world[lftp]
Removing intermediate container 5822466deba9

That’s strange. I’m using the aarch64 platform myself (Raspberry Pi 4), but according to the Alpine Linux website, LFTP should be available for armv7 under Alpine Linux v3.14:

https://pkgs.alpinelinux.org/package/v3.14/main/armv7/lftp

And their build log and package contents for LFTP seem to be okay… Can you try it again to verify that there wasn’t some network glitch at the time when you tried to install it?

And can anyone else with a armv7 confirm whether or not this works for them? I think the following are under the armv7 platform with the Home Assistant Operating System:

  • 32-bit Raspberry Pi (mostly Pi 1 and 2, but you could put it on Pi 3 and 4)
  • ODROID-XU4
  • Asus Tinkerboard

Dear Michael,

No network glitch, all others addons from HA are fine. But yours doesn’t want to install. Same error… :frowning:

I checked Alpine Linux 3.14 APKINDEX for armv7 and it has an entry for LFTP:

C:Q1IY239vdBiB2AF4TyC/JF95dGJQg=
P:lftp
V:4.9.2-r1
A:armv7
S:676380
I:1384448
T:Sophisticated ftp/http client
U:https://lftp.tech
L:GPL-3.0-or-later
o:lftp
m:Carlo Landmeter <[email protected]>
t:1610489771
c:1118fff73bb8f3a967c12d42de2d8c4a0a7ed162
D:so:libc.musl-armv7.so.1 so:libcrypto.so.1.1 so:libgcc_s.so.1 so:libncursesw.so.6 so:libreadline.so.8 so:libssl.so.1.1 so:libstdc++.so.6 so:libz.so.1
p:so:cmd-mirror.so=0 so:cmd-sleep.so=0 so:cmd-torrent.so=0 so:liblftp-jobs.so.0=0.0.0 so:liblftp-network.so=0 so:liblftp-pty.so=0 so:liblftp-tasks.so.0=0.0.0 so:proto-file.so=0 so:proto-fish.so=0 so:proto-ftp.so=0 so:proto-http.so=0 so:proto-sftp.so=0 cmd:lftp cmd:lftpget

And the package is available at:
https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/lftp-4.9.2-r1.apk

This is the same as all the other platforms (aarch64, armhf, mips64, ppc64le, s390x, x86, x86_64), so the apk add --no-cache lftp command should work on armv7. Until I can prove on one of my machines that Alpine Linux has messed up their armv7 LFTP package, I’m not going to report this to them yet, because it’s almost inconceivable that they’d make a mistake like that. It’s much more likely that a network problem or insufficient storage space or something else is to blame.

I’ve got an extra Pi on which I can try to install the armv7 version of Home Assistant to see if I can duplicate your problem, but it will likely be a few days before I can do it.

Ok, so I installed the armv7 version of Home Assistant OS 6.2 on my extra Raspberry Pi, and the LFTP Mirror add-on installs fine:

21-08-11 03:28:31 INFO (MainThread) [supervisor.addons] Creating Home Assistant add-on data folder /data/addons/data/423ea876_lftp_mirror
21-08-11 03:28:31 INFO (SyncWorker_4) [supervisor.docker.addon] Starting build for 423ea876/armv7-addon-lftp_mirror:1.0.2
21-08-11 03:29:27 INFO (SyncWorker_4) [supervisor.docker.addon] Build 423ea876/armv7-addon-lftp_mirror:1.0.2 done
21-08-11 03:29:27 INFO (MainThread) [supervisor.addons] Add-on '423ea876_lftp_mirror' successfully installed

So, there must be something wonky with your Home Assistant installation, network connectivity, or storage.

Exactly what I was looking for - thanks for this add-on.

Regarding the issues during first install as mentioned by @alexreddy78 - I also got these errors.
The solution which helped me can be found here

Thank you! It’s good to know that there isn’t an installation problem with this add-on, and have an explanation for alexreaddy78’s problems.

And now I understand why I wasn’t able to reproduce that problem, because I was testing against instances of the Home Assistant Operating System (which has the necessary libseccomp2), and not manual container/core installations.

Hi there,

Is there anyway of calling this to run via a service call, as opposed to wait for the scan interval?

Thanks,

J.