Matterbridge plugin for Magic Home and Gladys

Excellent! Super clean :slight_smile:

If you ever want to make it simpler, and allow other people to use this integration, you could write a small Matterbridge plugin (with the help of AI, relatively easy), that way this device would become Matter, and therefore compatible with Gladys

I’ll be honest, I had explored that possibility. But I ran into quite a few problems enabling IPv6 on my network. And I have professional services running at home too, so I’m a bit afraid of messing things up.

But it could be interesting to explore, because anyway even if what I did works, it’s far from perfect. There’s some delay/lag, and if we want to start changing the colors of several

Basically, if you just run Matterbridge on the same machine as Gladys, it won’t even go through your network, so you can « ignore » the warning that tells you you need an IPv6 interface. In my opinion it’ll work anyway (not 100% sure, but from experience it does).

I created a custom Matterbridge plugin for my Magic Home LED strips (5 RGBWW controllers exposed as extendedColorLight). The on/off and brightness work perfectly, but the colors never change.

Error in Gladys logs

ValidationDatatypeMismatchError/128: Expected number, got object.
at TlvNumberSchema.validate (/src/server/services/matter/node_modules/@matter/types/src/tlv/TlvNumber.ts:110:19)
at ObjectSchema.validate (…)
at Object.ClusterClient.commands. \[as moveToHueAndSaturation\]
at MatterHandler.setValue (/src/server/services/matter/lib/matter.setValue.js:160:24)

Cause identified in matter.setValue.js line \~160

await colorControl.moveToHueAndSaturation({
  hue: matterHue,
  saturation: matterSaturation,
  transitionTime: null,                    // ← should be 0
  optionsMask: { executeIfOff: true },     // ← object instead of a number (bitmap)
  optionsOverride: {},                     // ← object instead of 0
});

The optionsMask is passed as a JS object, but ColorControl.moveToHueAndSaturation from the @matter/main lib expects a number (bitmap). The same pattern works for LevelControl.moveToLevel because that cluster accepts objects, but ColorControl rejects them.

Proposed fix

await colorControl.moveToHueAndSaturation({
  hue: matterHue,
  saturation: matterSaturation,
  transitionTime: 0,
  optionsMask: 1,
  optionsOverride: 0,
});

Environment

  • Gladys v4 (image gladysassistant/gladys:v4)
  • Matterbridge 3.6.1 (luligu/matterbridge:latest)
  • Custom plugin matterbridge-magic-home with device type extendedColorLight
  • NAS Synology DS1520+, Docker, --network=host

Do you want me to make a new post since it’s not really the same integration anymore?

I took the liberty of splitting the conversation for matterbridge and keeping the MQTT tutorial clean.

Great, thanks!