Shelly pro RGB WW PM, homekit and mqtt

Hi there, i am trying to implement shelly pro RGBW PM via mqtt (native binding is not working) but i stucked and not sure what is the right direction to go.

1/ Item

Type: color → don’t why it needs transformation profile (default is not available) and dont know if i should put my transformation scripts there on in the channel config…

2/ Channel

Type: color and string (both checked)

rgb_color:
type: color
label: RGB Color
config:
stateTopic: shellyprorgbwwpm-ece334f91f6c/status/rgb:0
commandTopic: shellyprorgbwwpm-ece334f91f6c/rpc
transformationPattern:
- JS:extract_rgb.js
transformationPatternOut:
- JS:toshelly.js

3/ toshelly.js :slight_smile:

(function (input) {

  if (!input) return null;

  var parts = input.split(",");
  if (parts.length < 3) return null;

  var h = parseFloat(parts[0]) % 360;
  var s = parseFloat(parts[1]) / 100;
  var v = parseFloat(parts[2]) / 100;

  var c = v * s;
  var x = c * (1 - Math.abs((h / 60) % 2 - 1));
  var m = v - c;

  var r = 0, g = 0, b = 0;

  if (h < 60) { r = c; g = x; b = 0; }
  else if (h < 120) { r = x; g = c; b = 0; }
  else if (h < 180) { r = 0; g = c; b = x; }
  else if (h < 240) { r = 0; g = x; b = c; }
  else if (h < 300) { r = x; g = 0; b = c; }
  else { r = c; g = 0; b = x; }

  r = Math.round((r + m) * 255);
  g = Math.round((g + m) * 255);
  b = Math.round((b + m) * 255);

  var brightness = Math.round(v * 100);
  var on = brightness > 0;

  return JSON.stringify({
    id: 0,
    src: "openhab",
    method: "RGB.Set",
    params: {
      id: 0,
      on: on,
      rgb: [r, g, b],
      brightness: brightness
    }
  });

})(input);

When i change the item

2026-04-24 18:53:51.279 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ predicted to become ON
2026-04-24 18:53:51.281 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ predicted to become 0,0,100
2026-04-24 18:53:51.281 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ changed from 0,0,0 to 0,0,100 (source: org.openhab.core.autoupdate.optimistic)
2026-04-24 18:53:51.433 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ received command OFF (source: org.openhab.io.homekit)
2026-04-24 18:53:51.433 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ predicted to become OFF
2026-04-24 18:53:51.435 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ changed from 0,0,100 to 0,0,0 (source: org.openhab.core.autoupdate.optimistic)
2026-04-24 18:53:51.687 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ received command ON (source: org.openhab.io.homekit)
2026-04-24 18:53:51.688 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ predicted to become ON
2026-04-24 18:53:51.689 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Shelly_Pro_RGBWWPM_ece334f91f6c_DOL_RGB_ColorHSB’ changed from 0,0,0 to 0,0,100 (source: org.openhab.core.autoupdate.optimistic)

there is now activity in the mqtt binding (debug log level) and of course no activity in mqtt broker.

I don’t know what is the best approach for keeping both sides synchronized, and converted from HSB to RGB and vice versa.