Help Needed: MQTT Light config seems impossible to do with an Shelly.Cloud Bulb

Hi All

I tried to make my Shelly.Cloud Bulb work, but i seem to be missing something.

According to https://shelly-api-docs.shelly.cloud/?shell#bulb-mqtt
I should send on and off commands to the /color/0/command topic, but the rest of the commands should go to the /color/0/set topic. Then status is always provided back in /color/0/status

I have tried various different configurations, but i always end up something missing or working completely. EG: I can switch on the light, change colors (rgb), but not switch off. Or i can switch on and off, but not change color (rgb), etc etc

Here i have posted my two most recent configs.

In the “LED Huiskamer 1-a” config i need the brightness_command_template, so it doesn’t just send the brightness as an INT to the /color/0/set topic, but a nicely formatted json. Alas, the brightness_command_template is not allowed in the config. :frowning:

In the “LED Huiskamer 1-b” i can not switch off the device. Because off commands always go to the command_topic. But on/off and color/brightness have different topics in this bulb. (see the url mentioned above)

To remove confusion. I didn’t use these two configs at the same time. It’s just posted here as one.

How to properly setup this Shelly.Cloud bulb in HA ?

Kind regards in advance :slight_smile:


light:
  - platform:                     mqtt
    name:                         "LED Huiskamer 1-a"
    state_topic:                  "shellies/shellybulb-420FB6/color/0"
    command_topic:                "shellies/shellybulb-420FB6/color/0/command"
    rgb_state_topic:              "shellies/shellybulb-420FB6/color/0/status"
    brightness_state_topic:       "shellies/shellybulb-420FB6/color/0/status"
    rgb_command_topic:            "shellies/shellybulb-420FB6/color/0/set"
    brightness_command_topic:     "shellies/shellybulb-420FB6/color/0/set"
    payload_on:                   "on"
    payload_off:                  "off"
    rgb_command_template:         '{ "mode":"color", "red":{{red}}, "green":{{green}}, "blue":{{blue}} }'
    rgb_value_template:           "{{value_json.red}},{{value_json.green}},{{value_json.blue}}"
    brightness_scale:             100
    brightness_value_template:    "{{ value_json.gain  }}"
    #brightness_command_template: '{ "mode":"color", "gain":{{ brightness }} }'
    retain:                       false
    qos:                          1
    optimistic:                   false

  - platform: mqtt
    name: "LED Huiskamer 1-b"
    schema: template
    state_topic:                  "shellies/shellybulb-420FB6/color/0/status"
    command_topic:                "shellies/shellybulb-420FB6/color/0/set"
    command_on_template: >         
      { "mode":"color" 
      {%- if red is defined and green is defined and blue is defined -%} ,"red":{{ red }},"green":{{ green }},"blue":{{ blue }}  {%- endif -%}    
      {%- if brightness is defined -%},"gain":{{ (brightness|float / 2.55)|round(0) }}{%- else -%},"gain":10{%- endif -%} 
      }
    command_off_template:         '{ "mode":"white","brightness":0 }'
    state_template:               '{% if value_json is defined and value_json.ison is defined and value_json.ison==1 %}on{% else %}off{% endif %}'
    brightness_template:          '{{ (value_json.gain|float * 2.55)|round(0) }}'
    red_template:                 '{{value_json.red}}'
    green_template:               '{{value_json.green}}'
    blue_template:                '{{value_json.blue}}'
    retain:                       false
    qos:                          2
    optimistic:                   false

please anyone?

bump

have a look here to see if that helps you

towards the end there is a config that works for thew RGBW les light

As you probably already know, MQTT Light, using the template schema, only supports one command topic.

If you absolutely must have two command topics, here’s one way to do it:

  • Set command_topic to a new topic called shellybulb-420FB6/command.
  • Create an automation triggered by shellybulb-420FB6/command.
  • Make the automation’s action re-publish the received payload (with suitable modifications) to two separate topics: /color/0/command and /color/0/set.

I offered the same solution to someone who needed to convert the command payload but the component lacks a command_template.

Can you adapt to this?
I can’t seem to but would love to know how to…