Seafile

The Seafile integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] connects Home Assistant to your Seafile server.

Seafile is a self-hosted file sync and share server. Files are stored in libraries. This integration shows the size, number of files, and last modification time of the libraries you choose, and can store Home Assistant backups in them.

Use cases

  • Keep an eye on how much storage your libraries use and get notified when one grows too large.
  • Check that a library you back up to is still being updated.
  • Store your Home Assistant backups on your own Seafile server.

Prerequisites

  • A Seafile server that Home Assistant can reach.
  • A Seafile account with access to the libraries you want to add.

Configuration

To add the Seafile service to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

URL

The address you use to open Seafile in your browser, for example, https://seafile.example.com.

Username

The email address or login ID of your Seafile account.

Password

The password of your Seafile account. It is only used to create an access token and is not stored.

Verify SSL certificate

Turn this off if your server uses a self-signed certificate.

If your account uses two-factor authentication, you are asked for the code from your authenticator app.

Home Assistant exchanges your password for an access token. In Seafile, this token is listed under the linked devices of your account as Home Assistant, followed by the name of your home in parentheses. Revoking it there disconnects Home Assistant.

After logging in, you can select the libraries to add. You can also skip this step and add libraries later.

Adding a library

  1. Go to Settings > Devices & services and select the Seafile integration.
  2. Select Add library.
  3. Select the library you want to add.
  4. Optionally, turn on Store backups and choose a Backup folder. See Backups.

To change the backup settings of a library later, select the Reconfigure library button next to the library.

Library

The library to add. Encrypted libraries are not supported.

Store backups

Make this library available as a backup location in Home Assistant.

Backup folder

The folder in the library to store backups in. Defaults to /Home Assistant backups. It is created when the first backup is uploaded.

Supported functionality

Each library is added as a separate device in Home Assistant, with the following entities.

Sensors

  • Size
    • Description: Total size of the files in the library.
  • Files
    • Description: Number of files in the library.
  • Last modified
    • Description: Time the library was last changed.

Backups

Each library with Store backups turned on is available as a backup location in Home Assistant, named after the account and the library, for example, admin@example.com (seafile.example.com) - Documents. Libraries you select while setting up the integration have backups turned off; turn them on by reconfiguring the library.

Each backup is stored in the backup folder as a .tar file, with a _meta.json file next to it that describes the backup. Don’t rename or delete only one of the two files: backups without both files are not listed.

Backups are uploaded in parts of 50 MiB, so they also work when Seafile is behind a proxy that limits the request size, such as Cloudflare.

For more information on backups, see backups.

Data updates

The Seafile integration pollsData polling is the process of querying a device or service at regular intervals to check for updates or retrieve data. By defining a custom polling interval, you can control how frequently your system checks for new data, which can help optimize performance and reduce unnecessary network traffic. [Learn more] your Seafile server every 5 minutes.

The list of backups is cached for 5 minutes. Backups that you add or delete in Seafile directly can take up to 5 minutes to show up in Home Assistant.

Supported versions

The integration has been tested with Seafile 13 and 14 (Community Edition).

Known limitations

  • Encrypted libraries are not supported and are not shown in the list of libraries.
  • An account on a server can only be added once.
  • There is no reauthentication yet. If the access token is no longer accepted, remove the integration and add it again.

Troubleshooting

Symptom: The sensors of a library are unavailable

The sensors of one or more libraries show as unavailable.

Description

Home Assistant can’t reach the Seafile server, or the library is no longer available to your account: it was deleted on the server, or your account lost access to it. When the server can’t be reached, the sensors of the account are unavailable as well.

Resolution

  1. Check that Home Assistant can reach the Seafile server, and look for connection errors in Settings > System > Logs.
  2. Sign in to the Seafile web interface with the same account and check that the library is still listed.
  3. Only if the library is gone from your account, delete its library entry from the Seafile integration page.

Symptom: A library is not listed as a backup location

The library is not shown as a location when you create a backup.

Description

Store backups is turned off for the library, or the Seafile account is not loaded.

Resolution

  1. On the Seafile integration page, select the Reconfigure library button next to the library.
  2. Turn on Store backups and select Submit.
  3. If the library still isn’t listed, check that the integration is loaded and its sensors are available.

Symptom: The integration fails to load with an authentication error

The integration shows an authentication error and its entities are unavailable.

Description

The access token of the integration was revoked or is no longer valid.

Resolution

Remove the integration and add it again with your current password.

Removing the integration

This integration follows standard integration removal.

To remove an integration instance from Home Assistant

  1. Go to Settings > Devices & services and select the integration card.
  2. Next to the entry you want to remove, select the three dots menu. Then, select Delete.
    • Depending on the integration, the entries are listed under one of the following headings:
      • Devices
      • Hubs
      • Services
      • Integration entries
  3. To confirm, select Delete.
    • Home Assistant also deletes the devices and entities of the entry.
  4. If Home Assistant asks you to restart, restart Home Assistant.
  5. If Home Assistant asks whether to also delete the application credentials, select Remove or Keep.

To also remove the access token from Seafile, delete the Home Assistant entry from the linked devices of your account.