MQTT Config for Shelly Duo Light Bulb

https://shopusa.shelly.cloud/shelly-duo-wifi-smart-home-automation-1#326

Here is my MQTT Light config for a Shelly Duo bulb - couldn’t find any templates for this one, scraped this together from various other posts. On/off, brightness, color temp and state all working. This is using the native MQTT service on the bulb, with the Shelly cloud function disabled.

light:
  - platform: mqtt
    schema: template
    name: Shelly Duo
    max_mireds: 370
    min_mireds: 154
    state_topic: "shellies/[friendly name]t/light/0/status"
    state_template: "{% if value_json.ison %}on{% else %}off{% endif %}"
    brightness_template: "{{ value_json.brightness | float | multiply(2.55) | round(0) }}"
    color_temp_template: "{{ 1000000 | multiply(1/(value_json.temp | float)) | round(0) }}"
    command_topic: "shellies/[friendly name]/light/0/set"
    command_on_template: >-
      {
      "turn":"on"
      {% if brightness is defined %}
        "brightness":{{brightness | float | multiply(0.3922) | round(0)}}
      {% endif %}
      {% if color_temp is defined %}
        "temp":{{ (1/(color_temp | float)) | multiply(1000000) | round(0) }}
      {% endif %}
      }
    command_off_template: '{"turn":"off"}'
6 Likes