Support for MediaPlayback, KeypadInput, and LevelControl clusters in media devices

Hello everyone!

I just tested the new Matterbridge AI Plugin Factory by Pierre-Gilles to integrate my Freebox Player Delta (Devialet) into Gladys via Matter.

The generated plugin works very well on the Matterbridge side:
:white_check_mark: Authentication via validation on the Freebox screen
:white_check_mark: Automatic discovery of the player
:white_check_mark: Device visible in Gladys via Matter

The plugin correctly exposes the following Matter clusters:

  • OnOff
  • LevelControl (volume)
  • MediaPlayback (play/pause/stop/next/prev)
  • KeypadInput (virtual remote)

But on the Gladys side, only the OnOff cluster is recognized (as a « switch »), and it doesn’t work either because the on/off of a media player is different from a light bulb.

Is it possible to add support for the following clusters in the Gladys Matter integration?

  • MediaPlayback → play, pause, stop, next, previous
  • KeypadInput → sending keys (ok, back, home, up, down, left, right)
  • LevelControl in a media context → volume (not brightness)
  • OnOff for a media player → power on/off (different from a lamp)

This would be a huge step forward for all users who have media devices (TVs, players, TV boxes…) and use Matterbridge to integrate them.

The Freebox plugin is available here for those who want to test it:

Thanks!

Yes, that’s absolutely possible! And that’s exactly the idea behind Matter. I want to cover everything at 100% in Gladys so that all non-Matter integrations can then be done in Matterbridge.

I’ll look into it as soon as I can. Otherwise, if anyone wants to make a PR, they’re welcome to do so :blush:

Update — PR submitted + mapping of missing Matter clusters

Hello everyone!

A quick update on my Matter/Matterbridge adventure,
in all transparency: I’m not a developer at all.
I rely on Claude (Anthropic’s IA) and the Cursor editor
to help me understand the code and contribute.
Without them, I would never have been able to do what follows :slightly_smiling_face:

What’s happened since my initial post

Following Pierre-Gilles’ feedback that a PR would
be welcome, we got started. Here’s the result:

:backhand_index_pointing_right: PR #2533 submitted to the Gladys repo:

It adds support for three missing Matter clusters:

  • MediaPlayback → play, pause, stop
  • KeypadInput → navigation (up/down/left/right/ok/back)
  • LevelControl (without lighting) → volume

All this so that media devices bridged via Matterbridge
(TV, box, players…) expose real features
in Gladys, not just a switch.

The CodeRabbit bot has already done an automatic review with
two minor nitpicks that I’m currently fixing.

Mapping of missing Matter clusters

While digging into the subject, I compared
all the features available in MQTT and their coverage
in Matter. Result: about 50% of Gladys features
still don’t have a Matter cluster.

High priorities (standard Matter clusters, well documented):

  • DoorLock → LOCK (locks)
  • PowerSource → BATTERY (battery level)
  • SmokeCoAlarm → SMOKE_SENSOR + CO_SENSOR
  • BooleanState → OPENING_SENSOR (opening sensors)

Medium priorities:

  • ColorControl temperature → white color (warm/cold)
  • FanControl → ventilation/air conditioning mode
  • CarbonDioxideConcentration → CO2_SENSOR

Features that don’t exist anywhere yet :light_bulb:
Thinking further, there are uses that neither MQTT
nor Matter cover today in Gladys:

  • Valve/irrigation (the Matter ValveConfigAndControl
    cluster already exists!)
  • Water/gas meter (consumption in m³)
  • Tank level (fuel tank, pool)
  • Human presence radar mmWave (more accurate than a PIR)

Question for the community

Are there features missing from Gladys
today? Devices you can’t
integrate properly?

And if real developers want to take over these
priority clusters, the path is now marked out —
the two files to modify are
convertToGladysDevice.js and matter.setValue.js,
and the pattern is very clear to follow :slightly_smiling_face:

Hi @b3n.0 :slight_smile:

I don’t know if you saw in the PR, but we run dozens of checks to ensure the PR is good: unit tests, linting, formatting, code coverage, etc…

You also need to test the change in real conditions before being able to validate it. I don’t know if you’ve already been able to do this part?

You will find in the PR a checklist to complete before moving on to the next step. I invite you to go through the different points and let me know once the fixes are applied and the checks are done.

If it’s too complicated for you, let me know and I’ll make another PR :slight_smile:

Hi @pierre-gilles :slightly_smiling_face:

Thanks for your feedback, I’ve gone through the checklist and applied the requested fixes using Cursor.

Real-world testing: not yet, I need to dig through a closet to find an old Raspberry, I think I have an old RPi 2B, hoping it will work! ?

Great, but you should be careful as your PR modifies files outside the scope of your PR (Scene.cy.js)

It’s too old, we no longer do armv6 builds ^^

You can test on your dev machine though, no need to necessarily run it remotely :slight_smile:

The PR has been closed and a new one created by limiting the scope of the PR…

The tests have been passed, missing the test in real conditions:
npm run dev fails (apparently Node.js too recent on my machine… Is that possible?)

Thanks for your PR, but I have a small question. You chose to use a « Television » feature in Gladys. Is MediaPlayback in Matter necessarily linked to a television, or is it also used for music?

How is this cluster displayed on other Matter systems? On iOS, for example?

And yes …! In the Matter spec, MediaPlayback is a generic cluster — it’s not reserved for TVs. It is used by TV boxes, smart speakers, music players, etc.

The Matter spec distinguishes two main device types:

  • « Casting Video Player » (TV, box)
  • « Basic Audio Player » / « Speaker » (speakers, audio players)

…but both can use MediaPlayback. Then, depending on the final use, Channel, KeypadInput, and LevelControl are added.

For display in iOS Home, honestly, I don’t know — it’s a good question and I haven’t had the opportunity to test.

So your question about design choice:
Is it better to stick with the existing TELEVISION category in Gladys
(which already has all the play/pause/volume/navigation types), or use MUSIC, or create something more generic?

I completely leave that up to your judgment :slightly_smiling_face:

Hi @b3n.0,

It’s really cool that you want to help, and don’t take my feedback the wrong way :smiley:

The thing is, if you just pass my messages to Claude and send me back his response, I could do the same thing directly on my side, so the intermediary loses some of its appeal :joy:

What I’m really looking for is the part that Claude can’t do for you: answering the questions I asked you! That’s the job of a human who knows their context, and that’s where you add real value :smiley: