Saltar al contenido principal

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

Integración PETLIBRO para Gladys Assistant

PETLIBRO feeders and Dockstream fountains: food, meals, water, filter, pump, battery.

info

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

This integration brings the connected PETLIBRO devices into Gladys: the smart feeders (Granary, Air, One RFID, Space, Polar wet food) and the Dockstream water fountains, through the PETLIBRO cloud (the one of the PETLIBRO app). Unofficial, not affiliated with PETLIBRO.

Development version (0.1). Built from the community clients of the PETLIBRO API (the Home Assistant integration and homebridge-petlibro-2) and tested with simulated answers, not with a real account yet. Feedback is welcome on the GitHub repository.

Before you start: a second PETLIBRO account​

PETLIBRO allows one session per account: when Gladys signs in with the account of your phone, the PETLIBRO app is signed out, and the other way round. So, like the Home Assistant and Homebridge integrations recommend, give Gladys its own PETLIBRO account, and share your devices with it:

  1. Create a second PETLIBRO account with another e-mail address (in the app, on another phone, or after signing out of your main account).
  2. Sign in to the PETLIBRO app with your main account, open each device and share it with the e-mail of the second account (the share option of the device settings; its wording depends on the app version). Accept the share on the second account if the app asks.
  3. In Gladys, enter the e-mail and password of the second account.

The shared devices then show up in Gladys, and the PETLIBRO app stays signed in on your phone. If you use the same account in both places anyway, the integration notices that its token keeps being refused right after its sign-in: it waits 15 minutes, tries once more, then stops and asks for a second account.

What you get​

One Gladys device per PETLIBRO device:

DeviceIn Gladys
Dry food feeder (Granary, Granary Camera, Air, One RFID, Space)"Feed now" button, "Feeding plan" switch, food level (low/normal; one per hopper on the two-hopper Granary), dispensed today (portions), meals today, last meal (portions), desiccant (% of its cycle, days left, "Desiccant replaced" button), battery, battery low, on mains power, online
Polar wet food feederfood level, temperature, cleaning (% of its cycle, days left, "Cleaned" button), battery, battery low, online
Dockstream fountain (Dockstream, Dockstream RFID, Dockstream 2, 2 Cordless)"Pump" switch (Dockstream 2), water (low/normal against the low-water threshold set in the app, Dockstream 2), water level %, water left (mL), drunk today (mL), drinks today, filter (% of its cycle, days left, "Filter replaced" button), cleaning (% of its cycle, days left, "Cleaned" button), battery, charging and on mains power (Cordless), error, online
  • Portions are counted as the PETLIBRO app counts them (a twelfth of a cup on most feeders; the Air's portions are half as big).
  • The consumables (desiccant, filter, cleaning) are shown in the Gladys maintenance category: the percent of the cycle left (the cycle set in the PETLIBRO app, 30 days for instance), next to the days left. After changing the filter or the desiccant, or cleaning the fountain, press the matching button: PETLIBRO restarts the countdown.
  • The last meal is dated with the time it was dispensed, not with the time of the reading.
  • The badge of each device shows cloud; unreachable with an orange dot when PETLIBRO reports the device offline, plain unreachable when PETLIBRO does not answer.

Not supported yet: the Luma litter box, the camera of the Granary Camera feeder, the plates and the lid of the Polar (its own manual feeding), editing the feeding plans, and the light, sound, child lock and display settings. The first Dockstream generation cannot stop its pump: it has no "Pump" switch.

Installation​

  1. Install the integration from the Gladys store.
  2. In the Configuration tab, enter the e-mail and the password of the PETLIBRO account (preferably the second account, see above). Save.
  3. The status says "Connected to PETLIBRO: 3 devices".
  4. Open the Discovery tab and add the devices you want to follow. Their values arrive as soon as they are added.

The Test the connection button signs in again if needed, reads the account and lists its devices.

Buttons, switches and feeding from a scene​

  • Feed now dispenses the number of portions of the "Portions of the Feed button" option (1 by default, up to 10).
  • The Feed with a PETLIBRO feeder scene action dispenses any number of portions: 1 to 48, 1 to 16 on the Air Smart Feeder. Another number fails with the accepted range.
  • Feeding plan turns the feeding schedule of the feeder on or off; Pump starts or stops the pump of a Dockstream 2. The switch shows the value PETLIBRO reports at the next reading, 15 seconds after the command.
  • PETLIBRO refuses a command when the device is offline: the error message shows in Gladys.

A meal asked from Gladys does not fire the "Meal dispensed" trigger, so a scene cannot loop on it.

Scenes​

Two scene triggers:

  • Meal dispensed: a feeder dispensed a meal, from its plan, the app or its own button. Variables feeder_name, portions and at (UTC). The filter can target a feeder.
  • PETLIBRO alert: a device starts reporting a problem: food running low, water running low, battery low, desiccant to replace, filter to replace, cleaning due (0 days left), or a device error. The filter can target a device and some alerts; variables device_name and message. An alert fires once when it starts, again only after it cleared.

The first reading after a start fires nothing, and meals older than 15 minutes found after an outage are only recorded. The other values (water level %, battery…) work with the usual "Device state changed" trigger: for a first generation Dockstream, which reports no low-water threshold, use its water level.

How often it reads​

Every 2 minutes by default (60 to 900 seconds): the live state of each device, plus the meals of the day of each dry food feeder and the pump and drinks of each fountain. The list of meals itself is read only when the count of the day changes, and at least every 30 minutes. The device list is read again every 30 minutes and on a Discovery scan. On errors the integration waits 1, 2, 5, 10 then 15 minutes. It signs in at most once every 15 minutes and keeps its token across restarts.

Options​

OptionDefaultPurpose
E-mail, password—a PETLIBRO account, preferably a second one your devices are shared with
Time zone of the devicesGladys's zonePETLIBRO counts the meals of the day in it (IANA name)
Refresh interval (s)120how often the devices are read
Portions of the Feed button1what "Feed now" dispenses (1 to 10)
Language of the feature namesFrenchnames of the features and alert messages

Troubleshooting​

  • "PETLIBRO refused the sign-in": check the e-mail and the password in the PETLIBRO app. The integration does not retry by itself: it waits for a change or a click on Test the connection.
  • "PETLIBRO knows no account with this e-mail": check the e-mail.
  • "PETLIBRO refused the token right after the sign-in": the same account is signed in to the PETLIBRO app. Use a second account your devices are shared with.
  • A device is unreachable with an orange dot: PETLIBRO reports it offline (Wi-Fi, power). Check it in the app.
  • A model is missing: the litter box and other devices are not supported yet; the test button counts them. Open an issue on the GitHub repository.

Privacy​

The e-mail and password are stored by Gladys as a secret (never sent back to the browser). The integration sends the e-mail and an MD5 hash of the password to the PETLIBRO server (api.us.petlibro.com, the one the app uses in every country) to open a session, like the app does; it keeps the token in its /data folder. PETLIBRO, Granary and Dockstream are trademarks of their owner; this integration is not affiliated with PETLIBRO.

Parámetros de configuración​

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

ParámetroTipoObligatorioDescripción
Your PETLIBRO accountsectionNoBrings your PETLIBRO devices into Gladys through the PETLIBRO cloud: food level, meals of the day, last meal, feeding plan and desiccant of the feeders (Granary, Air, One RFID, Space, Polar), water level, pump, filter and cleaning of the Dockstream fountains, batteries, plus a feed button, a scene action and scene triggers. PETLIBRO allows one session per account: use a second PETLIBRO account your devices are shared with (see the guide), otherwise the app and Gladys sign each other out. Then add the devices from the Discovery tab. Unofficial, not affiliated with PETLIBRO.
PETLIBRO e-mailstringSí
PETLIBRO passwordsecretSí
Time zone of the devicesstringNoLeave empty to use the time zone of Gladys. Otherwise an IANA name such as Europe/Paris: PETLIBRO counts the meals of the day in it.
Refresh interval (s)numberNoHow often the devices are read, in seconds (60 to 900). Two or three requests per device.
Portions of the Feed buttonnumberNoHow many portions the "Feed now" button of a feeder dispenses (1 to 10). The scene action takes any number.
Language of the feature namesselectNoUsed for the names of the features and the alert messages.

Cómo instalar PETLIBRO en Gladys​

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

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

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