Mqtt light default schema for Shelly RGBW2 (RGBW and CCT)

I used the same code as above. Here’s what’s in the mqtt.yaml


light:
  - name: "Lounge LEDs"
    unique_id: lounge-leds
    retain: false
    qos: 1
    # Online
    availability_topic: "shellies/shellyrgbw2-E747F2/online"
    payload_available: "true"
    payload_not_available: "false"

    # ON/OFF
    command_topic: "shellies/shellyrgbw2-E747F2/color/0/command"
    state_topic: "shellies/shellyrgbw2-E747F2/color/0"
    payload_on: >-
      on
    payload_off: >-
      off

    # RGBW
    rgbw_command_topic: "shellies/shellyrgbw2-E747F2/color/0/set"
    rgbw_command_template: >
      {
        "red": {{ red }},
        "green": {{ green }},
        "blue": {{ blue }},
        "white": {{ white }}
      }
    rgbw_state_topic: "shellies/shellyrgbw2-E747F2/color/0/status"
    rgbw_value_template: "{{value_json.red}},{{value_json.green}},{{value_json.blue}},{{value_json.white}}"

    # BRIGHTNESS
    brightness_command_topic: "shellies/shellyrgbw2-E747F2/color/0/set"
    brightness_command_template: >
      {
        "gain": {{ value | float | multiply(0.3922) | round(0) }}
      }
    brightness_state_topic: "shellies/shellyrgbw2-E747F2/color/0/status"
    brightness_value_template: "{{ value_json.gain | float | multiply(2.55) | round(0) }}"

    # EFFECTS
    effect_command_topic: "shellies/shellyrgbw2-E747F2/color/0/set"
    effect_command_template: >
      {
      {% if value == "Off" %}
      "effect": "0"
      {% elif value == "Meteor Shower" %}
      "effect": "1"
      {% elif value == "Gradual Change" %}
      "effect": "2"
      {% elif value == "Flash" %}
      "effect": "3"
      {% endif %}
      }
    effect_state_topic: "shellies/shellyrgbw2-E747F2/color/0/status"
    effect_value_template: >-
      {% if value_json.effect == 0 %}
        Off
      {% elif value_json.effect == 1 %}
        Meteor Shower
      {% elif value_json.effect == 2 %}
        Gradual Change 
      {% elif value_json.effect == 3 %}
        Flash
      {% endif %}
    effect_list:
      - "Off"
      - "Meteor Shower"
      - "Gradual Change"
      - "Flash"

And this is the output from the MQTT Explorer

I cannot see online topic on your screenshot.
what version of rgbw2 firmware you use?

you can comment the line witg online topic (add # at line beginning) to disable availability check

Thanks - I did wonder about that one. I’ve removed it and restarted HA. The light is now showing as “off”.

The firmware is 20220809-124336/v1.12-g99f7e0b which says it’s the latest.

Removing that online check has made it work. Thank you.

btw you don’t need to restart HA. in developer/yaml section you can find an option to reload manually configured mqtt entities

Otherwise recent firmware of rgbw2 reports availability for sure

I’ve edited the yaml for a shelly rgbw2 configured for all white channels:

mqtt:
  light:
    - name: Arbeitslicht-c0"
      unique_id: shellyrgbw2-Arbeitslicht-c0
      retain: false
      qos: 1
      command_topic: "shellies/shellyrgbw2-Arbeitslicht/white/0/set"
      brightness_command_topic: "shellies/shellyrgbw2-Arbeitslicht/white/0/set"
      state_topic: "shellies/shellyrgbw2-Arbeitslicht/white/0/status"
      brightness_state_topic: "shellies/shellyrgbw2-Arbeitslicht/white/0/status"
      payload_available: "true"
      payload_not_available: "false"
      brightness_command_template: >
        {
          "brightness": {{ value | float | multiply(0.3922) | round(0) }}
        }
      payload_on: >-
        {"turn": "on"}
      payload_off: >-
        {"turn": "off"}
      state_value_template: >-
        {% if value_json.ison %}{"turn": "on"}
        {% else %}{"turn": "off"}
        {% endif %}
      brightness_value_template: "{{ value_json.brightness | float | multiply(2.55) | round(0) }}"

(Only copied for 1 channel, I’ve added this config for all 4 channels seperatelly und grouped them with the group functionallity)

I’ve removed following availabillity line, as such an topic does not assist for the shelly afaik

 availability_topic: "shellies/light-hall2/online"