
The Shelly 3EM is a 3-phase Wi-Fi energy meter from Shelly’s first generation (Gen1). It measures active power, voltage, current, power factor and lifetime energy independently for each of three phases using three included 120 A split-core CT clamps, and includes a built-in 10 A relay typically used to drive an external power contactor coil. TapHome communicates with the device over MQTT — the device pushes per-phase measurements to a broker, the TapHome PacketParser module subscribes to the shellies/# topic tree and routes the values to four child devices (3 electric meters + 1 contactor switch).
This is the MQTT variant of the Shelly 3EM template. An HTTP variant is also available — choose MQTT when you already run a local MQTT broker, want push-based updates instead of polling, or need to share the meter with multiple consumers (TapHome plus another system). Note that enabling MQTT on Gen1 firmware disables Shelly Cloud — the two cannot run simultaneously.
Configuration
Enabling MQTT in the Shelly 3EM
Open the Shelly 3EM web UI (http://{device-ip} or http://shelly3em-{MAC}.local) and configure the MQTT client:
- Go to Internet & Security → Advanced - Developer Settings
- Tick Enable action execution via MQTT
- Fill Server with
{MQTT broker IP address}:{port}— typically192.168.1.10:1883 - (Optional) Set Username and Password if the broker requires authentication
- Click SAVE — the device reboots and connects to the broker
Gen1 Shelly devices do not support MQTT over TLS. Communication between the device and the broker is unencrypted plain TCP on port 1883. Username and password are sent in plaintext. Use the MQTT broker only on a trusted local network.
Enabling MQTT automatically disables Shelly Cloud on Gen1 firmware. To revert, untick the MQTT option and re-enable Cloud in Internet & Security.
Finding the Device ID
The TapHome template subscribes to shellies/shellyem3-{dID}/#, where {dID} is the device’s MAC suffix used as the MQTT topic prefix.
To find it in the Shelly 3EM web UI:
- Open the device web UI in a browser
- Go to Settings → Device Info
- Copy the first Device ID string (NOT the value in brackets) — this equals the WiFi MAC address (e.g.,
DC4F227649A1)
Alternatively, query GET http://{device-ip}/settings and read the mqtt.id field.
Template setup
After importing the template in TapHome, set three import parameters:
| Parameter | Description | Example |
|---|---|---|
| IpAddress | MQTT broker IP address | 192.168.1.10 |
| Port | MQTT broker port | 1883 |
| dID | Device ID (MAC suffix) of the Shelly 3EM | DC4F227649A1 |
The module then subscribes to shellies/# (QoS 0) and listener scripts route per-phase emeter and relay messages to the corresponding child devices. The default MQTT update period of the device is 30 seconds — it can be reduced via GET http://{device-ip}/settings?mqtt_update_period=N (set 0 to publish only on change).
The MQTT topic prefix on the wire is
shellyem3-{MAC}while the device’s mDNS hostname isshelly3em-{MAC}.local— Shelly uses two different forms for the same device. The template follows the actual MQTT topic prefix (shellyem3-). If MQTT messages do not arrive, subscribe toshellies/#with an MQTT client to verify the prefix the firmware is using.
Device capabilities
Per-phase active power and lifetime energy
The template creates three electric meter devices — one for each phase (CT clamp 1 → phase A, clamp 2 → phase B, clamp 3 → phase C). Each meter reads two values:
- Active power — instantaneous power from
shellies/shellyem3-{dID}/emeter/{i}/power(W), divided by 1000 and stored as kW - Total energy consumed — lifetime cumulative energy from
.../emeter/{i}/total(Wh), divided by 1000 and stored as kWh
Each CT clamp is rated for 120 A and is non-invasive (clip-on, no wire cutting required). The included 3 CT clamps are individually marked and calibrated — they are NOT interchangeable between channels.
Per-phase electrical parameters
Each electric meter exposes four service attributes for advanced monitoring:
- Voltage [V] — RMS line-to-neutral voltage on that phase (
.../emeter/{i}/voltage) - Current [A] — RMS current measured by the corresponding CT clamp (
.../emeter/{i}/current) - Power factor — ratio of active to apparent power, range −1.00 to 1.00 (
.../emeter/{i}/pf) - Returned energy [Wh] — lifetime energy returned to the grid on that phase (
.../emeter/{i}/total_returned), useful for PV / bidirectional metering
The combination of total (consumed) and total_returned (exported) per phase makes the template suitable for solar / grid-feed installations.
Energy counter reset
Each phase has a Reset total service action that publishes reset_totals to shellies/shellyem3-{dID}/emeter/{i}/command. This zeroes both the total and total_returned counters for that specific phase — useful when re-purposing the meter or starting a new measurement period.
Contactor relay
The on-board 10 A relay is exposed as a switch device. The state is read from shellies/shellyem3-{dID}/relay/0 (on → 1, anything else → 0) and controlled by publishing on or off to .../relay/0/command. The relay is rated 10 A / 240 V AC and is typically wired through the I (line input) and O (relay output) terminals to drive the coil of an external power contactor for switching higher loads.
The MQTT template does not publish a 3-phase total power sum (
total_poweris HTTP-only on Gen1). Create a TapHome virtual device that sums the three per-phase power values if you need a single household-power figure.
Troubleshooting
No MQTT messages received
- Confirm MQTT is enabled in the Shelly web UI (Internet & Security → Advanced - Developer Settings → Enable action execution via MQTT) and the device has rebooted after saving
- Verify the broker IP and port in the device match the
IpAddress/Portimport parameters in TapHome - Subscribe to
shellies/#with an MQTT client (e.g., MQTT Explorer,mosquitto_sub) and check whether the device publishes anything — verify the actual topic prefix (shellyem3-{dID}) matches thedIDyou entered in TapHome - Ensure the MQTT broker is running and reachable from both the Shelly 3EM and the TapHome Core
- If the device IP recently changed, try connecting to the mDNS hostname
shelly3em-{MAC}.localto verify the device is reachable on the network
Energy readings show zero or implausible values
- Confirm each CT clamp is connected to the correct input — clamp marked
IAmust be wired to terminalsIA-/IA+,IBtoIB-/IB+,ICtoIC-/IC+. The clamps are calibrated per channel and are not interchangeable. - Verify the arrow on the CT clamp body points in the direction of current flow (from source towards load). A reversed clamp produces a negative power factor and inverts the consumption / return classification.
- Check that voltage inputs
VA,VB,VCare wired to the matching phases that the CT clamps measure — mismatched voltage / current pairing produces wrong power and power-factor readings. - If a single phase reads zero while the others are correct, swap that CT clamp with a known-good one to isolate clamp vs. circuit.
Cannot enable MQTT — Cloud is in use
On Gen1 firmware, MQTT and Shelly Cloud are mutually exclusive. If the Enable action execution via MQTT checkbox is greyed out, disable Shelly Cloud first under Internet & Security → Cloud, then re-open the MQTT settings.
Shelly Cloud history disappeared after enabling MQTT
This is expected — enabling MQTT disables Cloud, including its 365-day history retention. If you need both real-time MQTT control in TapHome and long-term history, route MQTT messages through your own broker and keep historical data in TapHome (or a separate logging system).
Each CT clamp must always be wired to the Shelly 3EM terminals before clipping it around a live conductor. Voltage induced across an open CT secondary winding can reach dangerous levels and damage the clamp.