Saltar al contenido principal

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

Integración LinkTap para Gladys Assistant

LinkTap water timers, locally through the gateway: watering, flow, start, stop.

info

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

Unofficial Gladys Assistant integration for the LinkTap water timers (TapLinker, ValveLinker) paired with a LinkTap gateway (GW-02, GW-01), through the local HTTP API of the gateway: no LinkTap cloud, no account. Not affiliated with LinkTap.

Never tested with a real device: built from the Home Assistant integration linktap_local_http_component (0.8.9) and the description of the LinkTap protocol. Please report what works and what does not.

What you get​

One device per water timer, with:

  • Watering (yes/no) and Watering time left (seconds);
  • with a flow meter: Flow (m³/h) and Volume of this watering (litres; a gateway set to gallons is converted, US gallon);
  • Battery (%), Radio signal (%), Linked to the gateway;
  • Watering plan paused;
  • the alerts: unusually high flow, unusually low flow, water cut off, timer fallen, valve failed to close;
  • three buttons: Start watering, Stop watering, Pause the watering plan.

Watering is never a switch: a "turn everything on/off" of a voice assistant, HomeKit or a scene on switches cannot open a valve.

A water timer the gateway no longer reaches by radio only publishes "Linked to the gateway: no": its other values, kept by the gateway, are old.

Setting up​

  1. Open the web page of the gateway (its IP address in your router) and enable its Local HTTP API. Firmware G609 or later for a GW-02, S609 for a GW-01.
  2. Give the gateway a fixed IP address in your router.
  3. In Gladys, open the integration, type the address, save.
  4. Add the water timers from the Discovery tab.

The local API has no password and no https: any device of your local network can use it. The gateway handles one request at a time: one integration (Gladys, Home Assistant…) per gateway, and Gladys never sends two requests at once.

Reads​

The gateway is read every 30 s by default (15 to 600 s), one request per water timer, one after the other; never sooner, even after a restart, a configuration saved or the "Check the gateway" button, except the reads that follow a command (5, 15, 30 and 60 s after it). On a failure: tried again after 30 s, 1, 2 then 5 minutes. When the gateway answers "busy" (HTTP 429 or 5xx, or its code 6 or 8), Gladys pauses for 1 minute to 6 hours, kept across a restart; stops do not wait for it.

A water timer the gateway does not know, or whose answer is unreadable, does not keep the others from being read. When another gateway answers at the address, the status says so, and the commands of the timers of the previous gateway are refused.

Starting​

  • Starting opens a valve: it is off by default. Turn on Allow starting a watering to use the Start button. Otherwise the dashboard, the scenes and the voice assistants can only read, stop and pause the plan. A saved configuration applies to the commands at once (an option unticked holds the starts from that moment, even while a read runs).
  • Gladys reads the timer first: already watering, nothing is sent (the run is never lengthened).
  • The watering lasts the configured length (15 minutes by default, 120 minutes at most, a bound applied by Gladys); it is part of the command and the water timer closes the valve by itself at the end. Gladys never sends a watering by volume.
  • Refused, nothing sent: the option off; the address of the configuration is not the one of the gateway of the timer; a pause asked by the gateway; the file /data/linktap.json unreadable or the start impossible to record in it; another command of the same timer waiting; a start of the same timer that left less than a minute ago and is not seen on a read yet ("try again in a minute"); the state of the timer unreadable, or the timer not linked by radio; cancelled by a stop of the timer; the configuration changed (another address) meanwhile; not sent within 10 s of the click.
  • The gateway handles one request at a time: a start behind other requests (a scene starting five timers) may leave up to 10 s after the click; Gladys then answers "queued", and when it does not leave in time (or is refused), the status says so. A stop of the same timer cancels it as long as it has not left.
  • A success is answered only when a read made after it shows the timer watering; otherwise "sent, without confirmation", then reads at 5, 15, 30 and 60 s.

Stopping​

Stopping needs no permission and is never held by the option, a pause of the gateway, a recent start, a configuration Gladys has not given yet, nor by a read in progress: the stop goes ahead of every other request; the request in flight is cut to let it leave when it has been silent for 1 s, or the stop has waited 1.5 s. It cancels the start of the same timer not sent yet. Right after a restart, a stop works even before Gladys gives the configuration.

The stop is refused unsent only:

  • when this integration never read the water timer (it is not known);
  • when the gateway of the timer has no known address any more (another gateway answered at its address);
  • when the button value is not a press.

It is sent then refused by the gateway when the gateway does not know the timer (nothing to stop, nothing sent again), or answers another error (format, parameter, command not supported).

When the gateway does not take it (no connection, a busy gateway, an HTTP error such as a 404, another gateway at the address), it is tried again 250 ms later within its 3 s, then every 10 s (every minute after 5 minutes), and at every read that reaches the gateway, without end until the gateway takes it, even during a pause and after a restart. These tries are never counted: an answer that shows nothing was applied (busy, 404) is not a resend.

After a stop taken by the gateway, a read still showing the same run watering (sent 4 s or more after the gateway took it, the radio needs time) sends it again: 3 resends at most, each counted once (when the gateway takes it, or when it left without an answer). Only reads sent after the click count, each one timed from its departure: the gateway measures during the request, up to 3 s before its answer.

Another run is never stopped by a resend when Gladys can prove it is another one: its length differs from the stopped run, its time left grew, or it is younger than the stop (its elapsed time, length minus time left, is more than 1.5 s shorter than the time from the click to the departure of the read; used only once the gateway was seen counting the time left down). In doubt, the stop wins: a run restarted by the LinkTap app within seconds of the stop may be stopped by a resend, for instance when it has the same length and the time left of the gateway does not count down (or is not given), or when Gladys had not read the stopped run before the click and the first read after it already shows the new one (that read is then the reference, whatever its length).

The watch of a stop is lifted only by:

  • a read showing the timer stopped, followed by a watering read twice in a row (started elsewhere), or a different run read twice in a row;
  • a start from Gladys with the option on: one that leaves, or one that finds the timer already watering;
  • the gateway answering that it does not know the timer.

It is never lifted by the time alone. The status tells a stop not taken yet, and a watering that goes on after three resends.

Pausing the plan​

The button pauses the watering plan of the timer for the configured length (24 h by default, 1 to 240 h). It does not need the start option. Gladys reads the timer first: already paused, nothing is sent (a second pause can switch the plan off, a known LinkTap issue). After a pause sent, another one is refused until a read shows the plan paused, 10 minutes at most (kept across a restart). Refused, nothing sent: state unreadable, timer not linked, a firmware that does not tell whether the plan is paused, a pause asked by the gateway, the address of the configuration not the one of its gateway, /data not writable, the configuration changed meanwhile, not sent within 10 s of the click. Resuming the plan is done in the LinkTap app.

"Check the gateway" button​

Shows the id of the gateway, its firmware, the number of water timers and the age of the last read, or the last error. It never reads sooner than the interval.

The /data file​

/data/linktap.json keeps the gateway and its water timers, the pause asked by the gateway, the starts and stops being watched and the time of the last read. No secret: the local API has none. When it exists but cannot be read, Gladys writes nothing to it any more (it is never overwritten), refuses the starts and keeps reading and stopping.

Parámetros de configuración​

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

ParámetroTipoObligatorioDescripción
Your LinkTap gateway, on your local networksectionNoThe water timers (TapLinker, ValveLinker) paired with a LinkTap gateway (GW-02, GW-01), through the local HTTP API of the gateway, without the LinkTap cloud. In the web page of the gateway, enable its Local HTTP API (firmware G609 or later for a GW-02, S609 for a GW-01), give the gateway a fixed IP address in your router, type it below, then add the water timers from the Discovery tab. The gateway answers one request at a time: use one integration only per gateway. Never tested with a real device. Unofficial integration, not affiliated with LinkTap.
IP address of the gatewaystringNoFor example 192.168.1.60 (port 80; another port after a colon).
Refresh interval (s)numberNoHow often the gateway is read, in seconds (one request per water timer, one at a time). Never sooner, even after a restart, except the reads that follow a command.
Starting and stopping a wateringsectionNoEach water timer has a Start, a Stop and a Pause the watering plan button, never a switch. Starting opens a valve: refused until you allow it below. A watering started from Gladys lasts the length below, 120 minutes at most, and the water timer closes the valve by itself at the end. Stopping needs no permission and is never held by a pause of the gateway or a recent start; it goes ahead of every other request and cancels the start of its water timer not sent yet. It is refused unsent only when Gladys never read the water timer or no address of its gateway is known any more. A stop the gateway has not taken is tried again, spaced, without end until it is.
Allow starting a wateringbooleanNoOff by default: the water timers are only read, stopped and their plan paused. On: the dashboard, the scenes and the voice assistants can start a watering.
Length of a watering started from Gladys (min)numberNoFrom 1 to 120 minutes. The water timer closes the valve by itself at the end.
Length of a pause of the watering plan (h)numberNoFrom 1 to 240 hours. A plan already paused is left as it is (a second pause can switch it off).
Language of the feature namesselectNoUsed for the names of the features added from now on, and for the command errors.

Cómo instalar LinkTap en Gladys​

  1. En Gladys, abre Integraciones: LinkTap 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-linktap: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-linktap.

LinkTap 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​

LinkTap 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 🙂