Integración domótica KEF Wireless Speakers, gratuita y de código abierto

KEF wireless speakers (LS50 Wireless II, LSX II, LS60), local: power, volume, source, playback.
La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.
Control your KEF wireless speakers (LS50 Wireless II, LSX II, LSX II LT, LS60) from Gladys, locally, without any cloud: power on, standby, volume, mute, source, play, pause, next, previous and the title playing.
Important. This integration has never been tested with a real speaker: it was written from the
pykefcontrollibrary, and the KEF API it uses is not documented by KEF. It was tested against a fake speaker only. Your feedback is welcome. Unofficial integration, not affiliated with KEF. The XIO soundbar is not confirmed (pykefcontrol does not list it).
Setup
- Give each speaker a fixed IP address in your router (reserved DHCP lease).
- In Gladys, install the KEF Wireless Speakers integration, then open its configuration.
- Type the IP addresses, separated by commas (for example
192.168.1.50, 192.168.1.51). - Choose the volume cap (40 % by default) and the refresh interval (10 s by default, 5 to 300 s).
- The speakers appear in the Discovery tab: create them.
The integration reads each speaker over its HTTP API (http://<ip>/api/…,
port 80) at the refresh interval. A change made on the speaker, its remote or
the KEF Connect app shows in Gladys at the next read.
What you get
| Feature | Gladys type | Note |
|---|---|---|
| Power | binary state (read only) | 1 on, 0 in standby or not answering |
| Power on | button | wakes the speaker up |
| Standby | button | puts the speaker in standby; never waits, never blocked |
| Volume | music / volume (0 to 100) | capped |
| Mute | button (television / mute) | mutes (volume 0), or unmutes at most at the cap |
| Play, pause | music buttons | through the play/pause toggle, only when it is needed |
| Next, previous | music buttons | refused in standby |
| Playback | music state (read only) | 1 playing, 0 otherwise |
| Source | dropdown | Wi-Fi, Bluetooth, TV, optical, coaxial, analog |
| Now playing | text (read only) | "Artist - Title"; "—" when nothing plays or in standby |
On purpose, no switch: an "everything off" or "everything on" from a voice assistant or a scene neither wakes nor cuts your speakers.
Volume cap
The volume asked from Gladys (dashboard, scene, voice assistant) never goes above the cap of the configuration: a higher volume is set to the cap. The cap is read again just before sending: a new value saved applies at once. The volume set on the speaker itself (remote, app) is not changed, except when Gladys would make it heard:
- Power on, or a source chosen while the speaker is in standby (it wakes it up): the volume is read after the wake-up and lowered to the cap when above it; the check is made again every 2.5 s for about 15 s, and a volume turned up above the cap during those 15 s is lowered too.
- A lowering ignored: a volume sent and not read back (the speaker accepted it and ignored it) is "sent, without confirmation", and the same checks follow for about 15 s.
- Unmute: the mute of this integration is a volume set to 0 (as pykefcontrol does); unmuting sets back the previous volume, at most the cap. A speaker muted by its own remote or app is left alone (the command is refused): unmute it there.
Commands
Every command is answered within 4 seconds (Gladys waits 5 seconds).
- Before each command, the MAC address of the speaker at the address is read again: when another speaker answers there (address changed), nothing is sent and the address is forgotten (type the new one in the configuration). An unreadable answer refuses the command, nothing sent, the address kept.
- A command is confirmed only when the speaker gives back the value asked (power, volume, source, play state); otherwise it is reported "sent, without confirmation". A command that could not leave is reported "nothing sent", and a command still waiting at the end of its 4 seconds is dropped, never sent late.
- Standby and Pause never wait behind another command. Standby cancels the commands still waiting that could wake the speaker (power on, source, play, next, previous); Pause cancels play, next and previous ("cancelled by Standby / Pause, nothing sent"). A Standby not confirmed (for example while the speaker is still waking up from a Power on) is asserted again for about 20 s whenever the speaker reads "on"; a Power on from Gladys ends it.
- Play acts only when paused, Pause only when playing (the KEF API has a toggle only), one toggle at a time per speaker: two Pause presses, or a Pause right after a Play, end paused. Pause waits, within its 4 seconds, for a settled state (buffering ends); Play in another state is refused, nothing sent.
- The order of the requests decides: a Power on asked after a Standby wins (the Standby is no longer asserted again), a Standby asked after a Power on wins. A Mute cancels the volumes asked before it and still waiting.
Reads
- A speaker is read every refresh interval, never sooner: neither the
buttons, nor a Discovery scan, nor a reconnection to Gladys, nor a
configuration saved again, nor a restart of the integration (the time of
the last read is kept in
/data) make it read sooner. - A speaker that does not answer twice in a row shows as off and is named in the integration status; it is then read at spaced intervals (doubled up to 5 minutes).
Configuration buttons
- Find the speakers: reads the addresses whose read is due, then publishes the Discovery list.
- Check the speakers: the last read of each speaker (power, volume, source, how long ago) and the cap in force. It reads nothing.
Data and privacy
The integration asks for no account and no password: the KEF API has none.
It keeps in /data/kef.json the known speakers (MAC address, address, name,
model, the volume replaced by a mute) and the time of the last read of each
address. Nothing leaves your local network.
Known limits
- The KEF API is not documented: its answers may differ on a real speaker or after a firmware update.
- No automatic search on the network yet: type the addresses.
- No equalizer, presets, playlists, repeat or shuffle.
- Never tested with a real device: no real KEF speaker was tried.
Parámetros de configuración
Estos son los parámetros que KEF Wireless Speakers te pide en su pantalla de configuración en Gladys.
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| Your KEF speakers, on your local network | section | No | Power on, standby, volume, mute, source, play, pause, next, previous and the title playing of each KEF wireless speaker (LS50 Wireless II, LSX II, LSX II LT, LS60; XIO not confirmed), through its local HTTP API, without any cloud. Give each speaker a fixed IP address in your router and type it below: the speakers then appear in the Discovery tab. The volume set from Gladys never goes above the cap below, also when a speaker wakes up or is unmuted. The KEF API is not documented: never tested with a real speaker. Unofficial integration, not affiliated with KEF. |
| IP addresses of the speakers | string | No | Separated by commas, for example 192.168.1.50, 192.168.1.51. |
| Volume cap (%) | number | No | The highest volume Gladys may set, from 1 to 100 % (100: no cap). A higher volume asked by a scene, a voice assistant or the dashboard is set to this cap; a speaker woken up or unmuted by Gladys is brought back under it. The volume set on the speaker itself (remote, app) is not changed. |
| Refresh interval (s) | number | No | How often each speaker is read, from 5 to 300 seconds. A speaker is never read sooner, whatever the buttons or a restart. |
Cómo instalar KEF Wireless Speakers en Gladys
- En Gladys, abre Integraciones: KEF Wireless Speakers aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
- Haz clic en Instalar. Gladys descarga la imagen Docker (
ghcr.io/lm1lc3n7/gladys-kef:0.1.2), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración). - Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
- También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-kef.
KEF Wireless Speakers 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
KEF Wireless Speakers 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.
- Explorar todas las integraciones, nativas y de la comunidad
- Crear y publicar tu propia integración externa
- Código fuente en GitHub — fuente de esta documentación