Tuya bulbs colour_data (dps24) in hex

Hi there,
tuya-mqtt running, device type ‘RGBTWLight’

Device needs :slight_smile:
tuya/ikeabulb05/hsb_state 32,100,100
tuya/ikeabulb05/dps/state {“24”:“002003e803e8”}
tuya/ikeabulb05/dps/24/state 002003e803e8

i need to convert HSB type from 32,100,100 to hex befor publish. Whats the best way to do it ? use tuya-mqqt device config:
commandMath: ‘…’ // but how to substring 3 values conver to hex and concat

openhab formatbeforpublish ? how ?

Please help

No, you cannot do maths there. You’ll need a scripted transformation. Search this forum for e.g. HSV → RGB transforms for ideas.

Sorry, did it without transformation. Tuya exposes a channel with can be directly used for that :
Working config:

Thing topic ikeabulb05      "IKEA Bulb 05" {


            Type switch : switch "Ikea Bulb 05 Switch"      [ stateTopic="tuya/ikeabulb05/dps/20/state", commandTopic="tuya/ikeabulb05/dps/20/command", on="true", off="false"]

            Type dimmer : dimmer "Ikea Bulb 05 Dimmer"      [ stateTopic="tuya/ikeabulb05/dps/22/state", commandTopic="tuya/ikeabulb05/dps/22/command", min=10, max=1000, step=1]

        Type string : work_mode "Ikea Bulb 05 Work Mode"    [ stateTopic="tuya/ikeabulb05/dps/21/state", commandTopic="tuya/ikeabulb05/dps/21/command"]

        Type number : color_temp "Ikea Bulb 05 ColorTemp"   [ stateTopic="tuya/ikeabulb05/dps/23/state", commandTopic="tuya/ikeabulb05/dps/23/command", min=0, max=1000, step=1]

        Type colorHSB : colour_data "Ikea Bulb 05 HSB colour data" [ stateTopic="tuya/ikeabulb05/hsb_state", commandTopic="tuya/ikeabulb05/hsb_command"]

Group gSwiatlo5                            "Lampa 5"                                                       { homekit="Lighting", ga="Light" [ useKelvin=true, colorTemperatureRange="2200,4000", roomHint="Jadalnia"]}

        Switch ZigbeeKitchenBulb5Switch             "5 [%s]"                <light>                 (gSwiatlo5) { homekit="Lighting.OnState", ga="lightPower", channel="mqtt:topic:mymqttbroker:ikeabulb05:switch"}

        Number ZigbeeKitchenBulb5ColorTemperature   "5 [%s]"                <light>                 (gSwiatlo5) { homekit="Lighting.ColorTemperature" [minValue=50, maxValue=400],channel="mqtt:topic:mymqttbroker:ikeabulb05:color_temp"}

        Color ZigbeeKitchenBulb5ColourData      "5 HSB [%s]"        <light>                 (gSwiatlo5) { homekit="Lighting.Hue, Lighting.Brightness, Lighting.Saturation", ga="lightColor", channel="mqtt:topic:mymqttbroker:ikeabulb05:colour_data"}

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.