Saltar al contenido principal

Integración domótica CasaOS, gratuita y de código abierto

Integración CasaOS para Gladys Assistant

Your CasaOS server: CPU, memory, disks, temperatures, apps; start and stop an app.

info

La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.

Gladys reads your CasaOS home server through its local API: the load of the processor, the memory, the system disk, the temperatures, and the apps installed from the CasaOS app store. Each app becomes a Gladys device with Start and Stop buttons.

Unofficial integration, not affiliated with IceWhale (the makers of CasaOS and ZimaOS).

Tested against CasaOS 0.4.15 running in a container (the dockurr/casa image), with a test app installed, started and stopped. Never tested with a real device (a real CasaOS box, its sensors and disks). ZimaOS is not verified: its API may differ.

What you get​

  • The server (one device): CPU (%), CPU temperature, memory (% and MB used), system disk (% used and GB free), apps running and stopped, and the temperature of each physical disk CasaOS lists. A temperature CasaOS gives as 0 (no sensor, a virtual machine) is left unknown, never shown as 0 °C.
  • Each app (one device per app): running (yes / no), update available (yes / no), and the Start and Stop buttons. The app that runs Gladys itself (recognized by "gladys" in its id, title, service names, image, container or host name) is never offered.

The values are read every minute by default (30 s to 1 h), the disks every 5 minutes.

Configuration​

  1. CasaOS address: the one you open CasaOS with, http://192.168.1.20 (add :port when it is not 80). https:// only behind a reverse proxy whose certificate comes from a known authority; a self-signed certificate is refused. No path.
  2. User name and password of your CasaOS account. The password is kept by Gladys in its database, never shown again, and sent only to CasaOS, at login. With http:// it crosses your local network in clear, as it does when you log in to the CasaOS page.
  3. Refresh: how often Gladys reads CasaOS.
  4. Allow stopping apps: off by default (see below).
  5. Save, then add the devices from the Discovery tab.

One login, then the session​

CasaOS accepts five logins, then one login a minute, for all its clients (your browser included). The integration logs in once, then renews its session with the refresh token CasaOS gives (no password). It does not log in twice within a minute, even across a restart of the integration (the time of the last login is written to /data before the login is sent; when /data cannot be written, there is no login and the status says so).

If CasaOS refuses the user name or the password, the integration stops and says so: nothing is tried again until you save the configuration or press Test the connection. The refusal is remembered across restarts as a 6-bit mark (it can never tell the password).

Start and stop an app​

  • Start needs no option.
  • Stop can cut a service of the house (a database, an MQTT broker, a camera recorder Gladys uses): it is off by default. Tick Allow stopping apps to use it. The option is checked when the press arrives and again just before the command is sent.
  • Both are buttons, never a switch: a voice assistant or a "turn everything off" never reaches them.

Each press reads the app first. The command is refused, and nothing is sent, when:

  • stopping is not allowed (Stop only);
  • the app is the one running Gladys (its id, title, a service name, image, container or host name holds "gladys");
  • the app is not installed any more, or CasaOS shows one of its services paused, restarting or in another state than running, exited, created or dead;
  • the user name or password was refused, CasaOS asked to wait (HTTP 429), the integration is not connected, or the configuration changed meanwhile;
  • another command of the same app is still running, or the previous one is still being applied;
  • the time left within the 5 s Gladys waits is too short.

When the app is already in the state asked, nothing is sent and the press succeeds. An app of several services with some running and some stopped is shown running; Start then aims at every service running, Stop at none running.

The acknowledgement never waits for the states sent to Gladys.

CasaOS applies a command in the background. The press succeeds only once a read shows the app in the state asked; otherwise Gladys is told "sent, without confirmation", and the app is read again 5 s and 20 s after the command (the state published then is the one read). A command is never sent twice.

Troubleshooting​

  • "Login to CasaOS in N s": CasaOS accepts one login a minute; the integration waits.
  • "CasaOS refused the user name or the password": correct them and save.
  • "not an answer of CasaOS": the address points to another web server.
  • "CasaOS asked to wait": too many requests; every read and command pauses (1 min to 6 h, kept across restarts).
  • The integration logs what it does (LOG_LEVEL=debug for more), never a password nor a token.

Limits​

  • One CasaOS server per integration. Up to 100 apps and 16 disks.
  • The disk health CasaOS reports is not used: it is true whenever SMART gives nothing.
  • Apps installed outside the CasaOS app store (a plain docker run) are not listed by CasaOS as apps, so not here either.

Parámetros de configuración​

Estos son los parámetros que CasaOS te pide en su pantalla de configuración en Gladys.

ParámetroTipoObligatorioDescripción
How it workssectionNoGladys reads your CasaOS server through its local API, with a CasaOS account: CPU, memory, system disk, temperatures, and the installed apps, each one a device (Discovery tab) with start and stop buttons. The app running Gladys is never offered. Stopping an app is off by default. Tested against CasaOS 0.4.15 in a container. Never tested with a real device (a real CasaOS box); ZimaOS not verified. Unofficial integration, not affiliated with IceWhale.
CasaOS addressstringSíThe address you open CasaOS with: http://<IP>, with :port when it is not 80. https:// only behind a reverse proxy with a certificate of a known authority. No path.
User namestringSíA CasaOS account (CasaOS has one account per server: yours).
PasswordsecretSíKept by Gladys in its database, never shown again, sent only to CasaOS, at login (once, then the session is renewed without it). Over http:// it crosses your local network in clear, as with the CasaOS page itself.
Refresh (seconds)numberNoHow often Gladys reads CasaOS (system values and apps; the disks every 5 minutes). 30 to 3600 seconds.
Stopping appssectionNoStarting an app needs no option. Stopping one can cut a service of the house (a database, an MQTT broker, a camera recorder Gladys uses): it is off until you tick the box below. The app running Gladys is never started nor stopped from Gladys.
Allow stopping appsbooleanNoOn: the Stop button of an app device stops the app (checked again just before the command is sent).

Cómo instalar CasaOS en Gladys​

  1. En Gladys, abre Integraciones: CasaOS aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
  2. Haz clic en Instalar. Gladys descarga la imagen Docker (ghcr.io/lm1lc3n7/gladys-casaos:0.1.1), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración).
  3. Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
  4. También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-casaos.

CasaOS requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.

¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.

Sobre las integraciones externas​

CasaOS es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.

Suscríbete a la newsletter de Gladys Assistant

Unos pocos correos al mes sobre nuevas versiones y novedades del proyecto. Enviados por Pierre-Gilles Leymarie, fundador del proyecto. Puedes darte de baja cuando quieras 🙂