Problem to get rgb color from bulb with mqtt

Hi,
I run an openhab 3 installation on a RPI4 and everything run fine.
I have many Xiaomi sensors and Zigbee plugs.
I’m on the road to remove my Philips Hue Bridge to put everything on OH3.
I’m able to control the light, brightness, color and everything. The only problem I have is that I didn’t achieve to retrieve in openhab the current color of the light. I can see with mqttexplorer interesting topic for the bulb :

info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/brightness', payload '153'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color-h', payload '200'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color_temp', payload '590'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color-s', payload '100'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/linkquality', payload '125'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color-v', payload '80'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/state', payload 'ON'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color-x', payload '0.562267438989995'
info  2021-11-13 21:55:48: MQTT publish: topic 'zigbee2mqtt/LIGHT_HUE_STRIP_1/color-y', payload '0.403822425671539'

I see many things for the color but in two topic if i want to get it from XY or three if i want to get it from HSB.
What is the best way to get the current color of a RGB bulb in Openhab from MQTT ?

Regards

You could link each value to an item then create rules to handle HSB to RGB conversion

The Color item in openHAB is RGB

Create a color item not linked to MQTT and change with rules.

1 Like

MQTT binding color type channel has capabilities for RGB or HSB or XYY
https://www.openhab.org/addons/bindings/mqtt.generic/#channel-type-color

On looking at the MQTT you’re considering though, you won’t be able to get of that to work because your information is sent across different topics.
Going to have to load to separate working Items, and combine to a color type in a rule.

I think you can get the info more usefully in one MQTT payload though

1 Like

Thank you a lot, it works now.
Main problem was that i did’nt have JSONPath transformation and JS transformation installed…

1 Like

Hi Jeremy, could you please share your solution? I am facing the same problem.