MQTT JSON rgb light setting color values

I have a rgb led strip, and it is working fine when controlled by the home assistant front end

Config:
light:

  • platform: mqtt_json
    name: mqtt_json_light_2
    state_topic: “home/ESP_RGB_1”
    command_topic: “home/ESP_RGB_1/set”
    brightness: true
    rgb: true
    effect: true
    effect_list: [colorfade_slow, colorfade_fast, flash]
    optimistic: false
    qos: 0
    retain: true

I cannot get the automation to set the rgb value. The MQTT message always contains 255,255,255

      - service: light.turn_on
        data:
          entity_id: light.mqtt_json_light_2
          brightness: 100
          rgb_color: ['100', '100', '100']
          transition: 5

The MQTT message is
{“brightness”: 100, “state”: “ON”, “color”: {“g”: 255, “b”: 255, “r”: 255}, “transition”: 5}

What is wrong in my automation?

I had ‘fun’ getting this to work as well, end up using xy colour in the form…

xy_color: [ 0.136, 0.041 ]

Maybe try yours without the quote marks?

It dit not work. i changed the rgb in the form …

rgb_color: [ 100, 100, 100 ]

also:
rgb_color: [100, 100, 100]
has no effect.

I could not figure out how to set the colors. Now I changed to creating the mqtt publish string in an automation.

It is a complex string but it is working fine,

1 Like

In case anybody else runs into this issue, I got it working with the following script:

  - service: light.turn_on
    data:
      entity_id: light.led_strip
      effect: solid
      brightness: 130
      rgb_color: [190,0,255]

Hopefully that helps someone