Skip to main content

Seafile smart home integration, free and open source

Seafile integration for Gladys Assistant

Monitor your Seafile server: storage, quota, libraries and availability.

This integration connects Gladys to your Seafile server (Community or Professional edition): how much storage your account uses, its quota, its libraries, the server-wide statistics when the account is a system admin, and whether the server answers at all.

It only reads: nothing is ever written, moved or deleted on your server.

Before you start​

Gladys 5.3 or newer is required.

Gladys must be able to reach your Seafile server over the network, at the address you open it at in a browser (for example https://seafile.example.com or http://192.168.1.20:8000).

The integration signs in as one Seafile account. A normal account is enough; a system admin account also brings the statistics of the whole server (users, files, storage).

  1. Open Seafile in a browser and sign in with the account Gladys should use.
  2. Click your avatar (top right), then Settings.
  3. In Web API Auth Token, click Generate and copy the token.
  4. Paste it in the API token field of the integration.

An API token also works when the account uses two-factor authentication. To cut Gladys off, delete the token in the same place.

The other way: a username and a password​

Leave the API token empty and fill in Username (the email or login ID of the account) and Password. The integration exchanges them for a token, which shows in Seafile under Settings → Linked devices as Gladys Assistant: delete it there to cut Gladys off. The token is kept in memory only, and a new sign-in reuses the same linked device.

This does not work with two-factor authentication: use an API token for such an account.

Configuration​

FieldWhat to put there
Server addressThe address you open Seafile at. Without http:// or https://, https is assumed.
API tokenRecommended, see above. It wins over the username and password.
Username / PasswordOnly without an API token.
Accept a self-signed certificateOnly if your server uses https with a certificate it signed itself.
Refresh interval (s)How often the server is read, 60 to 3600 seconds (default 300).
Quota alert threshold (%)The level that fires the Quota threshold crossed scene trigger (default 90).
Libraries as devicesAlso publish one device per library the account owns.
Library namesOnly these libraries become devices, separated by commas (case does not matter). Empty: all of them.

Then click Test the connection: the answer names the Seafile version, the account, the storage used and the number of libraries. List the libraries shows the names to copy into Library names.

Devices​

Open Integrations → Seafile → Devices, then create the devices you want to keep.

Seafile server​

FeatureValue
Online1 when the server answered the last reading, 0 otherwise
Seafile versione.g. 13.0.5
Storage usedused by the account, in GB
Quotaquota of the account, in GB — only when the account has a quota
Quota usedin %, only when the account has a quota
Librarieslibraries the account sees (its own, shared with it, of its groups)
Userssystem admin only: accounts on the server
Active userssystem admin only
Files on the serversystem admin only
Storage of the serversystem admin only, in GB
Connected clientssystem admin only: desktop and mobile clients connected

The quota and admin features appear the first time the server reports them: the device is then published again, with the new features, and you can update it in Gladys.

Seafile libraries​

With Libraries as devices on, every library the account owns becomes a device (the ones shared with it do not), or only the ones listed in Library names:

FeatureValue
Sizein GB
Filesnumber of files

Renaming a library in Seafile keeps its device: devices follow the library's id, not its name.

Actions​

  • Test the connection — reads the server now and says what was found.
  • List the libraries — the libraries the account sees, the largest first, with their size; the shared ones are marked.

Scenes and dashboard (Gladys 5.1+)​

Scene triggers​

TriggerWhenVariables
The Seafile server is unreachableit stops answering, or refuses the credentials — once per outageserver name, server address, reason (code)
The Seafile server is back onlineit answers again after an outageserver name, server address, minutes offline
Quota threshold crossedthe account goes over the alert threshold of its quotaserver name, quota used (%), threshold, used (GB), quota (GB)
A library changeda file was added, edited or removed in a library the account seeslibrary name, changed by, size (GB), changed at
The Seafile version changedthe server was upgraded (or downgraded)server name, previous version, new version

Every trigger can be limited to one device: the server, or — for A library changed — one library device.

Good to know:

  • The first reading after Gladys or the integration starts is only a reference: it fires nothing, so a restart never announces a full quota or every library again.
  • A server already down when the integration starts fires no unreachable event (it was never seen up).
  • A failed reading is tried once more five seconds later before it counts as an outage.
  • The quota alert fires once on the way up, and fires again only after the usage went at least two points under the threshold.
  • The reason code of unreachable is one of UNREACHABLE, TIMEOUT, TLS, AUTH, OTP_REQUIRED, PERMISSION, NOT_FOUND, HTTP, BAD_RESPONSE.
  • A library changed is detected between two readings: with a 5-minute interval, several changes in the same five minutes fire one event.

Scene actions​

  • Read the Seafile server now — refreshes every device now. Outputs: server online (yes/no), version, used (GB), quota used (%, −1 without quota), libraries.
  • Read a Seafile library — pick a library device; outputs: library found (yes/no), name, size (GB), files, last change.

A server that does not answer is an output (online = no), not a failed action: test it in a condition after the action.

The "Seafile" widget​

Add the Seafile widget to a dashboard. It shows the quota gauge (when the account has a quota), the storage used, the number of libraries, the users (system admin), the largest libraries, the server status, its version and the account, and a Read now button. Its setting Libraries shown (0 to 8, default 5) sets the length of the list.

Good to know​

  • Sizes are in decimal gigabytes (1 GB = 1,000,000,000 bytes), like Seafile shows them.
  • The server is identified by its host (and port, and path): moving from http:// to https:// keeps the devices, a new host name creates new ones.
  • Nothing is stored on disk: the token obtained from a password lives in memory.

Troubleshooting​

MessageWhat to do
Cannot reach …Check the address, the port, and that Gladys can reach the server (same network, firewall).
… did not answer in timeThe server is overloaded or down; check it in a browser.
The certificate of … was refusedA self-signed certificate: turn on Accept a self-signed certificate.
The server refused the credentialsGenerate a new API token, or check the username and password.
This account uses two-factor authenticationUse an API token instead of the password.
… answered, but not like a Seafile serverThe address points to another site (a reverse proxy page, a login portal): fix the address.
No server statistics with an admin accountThe account must be a system admin with the right to view system info (Seafile Pro roles).

Configuration settings​

These are the settings Seafile asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Getting startedsectionNoThe integration reads your Seafile server over your network: the storage and quota of an account, its libraries, and the server statistics when the account is a system admin. Give the address of the server and an API token (Seafile: Settings → Web API Auth Token), or a username and a password. Nothing is written on the server.
Server addressstringYesThe address you open Seafile at in a browser, e.g. https://seafile.example.com or http://192.168.1.20:8000. Without http(s)://, https is assumed.
API tokensecretNoRecommended. In Seafile: your avatar → Settings → Web API Auth Token → Generate. It wins over the username and password, and works with two-factor authentication.
UsernamestringNoOnly without an API token: the email (or login ID) of the account.
PasswordsecretNoOnly without an API token. Exchanged for a token that shows in Seafile as the linked device "Gladys Assistant", where you can revoke it.
Accept a self-signed certificatebooleanNoTurn on only if your server uses https with a certificate it signed itself.
Refresh interval (s)numberNoHow often the server is read, in seconds.
Quota alert threshold (%)numberNoThe "Quota threshold crossed" scene trigger fires when the account goes over this share of its quota.
Libraries as devicesbooleanNoAlso publish one device per library the account owns, with its size and number of files.
Library namesstringNoOnly these libraries become devices, separated by commas. Empty: all of them. "List the libraries" shows their names.

How to install Seafile in Gladys​

  1. In Gladys, open Integrations: Seafile appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/prohand/gladys-seafile:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/prohand/gladys-seafile.

Seafile requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Seafile is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by prohand, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂