TapHome

Shelly DUO MQTT

Packet Parser → MQTT
Submitted by
Last updated: 06. 2026
Shelly DUO MQTT

The Shelly DUO (model SHBDUO-1) is a Gen1 Wi-Fi LED smart bulb available in E27 and GU10 form factors. The plain DUO is white-only with tunable color temperature and dimmable brightness — it has no RGB channels (the RGB-capable variant is the DUO RGBW / shellycolorbulb- and uses a separate template). This is the MQTT variant of the TapHome integration; an HTTP variant is also available for single-bulb setups.

The template supports up to 5 DUO bulbs per module through a shared MQTT broker on the local network. Each bulb is identified by a bulbNtopic module variable pointing to the bulb’s MQTT Device ID, and exposes both a white-light device and an electric meter — 10 devices total.

Configuration

MQTT broker

The template needs an MQTT broker reachable on the local network — any standard broker works (Mosquitto, EMQX, or the broker built into Home Assistant). The broker runs on port 1883 with no TLS (Gen1 Shelly hardware does not support MQTT over TLS), so keep it on a trusted segment.

After importing the template, set the broker connection in the module’s import parameters:

ParameterDefaultDescription
MQTT Broker IP (IpAddress)192.168.0.1Broker address on the local network
MQTT Broker port (Port)1883Standard MQTT port (no TLS)
Transition time (TransitionTime)300Default per-bulb fade duration in milliseconds
Enabling MQTT on the bulb

Each Shelly DUO must be pointed at the broker before it will publish or accept commands:

  1. Open the bulb’s web UI at http://<bulb-ip> (find the IP in your router’s DHCP table or via the Shelly app)
  2. Go to Internet & SecurityAdvanced — MQTT and enable MQTT
  3. Enter the broker’s server (IP and port, e.g. 192.168.0.10:1883) and leave username / password empty (the TapHome template does not surface broker authentication)
  4. Optionally adjust the MQTT prefix if you do not want the default shellies/ShellyBulbDuo-<MAC6>
  5. Save and reboot the bulb — once it reconnects it starts publishing on shellies/ShellyBulbDuo-<id>/light/0/status
Device ID (bulbNtopic)

Each Shelly DUO has a unique MQTT Device ID in the format ShellyBulbDuo-<MAC6>, where <MAC6> is the last 6 hex characters of the MAC address (e.g. ShellyBulbDuo-B929CC). This same value is the bulb’s mDNS hostname (ShellyBulbDuo-<MAC6>.local).

The Device ID can be found:

  • In the Shelly web UI: SettingsDevice Infomqtt.id field
  • Via HTTP: GET http://<bulb-ip>/settingsmqtt.id
  • On the device label / packaging (last 6 chars of the MAC, lowercase hex)
  • As the mDNS hostname, e.g. ShellyBulbDuo-b929cc.local

Open the Shelly DUO MQTT module in TapHome and fill the topic variables for each bulb you want to use:

VariableDefaultDescription
bulb1topicShellyBulbDuo-deviceid1MQTT Device ID of the first DUO bulb
bulb2topicShellyBulbDuo-deviceid2MQTT Device ID of the second DUO bulb
bulb3topicShellyBulbDuo-deviceid3MQTT Device ID of the third DUO bulb
bulb4topicShellyBulbDuo-deviceid4MQTT Device ID of the fourth DUO bulb
bulb5topicShellyBulbDuo-deviceid5MQTT Device ID of the fifth DUO bulb

Replace the placeholder with the actual Device ID for each bulb you want to control (e.g. ShellyBulbDuo-B929CC). The module subscribes to shellies/# and the per-bulb listener scripts filter messages by topic prefix. Slots that are still left at the placeholder value raise an error in TapHome until they are configured or removed from the template.

Per-bulb transition time

Each Light device exposes a transitionTime custom variable (in milliseconds, range 0-5000 ms) which defaults to the module-level TransitionTime import parameter. Override it on individual bulbs if you want different fade durations — the value is sent on every brightness or CCT change as the transition field in the /light/0/set JSON payload.

Enabling MQTT on a Gen1 Shelly device disables Shelly Cloud — both cannot run simultaneously. HTTP REST and CoIoT remain available, so the bulb stays reachable from the local network.

Device capabilities

The template exposes 10 devices per module — 5 white-tunable lights and 5 electric meters, one pair per physical bulb. All 5 pairs are functionally identical, distinguished only by the bulbNtopic they listen on.

Light control

Each Light device is mapped as a White Light in TapHome with two control properties:

  • Brightness — read from the $.brightness field (0-100) of the light/0/status JSON, scaled to TapHome’s 0.0-1.0 range; written via light/0/set with "turn":"on", "brightness":N, "transition":<ms>
  • Color temperature — read from $.temp (3000-6500 K), written via light/0/set with "temp":K, "transition":<ms>

Switching the light off uses a separate light/0/command topic with the off payload, which is faster than constructing a JSON set message. Brightness and CCT updates always include the transition field so the bulb fades smoothly instead of jumping.

Power metering

Each Electric Meter device subscribes to two scalar topics published by the bulb roughly once per second:

TapHome valueSource topicSource unitConversionDisplay unit
Real-time powershellies/ShellyBulbDuo-<id>/light/0/powerW÷ 1000kW
Total consumptionshellies/ShellyBulbDuo-<id>/light/0/energywatt-minutes÷ 60000kWh

The watt-minute → kWh conversion is needed because Shelly Gen1 firmware reports cumulative energy in W·min rather than W·h.

Power monitoring is silently zero until Settings → Device Model is configured (E27 or GU10) in the Shelly app or web UI. The TapHome listener emits an info banner reminding you of this on first read. Once the model is set, the bulb starts reporting non-zero power/energy immediately.

Troubleshooting

Bulb not responding
  1. Verify the bulb is connected to Wi-Fi and reachable on the LAN — open http://<bulb-ip>/shelly. A response containing "type":"SHBDUO-1" confirms the device.
  2. Try the mDNS hostname (ShellyBulbDuo-<MAC6>.local) instead of the IP address — DHCP renewals or router reboots can change the IP.
  3. Confirm MQTT is enabled under the bulb’s Internet & Security → Advanced — MQTT settings and that the broker IP/port match the TapHome import parameters.
  4. Use an MQTT client (e.g. MQTT Explorer or mosquitto_sub -h <broker> -t 'shellies/#' -v) to verify the bulb is publishing on shellies/ShellyBulbDuo-<id>/....
“Set correct ‘bulbNtopic’ value” error

The listener script raises this error when a bulbNtopic is still set to the default placeholder (ShellyBulbDuo-deviceid). Either fill in the real Device ID for that slot, or remove the unused devices from the template if you only have a few bulbs.

Power and energy stay at zero
  1. Open the Shelly app (or web UI) → SettingsDevice Model and select the matching sub-model (Shelly Bulb DUO E27 or Shelly Bulb DUO GU10). The bulb only computes power/energy once the model is known.
  2. Confirm the bulb is actually on — the meter only updates while current is flowing.
  3. Subscribe to shellies/ShellyBulbDuo-<id>/light/0/power directly with an MQTT client to verify the bulb publishes a non-zero value.
Warmest CCT only goes down to 3000 K

The TapHome XML clamps CCT to 3000-6500 K to match the marketed E27 range. The hardware itself supports 2700-6500 K on the GU10 sub-model and through the raw /light/0/set API, so the warmest 300 K of the GU10’s range is unreachable through the TapHome template.

Light transitions look jerky

Increase the per-bulb transitionTime custom variable (or the module-level TransitionTime default). 300 ms is fine for small dimming steps but can look stepped on large brightness or CCT changes — try 800-1500 ms for a smoother fade.

Gen1 Shelly devices use plain MQTT on port 1883 — there is no TLS support. The TapHome template also does not expose broker username / password, so use an unauthenticated broker on a trusted local network or VLAN.

How to install in TapHome

Prerequisites

  • Shelly device connected to Wi-Fi (see HTTP connection guide if not done yet)
  • MQTT broker running on your local network (e.g., Mosquitto, Home Assistant, or TapHome built-in broker)
  • TapHome CCU on the same network as the broker

On Gen1 devices, enabling MQTT disables Shelly Cloud. Both cannot run simultaneously. On Gen2/Plus devices this limitation does not apply.

Step 1 — Enable MQTT on the Shelly device

Gen1 devices (Shelly 1, 1PM, 2.5, EM, 3EM, Plug S, RGBW2, Dimmer, TRV…)

  1. Open the Shelly web UI: http://<device-ip>/
  2. Navigate to Internet & SecurityAdvanced — MQTT
  3. Enable MQTT
  4. Set MQTT Server: <broker-ip>:<port> (e.g., 192.168.1.10:1883)
  5. Optionally set MQTT User and MQTT Password if your broker requires authentication
  6. Click Save — the device will reboot and connect to the broker

Gen2 / Plus devices (Shelly Plus 1, Plus 1PM, Plus 2PM, Plus Plug S, Plus H&T, Pro 3EM…)

  1. Open the Shelly web UI: http://<device-ip>/
  2. Navigate to SettingsMQTT
  3. Enable MQTT
  4. Set Server: <broker-ip>:<port> (e.g., 192.168.1.10:1883)
  5. The Client ID is pre-filled with the device ID (e.g., shellyplus1pm-AABBCCDDEE) — leave as-is unless you have a specific reason to change it
  6. Click Save and reboot the device

To verify MQTT is working, use an MQTT client (e.g., MQTT Explorer) and subscribe to shellies/# (Gen1) or <device-id>/# (Gen2). You should see status messages from the device.

Step 2 — Find the Device ID / MQTT Client ID

Some templates require a Device ID or MQTT Client ID parameter. This is the unique identifier used in MQTT topics.

  • Gen1: found on the label as MAC address (e.g., AABBCCDDEE). Device ID = shelly<model>-<mac>, e.g., shelly1pm-AABBCCDDEE
  • Gen2/Plus: found in the Shelly web UI under SettingsDevice InfoDevice ID, or on the device label

Step 3 — Configure in TapHome

  1. In TapHome, add a new Packet Parser (MQTT) module
  2. IP Address: enter the MQTT broker IP (e.g., 192.168.1.10)
  3. Port: 1883 (default; use 8883 for TLS)
  4. Device ID / MQTT Client ID: enter the value from Step 2 (if required by the template)
  5. Import the template — TapHome will subscribe to the device topics automatically

Available devices

Shelly DUO MQTT Module
Custom Variables
bulb1topic (string) = ShellyBulbDuo-deviceid1MQTT device ID of the first Shelly DUO bulb — format is 'ShellyBulbDuo-DEVICEID'
Open http://shellyIpAddress in a browser → Settings → Device Info → copy the mqtt.id (or Device ID) field. Default mDNS hostname matches the MQTT id (ShellyBulbDuo-{MAC6}.local).
bulb2topic (string) = ShellyBulbDuo-deviceid2MQTT device ID of the second Shelly DUO bulb
bulb3topic (string) = ShellyBulbDuo-deviceid3MQTT device ID of the third Shelly DUO bulb
bulb4topic (string) = ShellyBulbDuo-deviceid4MQTT device ID of the fourth Shelly DUO bulb
bulb5topic (string) = ShellyBulbDuo-deviceid5MQTT device ID of the fifth Shelly DUO bulb
Electric Meter 1 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) of bulb 1 — requires Settings → Device Model to be set in the Shelly app, otherwise both values stay at 0

numeric Unit: kW / kWh

Electric Meter 1

Listener
ADDINFO("To enable power monitoring, open device settings in Shelly app or web browser and configure device model in Settings->Device Model");

IF(INDEXOF(bulb1topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb1topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb1topic + "/light/0/power") = 0
    Ed := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 1000.0;
ELSEIF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb1topic + "/light/0/energy") = 0
    To := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 60000.0;
END
Light 1 White Light

White-tunable bulb 1 — on/off, brightness 0-100 % and color temperature 3000-6500 K with smooth transitions

json Unit: % / K json_path
Variable: transitionTimePer-bulb transition time in milliseconds (0-5000 ms) inherited from the TransitionTime import parameter

Light 1

Listener
IF(INDEXOF(bulb1topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb1topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb1topic + "/light/0/status") != 0
    RETURN(0);
END

IF RECEIVEDMSG.PAYLOAD.LENGTH = 0
    RETURN(0);
END

VAR ison := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.ison", 1);
VAR bright := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.brightness");

IF ISNULL(ison) OR ISNULL(bright)
    RETURN(0);
END

Ct := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.temp", 1);

IF ison
    Hb := bright / 100.0;
    St := isOn;
ELSE 
    Hb := 0;
    St := 0;
END
Write brightness
IF St > 0.5
    VAR topic := "shellies/" + bulb1topic + "/light/0/set";    
    MQTTPUBLISH(topic, "{\"turn\": \"on\", \"transition\": " + transitionTime + ", \"brightness\": " + ROUND(Hb*100.0) + "}");
ELSE
    MQTTPUBLISH("shellies/" + bulb1topic + "/light/0/command", "off");
END
Write color temperature
IF ISNAN(Ct)
    RETURN(0);
END

VAR topic := "shellies/" + bulb1topic + "/light/0/set";
MQTTPUBLISH(topic, "{\"transition\": " + transitionTime + ", \"temp\":" + Ct + "}");
Electric Meter 2 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) of bulb 2 — requires Settings → Device Model to be set in the Shelly app, otherwise both values stay at 0

numeric Unit: kW / kWh

Electric Meter 2

Listener
ADDINFO("To enable power monitoring, open device settings in Shelly app or web browser and configure device model in Settings->Device Model");

IF(INDEXOF(bulb2topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb2topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb2topic + "/light/0/power") = 0
    Ed := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 1000.0;
ELSEIF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb2topic + "/light/0/energy") = 0
    To := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 60000.0;
END
Light 2 White Light

White-tunable bulb 2 — on/off, brightness 0-100 % and color temperature 3000-6500 K with smooth transitions

json Unit: % / K json_path
Variable: transitionTimePer-bulb transition time in milliseconds (0-5000 ms) inherited from the TransitionTime import parameter

Light 2

Listener
IF(INDEXOF(bulb2topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb2topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb2topic + "/light/0/status") != 0
    RETURN(0);
END

IF RECEIVEDMSG.PAYLOAD.LENGTH = 0
    RETURN(0);
END

VAR ison := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.ison", 1);
VAR bright := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.brightness");

IF ISNULL(ison) OR ISNULL(bright)
    RETURN(0);
END

Ct := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.temp", 1);

IF ison
    Hb := bright / 100.0;
    St := isOn;
ELSE 
    Hb := 0;
    St := 0;
END
Write brightness
IF St > 0.5
    VAR topic := "shellies/" + bulb2topic + "/light/0/set";    
    MQTTPUBLISH(topic, "{\"turn\": \"on\", \"transition\": " + transitionTime + ", \"brightness\": " + ROUND(Hb*100.0) + "}");
ELSE
    MQTTPUBLISH("shellies/" + bulb2topic + "/light/0/command", "off");
END
Write color temperature
IF ISNAN(Ct)
    RETURN(0);
END

VAR topic := "shellies/" + bulb2topic + "/light/0/set";
MQTTPUBLISH(topic, "{\"transition\": " + transitionTime + ", \"temp\":" + Ct + "}");
Electric Meter 3 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) of bulb 3 — requires Settings → Device Model to be set in the Shelly app, otherwise both values stay at 0

numeric Unit: kW / kWh

Electric Meter 3

Listener
ADDINFO("To enable power monitoring, open device settings in Shelly app or web browser and configure device model in Settings->Device Model");

IF(INDEXOF(bulb3topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb3topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb3topic + "/light/0/power") = 0
    Ed := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 1000.0;
ELSEIF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb3topic + "/light/0/energy") = 0
    To := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 60000.0;
END
Light 3 White Light

White-tunable bulb 3 — on/off, brightness 0-100 % and color temperature 3000-6500 K with smooth transitions

json Unit: % / K json_path
Variable: transitionTimePer-bulb transition time in milliseconds (0-5000 ms) inherited from the TransitionTime import parameter

Light 3

Listener
IF(INDEXOF(bulb3topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb3topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb3topic + "/light/0/status") != 0
    RETURN(0);
END

IF RECEIVEDMSG.PAYLOAD.LENGTH = 0
    RETURN(0);
END

VAR ison := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.ison", 1);
VAR bright := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.brightness");

IF ISNULL(ison) OR ISNULL(bright)
    RETURN(0);
END

Ct := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.temp", 1);

IF ison
    Hb := bright / 100.0;
    St := isOn;
ELSE 
    Hb := 0;
    St := 0;
END
Write brightness
IF St > 0.5
    VAR topic := "shellies/" + bulb3topic + "/light/0/set";    
    MQTTPUBLISH(topic, "{\"turn\": \"on\", \"transition\": " + transitionTime + ", \"brightness\": " + ROUND(Hb*100.0) + "}");
ELSE
    MQTTPUBLISH("shellies/" + bulb3topic + "/light/0/command", "off");
END
Write color temperature
IF ISNAN(Ct)
    RETURN(0);
END

VAR topic := "shellies/" + bulb3topic + "/light/0/set";
MQTTPUBLISH(topic, "{\"transition\": " + transitionTime + ", \"temp\":" + Ct + "}");
Electric Meter 4 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) of bulb 4 — requires Settings → Device Model to be set in the Shelly app, otherwise both values stay at 0

numeric Unit: kW / kWh

Electric Meter 4

Listener
ADDINFO("To enable power monitoring, open device settings in Shelly app or web browser and configure device model in Settings->Device Model");

IF(INDEXOF(bulb4topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb4topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb4topic + "/light/0/power") = 0
    Ed := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 1000.0;
ELSEIF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb4topic + "/light/0/energy") = 0
    To := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 60000.0;
END
Light 4 White Light

White-tunable bulb 4 — on/off, brightness 0-100 % and color temperature 3000-6500 K with smooth transitions

json Unit: % / K json_path
Variable: transitionTimePer-bulb transition time in milliseconds (0-5000 ms) inherited from the TransitionTime import parameter

Light 4

Listener
IF(INDEXOF(bulb4topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb4topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb4topic + "/light/0/status") != 0
    RETURN(0);
END

IF RECEIVEDMSG.PAYLOAD.LENGTH = 0
    RETURN(0);
END

VAR ison := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.ison", 1);
VAR bright := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.brightness");

IF ISNULL(ison) OR ISNULL(bright)
    RETURN(0);
END

Ct := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.temp", 1);

IF ison
    Hb := bright / 100.0;
    St := isOn;
ELSE 
    Hb := 0;
    St := 0;
END
Write brightness
IF St > 0.5
    VAR topic := "shellies/" + bulb4topic + "/light/0/set";    
    MQTTPUBLISH(topic, "{\"turn\": \"on\", \"transition\": " + transitionTime + ", \"brightness\": " + ROUND(Hb*100.0) + "}");
ELSE
    MQTTPUBLISH("shellies/" + bulb4topic + "/light/0/command", "off");
END
Write color temperature
IF ISNAN(Ct)
    RETURN(0);
END

VAR topic := "shellies/" + bulb4topic + "/light/0/set";
MQTTPUBLISH(topic, "{\"transition\": " + transitionTime + ", \"temp\":" + Ct + "}");
Electric Meter 5 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) of bulb 5 — requires Settings → Device Model to be set in the Shelly app, otherwise both values stay at 0

numeric Unit: kW / kWh

Electric Meter 5

Listener
ADDINFO("To enable power monitoring, open device settings in Shelly app or web browser and configure device model in Settings->Device Model");

IF(INDEXOF(bulb5topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb5topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb5topic + "/light/0/power") = 0
    Ed := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 1000.0;
ELSEIF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb5topic + "/light/0/energy") = 0
    To := TODOUBLE(TOSTRING(RECEIVEDMSG.PAYLOAD)) / 60000.0;
END
Light 5 White Light

White-tunable bulb 5 — on/off, brightness 0-100 % and color temperature 3000-6500 K with smooth transitions

json Unit: % / K json_path
Variable: transitionTimePer-bulb transition time in milliseconds (0-5000 ms) inherited from the TransitionTime import parameter

Light 5

Listener
IF(INDEXOF(bulb5topic, "ShellyBulbDuo-deviceid") = 0)
    ADDERROR("Set correct 'bulb5topic' value in module variables. Topic format is 'ShellyBulbDuo-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + bulb5topic + "/light/0/status") != 0
    RETURN(0);
END

IF RECEIVEDMSG.PAYLOAD.LENGTH = 0
    RETURN(0);
END

VAR ison := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.ison", 1);
VAR bright := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.brightness");

IF ISNULL(ison) OR ISNULL(bright)
    RETURN(0);
END

Ct := PARSEJSON(RECEIVEDMSG.PAYLOAD, "$.temp", 1);

IF ison
    Hb := bright / 100.0;
    St := isOn;
ELSE 
    Hb := 0;
    St := 0;
END
Write brightness
IF St > 0.5
    VAR topic := "shellies/" + bulb5topic + "/light/0/set";    
    MQTTPUBLISH(topic, "{\"turn\": \"on\", \"transition\": " + transitionTime + ", \"brightness\": " + ROUND(Hb*100.0) + "}");
ELSE
    MQTTPUBLISH("shellies/" + bulb5topic + "/light/0/command", "off");
END
Write color temperature
IF ISNAN(Ct)
    RETURN(0);
END

VAR topic := "shellies/" + bulb5topic + "/light/0/set";
MQTTPUBLISH(topic, "{\"transition\": " + transitionTime + ", \"temp\":" + Ct + "}");
Connection: Packet Parser → MQTT
Possible improvements (7)
  • Connection Status (LWT) — Last Will and Testament — true on connect, false on disconnect. Could detect offline bulbs.
  • Full Status JSON — Complete /status as JSON. Could expose wifi_sta.rssi, has_update, uptime, source of last command.
  • Device Announce — Emitted on boot/announce — payload {id, model, mac, ip, fw_ver, new_fw}. Useful for auto-discovery.
  • White channel (0-100 %) — Separate 'white' parameter (0-100) on the set JSON; template only writes brightness/temp.
  • Timer (auto on/off) — Auto-off timer in seconds via set JSON. Not surfaced as TapHome capability.
  • Warm-white below 3000 K — TapHome XML clamps MinColorTemperature to 3000 K; the bulb hardware can go down to 2700 K (GU10). E27 marketed range starts at 3000 K — clamp matches E27 spec but loses 300 K of GU10 range.
  • MQTT broker authentication — Shelly device side supports MQTT username/password, but TapHome import parameters do not expose them. Workaround: open broker without auth on a trusted segment.

Sources

Found a problem with this device template?

Tell us what's wrong, what's missing, or how the template should behave. We rely on your feedback to keep the catalog accurate.

Verified by TapHome

Want to use this in your TapHome Core?

Open this template in the Customer Portal to apply it to one of your homes, or to draft a refinement and submit it back to the catalog.

Open in portal